mergeMS: mergeMS

Description Usage Arguments Details Value

View source: R/Functions_Spectra.R

Description

Merge MS spectra, best used with noise-free spectra. Will merge all peaks that are EITHER within ppm OR within mzdiff range (mzdiff typically used to allow larger ppm difference in low mz range)

Usage

1
2
3
mergeMS(speclist, ppm = 5, mzdiff = 5e-04, count = FALSE,
  iterative = T, removeZeros = T, noiselevel = 0, maxpeaks = NULL,
  toleranceFactor = 1)

Arguments

speclist

list of spectra (matrices, all with two columns: mz and intensity)

ppm

min difference between peaks in ppm

mzdiff

min difference between peaks in m/z

count

if TRUE, will count how many peaks were combined into a peak, and add a count column in the resulting spectrum

iterative

if TRUE, will iteratively merge two adjacent peaks within tolerance, and then check if there are peaks within tolerance of merged peak

removeZeros

remove all entries with 0 intensity

noiselevel

all peaks below this intensity (relative to highest peak in merged spectrum at relative intensity 1) will be removed

maxpeaks

if not NULL, maximum number of peaks in merged spectrum. Lowest intensity peaks will be removed from merged spectrum.

toleranceFactor

should be a numeric vector of increasing values to recursively apply as a factor to the ppm and mzdiff tolerances.

Details

Replacement for mergeMS(..., mergeOnly = T)

Value

if speclist is a Spectra object or a list of Spectrum objects: returns a Spectrum object. if speclist is a matrix object or a list of matrix objects: returns a Spectrum object.


mjhelf/MassTools documentation built on Nov. 19, 2021, 2:38 a.m.