Modifies 'Dense' track contents.
Details
This function modifies the contents of a 'Dense' track by the values of 'expr'. 'intervals' argument controls which portion of the track is modified. The iterator policy is set internally to the bin size of the track.
The new values are written to a staging copy of the track's data files and swapped in only once the whole modification has succeeded, so an interrupt or an error leaves the track exactly as it was. The staging copy needs as much free space as the part of the track being rewritten, which on a database in indexed format is the track's whole data file.
Examples
gdb.init_examples()
intervs <- gintervals(1, 300, 800)
gextract("dense_track", intervs)
#> chrom start end dense_track intervalID
#> 1 chr1 300 350 0.16 1
#> 2 chr1 350 400 0.16 1
#> 3 chr1 400 450 0.16 1
#> 4 chr1 450 500 0.06 1
#> 5 chr1 500 550 0.06 1
#> 6 chr1 550 600 0.02 1
#> 7 chr1 600 650 0.04 1
#> 8 chr1 650 700 0.00 1
#> 9 chr1 700 750 0.00 1
#> 10 chr1 750 800 0.00 1
gtrack.modify("dense_track", "dense_track * 2", intervs)
gextract("dense_track", intervs)
#> chrom start end dense_track intervalID
#> 1 chr1 300 350 0.32 1
#> 2 chr1 350 400 0.32 1
#> 3 chr1 400 450 0.32 1
#> 4 chr1 450 500 0.12 1
#> 5 chr1 500 550 0.12 1
#> 6 chr1 550 600 0.04 1
#> 7 chr1 600 650 0.08 1
#> 8 chr1 650 700 0.00 1
#> 9 chr1 700 750 0.00 1
#> 10 chr1 750 800 0.00 1
gtrack.modify("dense_track", "dense_track / 2", intervs)