intOverWidth: Find the fraction of genomic interval overlapping with...

View source: R/GRanges-utils.R

intOverWidthR Documentation

Find the fraction of genomic interval overlapping with another genomic interval.

Description

Compute the fraction of a query genomic interval that overlaps with another set of genomic intervals. We divide the total width of the intersection with the width of the query.

Usage

intOverWidth(query, subject)

Arguments

query

a GRanges object

subject

a GRanges object

Value

A numeric vector of the same length as the query GRanges

Examples

 library(GenomicRanges)
 autosomes <- function() paste0("chr", 1:22)
 del <- GRanges(c("chr1", "chr2"), IRanges(c(1, 1), c(10, 10)))
 filters <- GRanges(c("chr1", "chr2"), IRanges(c(5, 8), c(20, 10000)))
 test <- intOverWidth(del, filters)
 identical(test, c(0.6, 0.3))


cancer-genomics/trellis documentation built on Aug. 20, 2024, 5:48 p.m.