findPeaks: findPeaks

Description Usage Arguments Details Value Author(s) Examples

View source: R/FlowHist.R

Description

Locate potential peaks in histogram data

Usage

1
2
3
findPeaks(fh, window = 20, smooth = 20)

cleanPeaks(fh, window = 20, debrisLimit = 40)

Arguments

fh

a FlowHist object

window

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

smooth

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

debrisLimit

an integer value. Peaks with fluorescence values less than debrisLimit will be ignored by the automatic peak-finding algorithm.

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)

flowPloidy documentation built on Nov. 8, 2020, 8:04 p.m.