findPeaks: findPeaks

Description Usage Arguments Details Value Author(s) Examples

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:

  • remove duplicates, ie., peaks with the same intensity that occur within window positions of each other. Otherwise, findPeaks will consider noisy peaks without a single highest point to be multiple distinct peaks.

  • drop G2 peaks. In some cases the G2 peak for one sample will have greater intensity than the G1 peak for another sample. We correct for this by removing detected peaks with means close to twice that of other peaks.

  • ignore noise, by removing peaks with intensity < 40. A somewhat arbitrary value. It's tricky to deal with this issue when the debris field is large.

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)


Search within the flowPloidy package
Search all R packages, documentation and source code

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

Please suggest features or report bugs with the GitHub issue tracker.

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