filterPeaksMultiplicity {RMassBank} | R Documentation

## Multiplicity filtering: Removes peaks which occur only once in a n-spectra set.

### Description

For every compound, every peak (with annotated formula) is compared across all spectra. Peaks whose formula occurs only once for all collision energies / spectra types, are discarded. This eliminates "stochastic formula hits" of pure electronic noise peaks efficiently from the spectra. Note that in the author's experimental setup two spectra were recorded at every collision energy, and therefore every peak-formula should appear at least twice if it is real, even if it is by chance a fragment which appears on only one collision energy setting. The function was not tested in a different setup. Therefore, use with a bit of caution.

### Usage

    filterPeaksMultiplicity(peaks, formulacol, recalcBest = TRUE)

### Arguments

`recalcBest` | Whether the best formula for each peak should be re-determined. This is necessary for results from the ordinary `analyzeMsMs` analysis which allows multiple potential formulas per peak - the old best match could potentially have been dropped because of multiplicity filtering. For results from `reanalyzeFailpeak` this is not necessary, since only one potential formula is assigned in this case.
`peaks` | An aggregate peak data.frame containing all peaks to be analyzed; with at least the columns `cpdID, scan, mzFound` and one column for the formula specified with the `formulacol` parameter.
`formulacol` | Which column the assigned formula is stored in. (Needed to separately process `"formula"` and `"reanalyzed.formula"` multiplicites.)

### Value

The peak table is returned, enriched with columns:

- `formulaMultiplicity`The # of occurrences of this formula in the spectra of its compounds.

### Author(s)

Michael Stravs, EAWAG <michael.stravs@eawag.ch>

### Examples

    ## Not run:
    		peaksFiltered <- filterPeaksMultiplicity(peaksMatched(w),
    			"formula", TRUE)
    		peaksOK <- subset(peaksFiltered, formulaMultiplicity > 1)

    ## End(Not run)

[Package RMassBank version 3.0.0 Index]