overlapWidths: Count overlapping bases between two 'GRanges' objects

Description Usage Arguments Examples

Description

overlapWidths returns a vector containing the number of bases each range in a GRanges object overlap with a another GRanges object (e.g. one of annotation exons). For example, if x is a GRanges object containing ANGSD windows, and anno is a GRanges object containing all exon ranges, overlapWidths(x, anno) will return a vector that can be used as elementMetadata in x to indicate how many bases in each range overlap anno. Note that overlapWidths ignores strand.

Usage

1
overlapWidths(x, anno, type = c("any", "start", "end", "within", "equal"))

Arguments

anno

a GenomicRanges object contaning annotation ranges.

angsd

a GenomicRanges object containing windows and summary statistics from ANGSD.

type

the type of overlap to do; this passed directly to findOverlaps.

Examples

1
2
3
4
5
6
7
test_file <- system.file("inst", "extdata", "test.pestPG", package="angsdr")
d <- readPestPG(test_file)
anno <- GRanges("chr1", IRanges(c(70000, 120300), c(70300, 120800)))
# create overlaps annotation
overlapWidths(d, anno)
# store in d
d$anno_overlap <- overlapWidths(d, anno)

vsbuffalo/angsdr documentation built on May 3, 2019, 7:07 p.m.