GRangesList
objectsra.merge.Rd
Determines overlaps between two or more piles of rearrangement junctions (as named or numbered arguments) +/- padding and will merge those that overlap into single junctions in the output, and then keep track for each output junction which of the input junctions it was "seen in" using logical flag meta data fields prefixed by "seen.by." and then the argument name (or "seen.by.ra" and the argument number)
ra.merge(..., pad = 0, ignore.strand = FALSE)
GRangesList representing rearrangements to be merged
non-negative integer specifying padding
whether to ignore strand (implies all strand information will be ignored, use at your own risk)
logical flag (default FALSE) specifying whether the "seen.by" fields should contain indices of inputs (rather than logical flags) and NA if the given junction is missing
GRangesList
of merged junctions with meta data fields specifying which of the inputs each outputted junction was "seen.by"
# generate some junctions
gr1 <- GRanges(1, IRanges(1:10, width = 1), strand = rep(c('+', '-'), 5))
gr2 <- GRanges(1, IRanges(4 + 1:10, width = 1), strand = rep(c('+', '-'), 5))
ra1 = split(gr1, rep(1:5, each = 2))
ra2 = split(gr2, rep(1:5, each = 2))
ram = ra.merge(ra1, ra2)
values(ram) # shows the metadata with TRUE / FALSE flags
#> DataFrame with 7 rows and 6 columns
#> tmp.ix merged.ix ra1 ra2 seen.by.ra1 seen.by.ra2
#> <integer> <integer> <character> <character> <logical> <logical>
#> 1 NA 1 1 NA TRUE FALSE
#> 2 NA 2 2 NA TRUE FALSE
#> 3 1 3 3 1 TRUE TRUE
#> 4 2 4 4 2 TRUE TRUE
#> 5 3 5 5 3 TRUE TRUE
#> 6 4 6 NA 4 FALSE TRUE
#> 7 5 7 NA 5 FALSE TRUE
ram2 = ra.merge(ra1, ra2, pad = 5) # more inexact matching results in more merging
#> Warning: GRanges object contains 12 out-of-bound ranges located on sequence 1.
#> Note that ranges located on a sequence whose length is unknown (NA) or
#> on a circular sequence are not considered out-of-bound (use
#> seqlengths() and isCircular() to get the lengths and circularity flags
#> of the underlying sequences). You can use trim() to trim these ranges.
#> See ?`trim,GenomicRanges-method` for more information.
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
values(ram2)
#> DataFrame with 1 row and 6 columns
#> tmp.ix merged.ix ra1 ra2 seen.by.ra1 seen.by.ra2
#> <integer> <integer> <character> <character> <logical> <logical>
#> 1 NA 1 1,2,3,4,5 1,2,3,4,5 TRUE TRUE
ram3 = ra.merge(ra1, ra2) #indices instead of flags
values(ram3)
#> DataFrame with 7 rows and 6 columns
#> tmp.ix merged.ix ra1 ra2 seen.by.ra1 seen.by.ra2
#> <integer> <integer> <character> <character> <logical> <logical>
#> 1 NA 1 1 NA TRUE FALSE
#> 2 NA 2 2 NA TRUE FALSE
#> 3 1 3 3 1 TRUE TRUE
#> 4 2 4 4 2 TRUE TRUE
#> 5 3 5 5 3 TRUE TRUE
#> 6 4 6 NA 4 FALSE TRUE
#> 7 5 7 NA 5 FALSE TRUE