Creates a 'Rectangles' track from intervals and values.
gtrack.2d.create(
track = NULL,
description = NULL,
intervals = NULL,
values = NULL
)None.
This function creates a new 'Rectangles' (two-dimensional) track with values at given intervals. 'description' is added as a track attribute.
When multiple databases are connected via gsetroot, the track
is created in the current working directory (.misha$GWD), which defaults to the
last connected database. Use gdir.cd with an absolute path to
change where new tracks are created.
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 52.11416 1
#> 2 chr1 400 500 chr1 600 800 41.04894 1
#> 3 chr1 600 700 chr1 900 1100 18.31509 1
#> 4 chr1 800 900 chr1 1200 1400 34.33509 1
#> 5 chrX 700 750 chr2 200 330 22.33823 8
#> 6 chrX 800 850 chr2 400 530 72.71936 8
#> 7 chrX 900 950 chr2 600 730 56.65679 8
#> 8 chrX 1000 1050 chr2 800 930 25.19220 8
gtrack.rm("test_rects", force = TRUE)