View source: R/intervals-utils.R
| gintervals.covered_bp | R Documentation |
Returns the total number of base pairs covered by a set of intervals.
gintervals.covered_bp(intervals = NULL)
intervals |
set of one-dimensional intervals |
This function first canonicalizes the intervals to remove overlaps and touching intervals, then sums up the lengths of all resulting intervals. Overlapping intervals are counted only once.
A single numeric value representing the total number of base pairs covered by the intervals.
gintervals, gintervals.canonic,
gintervals.coverage_fraction
gdb.init_examples()
# Create some intervals
intervs <- gintervals(
c("chr1", "chr1", "chr2"),
c(100, 150, 1000),
c(200, 250, 2000)
)
# Calculate total bp covered
# Note: intervals [100,200) and [150,250) overlap,
# so total is (200-100) + (250-150) + (2000-1000) = 100 + 100 + 1000 = 1200
# But after canonicalization: [100,250) + [1000,2000) = 150 + 1000 = 1150
gintervals.covered_bp(intervs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.