getOverlapPercent: Return fraction of feature overlapped by peak

Description Usage Arguments Value Examples

View source: R/peakMapping.R

Description

Given a mapping between a peak and a feature as determined by the mapPeaks function, returns the proportion of the feature that is overlapped by the peak (i.e. the fraction of bases within the feature that are also within the peak). Output is 0 if peak does not overlap feature. Note that this is a helper function intended for use by the mapPeaks function; the user should NOT call this function themselves.

Usage

1
getOverlapPercent(resultRow)

Arguments

resultRow

A mapping between a peak and a feature, as returned by mapPeaks (except for the final column giving overlap proportions, which are calculated here). The first 6 values give peak information (chromosome, start, end name, score, and strand), the next 6 values give feature information, and the final 2 values are peak position and distance relative to feature.

Value

The proportion of the given feature that is overlapped by the given peak. 0 if the feature does not overlap the peak.

Examples

1
2
3
4
5
6
7
## Not run: 
  peakAndFeature <- c("chr2", 1250, 5000, "Peak_5", 0, ".", "chr2", 1000, 2000,
  "Gene_1", 0, "-", "Overlap (upstream)", 0)
  overlapPercent <- getOverlapPercent(peakAndFeature)
  floor(overlapPercent) == 75

## End(Not run)

fuscada2/PeakMapper documentation built on Dec. 8, 2019, 12:35 p.m.