gintervals.coverage_fraction: Calculate fraction of genomic space covered by intervals

View source: R/intervals-utils.R

gintervals.coverage_fractionR Documentation

Calculate fraction of genomic space covered by intervals

Description

Returns the fraction of a genomic space that is covered by a set of intervals.

Usage

gintervals.coverage_fraction(intervals1 = NULL, intervals2 = NULL)

Arguments

intervals1

set of one-dimensional intervals (the covering set)

intervals2

set of one-dimensional intervals to be covered (default: NULL, meaning the entire genome)

Details

This function calculates what fraction of 'intervals2' is covered by 'intervals1'. If 'intervals2' is NULL, it calculates the fraction of the entire genome that is covered by 'intervals1'. Overlapping intervals in either set are automatically unified before calculation.

Value

A single numeric value between 0 and 1 representing the fraction of 'intervals2' (or the genome) covered by 'intervals1'.

See Also

gintervals, gintervals.intersect, gintervals.covered_bp, gintervals.all

Examples



gdb.init_examples()

# Create some intervals
intervs1 <- gscreen("dense_track > 0.15")
intervs2 <- gintervals(c("chr1", "chr2"), 0, c(100000, 100000))

# Calculate fraction of intervs2 covered by intervs1
gintervals.coverage_fraction(intervs1, intervs2)

# Calculate fraction of entire genome covered by intervs1
gintervals.coverage_fraction(intervs1)


misha documentation built on Dec. 14, 2025, 9:06 a.m.