bestOverlap | R Documentation |
Find the best overlap between ranges
bestOverlap(x, y, ...)
## S4 method for signature 'GRanges,GRanges'
bestOverlap(
x,
y,
var = NULL,
ignore.strand = FALSE,
missing = NA_character_,
min_prop = 0.01,
...
)
## S4 method for signature 'GRanges,GRangesList'
bestOverlap(
x,
y,
ignore.strand = FALSE,
missing = NA_character_,
min_prop = 0.01,
...
)
x |
a GRanges object |
y |
a named GRangesList or GRanges object with mcol as reference category |
... |
Not used |
var |
The variable to use as the category. Not required if |
ignore.strand |
logical(1) Passed to findOverlaps |
missing |
Value to assign to ranges with no overlap |
min_prop |
Threshold below which overlaps are discarded |
This finds the category in the subject GRanges (y) which has the best overlap with the query GRanges (x). The aim is to produce a character vector for best classifying the query GRanges using an external set of features (e.g. promoters, enhancers etc). If the subject (y) is a GRanges object, the values in the specified column will be used as the category. If the subject (y) is a GRangesList, the names of the list will be used to provide the best match
Character vector the same length as the supplied GRanges object
gr <- GRanges("chr1:1-10")
gr_cat <- GRanges(c("chr1:2-10", "chr1:5-10"))
gr_cat$category <- c("a", "b")
propOverlap(gr, gr_cat)
bestOverlap(gr, gr_cat, var = "category")
grl <- splitAsList(gr_cat, gr_cat$category)
lapply(grl, function(x) propOverlap(gr, x))
bestOverlap(gr, grl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.