subtract-methods | R Documentation |
Similar to bedtools subtract.
subtract(x, y, minoverlap=1L, ...)
## S4 method for signature 'GenomicRanges,GenomicRanges'
subtract(x, y, minoverlap=1L, ignore.strand=FALSE)
x , y |
Two GRanges objects, typically, but any GenomicRanges
derivative should be supported.
Note that reduce(y, ignore.strand=ignore.strand) internally. |
minoverlap |
Minimum overlap (in number of genomic positions) between a range in
|
ignore.strand |
If set to TRUE, the strand information is ignored in the computation
and the strand of |
... |
Further arguments to be passed to specific methods. |
subtract()
first replaces its second argument y
with:
reduce(y, ignore.strand=ignore.strand)
Then it searches for genomic ranges in y
that overlap genomic
ranges in x
by at least the number of base pairs specified via
the minoverlap
argument. If an overlapping range is found in
y
, the overlapping portion is removed from any range in x
involved in the overlap.
Note that by default subtract(x, y)
is equivalent to:
psetdiff(x, rep(GRangesList(y), length(x)))
but will typically be hundred times more efficient.
A GRangesList object parallel to x
, that is, with
one list element per range in x
.
The names and metadata columns on x
are propagated to the result.
H. Pagès
bedtools subtract at https://bedtools.readthedocs.io/en/latest/content/tools/subtract.html
setops-methods for set operations on GRanges objects.
findOverlaps-methods for finding/counting overlapping genomic ranges.
intra-range-methods and inter-range-methods for intra range and inter range transformations of a GRanges object.
GRanges and GRangesList objects.
x <- GRanges(c(A="chr1:1-50", B="chr1:40-110", C="chrX:1-500"))
y <- GRanges(c("chr1:21-25", "chr1:38-150"))
z <- subtract(x, y)
z
unlist(z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.