Description Usage Arguments Details Value References Examples
Given a single peak and a set of features, this function returns the features that are closest to this peak. Features overlapping the peak are considered to have a distance of 0. Multiple features will be returned if they all have the same minimal distance from the given peak. Nothing is returned if no features are on the same chromosome as the peak. Note that this is a helper function intended for use by the mapPeaks function; the user should NOT call this function themselves.
1 | getFeaturesForPeak(currentPeak, featureFrame, verbose = F)
|
currentPeak |
A single peak, given as a vector of 6 fields: chromosome, start position, end position, name, score, and strand (i.e. a single row from a dataframe returned by importBED) |
featureFrame |
A dataframe returned by the importBED function, where each row is a different feature to be used for peak annotation. |
verbose |
If True, getFeaturesForPeak will print to the console the peak that it is currently processing, and will also print peaks that do not map onto any features (e.g. due to differing chromosomes) |
Code to rename column names is based off of a StackOverflow post by Joshua Ulrich (see References). Code to repeat rows of a dataframe using do.call is based on a StackOverflow post by mdsummer (see References).
A dataframe containing the feature(s) closest to currentPeak. Each row contains a different feature of minimal distance, preceded by currentPeak. Peaks and features are represented by the 6 fields of: chromosome, start position, end position, name, score, and strand. Each row additionally contains the distance and position of currentPeak relative to each closest feature, where position is some combination of upstream, downstream, and overlapping.
Joshua Ulrich. "How to rename a single column in a data.frame?". 23 September 2011. Accessed 25 September 2019. https://stackoverflow.com/a/7532464
mdsummer. "Repeat rows of a data.frame N times". 6 January 2012. Accessed 25 September 2019. https://stackoverflow.com/a/8753732
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
pathToPeaks <- system.file("extdata",
"H3K27me3Peaks.bed", package = "PeakMapper")
pathToGenes <- system.file("extdata",
"WS263Genes.bed", package = "PeakMapper")
H3K27me3Peaks <- importBED(pathToPeaks)
WS263Genes <- importBED(pathToGenes)
singlePeak <- as.character(H3K27me3Peaks[1, ])
closestGenes <- getFeaturesForPeak(singlePeak, WS263Genes)
closestGenes$Peak_Position
closestGenes$Peak_Distance
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.