findPeaks: findPeaks

Description

Locate potential peaks in histogram data

Usage

1
2
3

Arguments

fh

a FlowHist object

window

an integer, the width of the moving window to use in identifying local maxima via caTools::runmax

smooth

an integer, the width of the moving window to use in removing noise via caTools::runmean

Details

Peaks are defined as local maxima in the vector of values, using a moving window. Note that these are used in the context of finding starting values - accuracy isn't important, we just need something ‘close-enough’ that the nls algorithm will be able to find the correct value.

Utility functions for use internally by flowPloidy; not exported and won't be visible to users. Usually invoked from within FlowHist.

Note that there is a trade-off between accuracy in detected peaks, and avoiding noise. Increasing the value of smooth will reduce the amount of 'noise' that is included in the peak list. However, increasing smoothing shifts the location of the actual peaks. Most of the time the default values provide an acceptable compromise, given we only need to get 'close enough' for the NLS optimization to find the true parameter values. If you'd like to explore this, the internal (unexported) function fhPeakPlot may be useful.

cleanPeaks filters the output of findPeaks to:

Value

Returns a matrix with two columns:

mean

the index position of each potential peak

height

the height (intensity) of the peak at that index position

Author(s)

Tyler Smith

Examples

1
2
3
4
5
6
7
8
## Not run: 
set.seed(123)
test.dat <-(cumsum(runif(1000, min = -1)))
plot(test.dat, type = 'l')
test.peaks <- flowPloidy::findPeaks(test.dat, window = 20)
points(test.peaks, col = 'red', cex = 2)

## End(Not run)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.