PeakGrouper: Peak grouping with hierarchical clustering

View source: R/PeakGrouper.R

PeakGrouperR Documentation

Peak grouping with hierarchical clustering

Description

This functions groups the peaks obtained after wavelet based peak detection (with the 'getWaveletPeaks' function).

Usage

PeakGrouper(
  Y.peaks,
  grouping.window.width = 100,
  verbose = FALSE,
  min.samp.grp = 1,
  max.dupli.prop = 0.25,
  maxClust = 10,
  Jaccard.regroup.threshold = 0.25,
  linkage = "average"
)

Arguments

Y.peaks

data frame obtained from the 'getWaveletPeaks' function.

grouping.window.width

The width of the sliding window (in measurement points). Measurements are taken for when this sliding window is taken too small, but best set this too a value that a normal peak is comfortably in a window. Note if large shifts occur in your dataset (like in the wine dataset) it is best to set this parameter larger.

verbose

If set to TRUE the window selection process is documented in real time (default = FALSE).

min.samp.grp

The minimal amount of samples needed to form a group, see hclust.grouping.

max.dupli.prop

The maximal duplication proportion allowed for a group to be considered a single group, see hclust.grouping.

maxClust

The maximum number of clusters (depth of the tree), see hclust.grouping.

Jaccard.regroup.threshold

If 2 neighbouring groups have a jaccard index smaller than this 'Jaccard.regroup.threshold' (indicating that they are quite complementary as they have little peaks samples in common), then they are merged and regrouped. This situation can occur if a group is accidentally cut in half by the window approach.

linkage

The linkage to be used in the hierarchical clustering. See the 'method' argument in hclust.

Value

Returns a data frame with grouped peaks. Peaks in a group are indicated with an identical peakIndex

Author(s)

Charlie Beirnaert, charlie.beirnaert@uantwerpen.be

See Also

hclust.grouping

Examples

subset <- GetWinedata.subset()
# to reduce the example time we only select spectra 1 & 2
subset.spectra = as.matrix(subset$Spectra)[1:2,] 
subset.ppm = as.numeric(subset$PPM)

test.peaks <- getWaveletPeaks(Y.spec=subset.spectra, 
                              X.ppm=subset.ppm ,
                              nCPU = 1) # nCPU set to 2 for the vignette build

test.grouped <- PeakGrouper(Y.peaks = test.peaks)


speaq documentation built on May 23, 2022, 5:06 p.m.