Creates a 'Rectangles' track from intervals and values.

gtrack.2d.create(
  track = NULL,
  description = NULL,
  intervals = NULL,
  values = NULL
)

Arguments

track

track name

description

a character string description

intervals

a set of two-dimensional intervals

values

an array of numeric values - one for each interval

Value

None.

Details

This function creates a new 'Rectangles' (two-dimensional) track with values at given intervals. 'description' is added as a track attribute.

Examples


gdb.init_examples()
intervs1 <- gintervals.2d(
    1, (1:4) * 200, (1:4) * 200 + 100,
    1, (1:4) * 300, (1:4) * 300 + 200
)
intervs2 <- gintervals.2d(
    "X", (7:10) * 100, (7:10) * 100 + 50,
    2, (1:4) * 200, (1:4) * 200 + 130
)
intervs <- rbind(intervs1, intervs2)
gtrack.2d.create(
    "test_rects", "Test 2d track", intervs,
    runif(dim(intervs)[1], 1, 100)
)
gextract("test_rects", .misha$ALLGENOME)
#>   chrom1 start1 end1 chrom2 start2 end2 test_rects intervalID
#> 1   chr1    200  300   chr1    300  500   8.994264          1
#> 2   chr1    400  500   chr1    600  800  83.598969          1
#> 3   chr1    600  700   chr1    900 1100  60.475327          1
#> 4   chr1    800  900   chr1   1200 1400  16.563635          1
#> 5   chrX    700  750   chr2    200  330   1.732545          8
#> 6   chrX    800  850   chr2    400  530  47.172955          8
#> 7   chrX    900  950   chr2    600  730  50.279961          8
#> 8   chrX   1000 1050   chr2    800  930  29.686956          8
gtrack.rm("test_rects", force = TRUE)