Learn R Programming

derfinder (version 1.0.10)

findRegions: Find non-zero regions in a Rle

Description

Find genomic regions for which a numeric vector is above (or below) predefined thresholds. In other words, this function finds the candidate Differentially Expressed Regions (candidate DERs). This is similar to regionFinder and is a helper function for calculatePvalues.

Usage

findRegions(position = NULL, fstats, chr, oneTable = TRUE, maxClusterGap = 300L, cutoff = quantile(fstats, 0.99), segmentIR = NULL, ...)

Arguments

position
A logical Rle of genomic positions. This is generated in loadCoverage. Note that it gets updated in preprocessCoverage if colsubset is not NULL.
fstats
A numeric Rle with the F-statistics. Usually obtained using calculateStats.
chr
A single element character vector specifying the chromosome name.
oneTable
If TRUE only one GRanges is returned. Otherwise, a GRangesList with two components is returned: one for the regions with positive values and one for the negative values.
maxClusterGap
This determines the maximum gap between candidate DERs. It should be greater than maxRegionGap (0 by default).
cutoff
Threshold applied to the fstats used to determine the #' regions.
segmentIR
An IRanges object with the genomic positions that are potentials DERs. This is used in calculatePvalues to speed up permutation calculations.
...
Arguments passed to other methods and/or advanced arguments.

Value

Either a GRanges or a GRangesList as determined by oneTable. Each of them has the following metadata variables.
value
The mean of the values of y for the given region.
area
The absolute value of the sum of the values of y for the given region.
indexStart
The start position of the region in terms of the index for y.
indexEnd
The end position of the region in terms of the index for y.
cluster
The cluser ID.
clusterL
The total length of the cluster.

Details

regionFinder adapted to Rle world.

References

Rafael A. Irizarry, Martin Aryee, Hector Corrada Bravo, Kasper D. Hansen and Harris A. Jaffee. bumphunter: Bump Hunter. R package version 1.1.10.

See Also

calculatePvalues

Examples

Run this code
## Preprocess the data
prep <- preprocessCoverage(genomeData, cutoff=0, scalefac=32, chunksize=1e3,
    colsubset=NULL)

## Get the F statistics
fstats <- genomeFstats

## Find the regions
regs <- findRegions(prep$position, fstats, 'chr21', verbose=TRUE)
regs

## Not run: 
# ## Once you have the regions you can proceed to annotate them
# annotation <- bumphunter::annotateNearest(regs, 'hg19')
# annotation
# ## End(Not run)

Run the code above in your browser using DataLab