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

# \dontshow{
options(gmax.processes = 2)
# }

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  46.836666          1
#> 2   chr1    400  500   chr1    600  800  87.923309          1
#> 3   chr1    600  700   chr1    900 1100   1.580278          1
#> 4   chr1    800  900   chr1   1200 1400  74.115219          1
#> 5   chrX    700  750   chr2    200  330  53.429451          8
#> 6   chrX    800  850   chr2    400  530  96.653961          8
#> 7   chrX    900  950   chr2    600  730  48.188290          8
#> 8   chrX   1000 1050   chr2    800  930  56.003983          8
gtrack.rm("test_rects", force = TRUE)