pcalc {msPurity} | R Documentation

## Perform purity calculation on a peak matrix

### Description

This is the main purity calculation that is performed in purityX, purityD and purityA.

- Takes in a matrix of peaks

- gets isolation window based on mzmin mzmax

- locates the mz target in the peak matrix

- removes isotopic peaks

- removes any peaks below limit (percentage of target peak intensity)

- normalises

- Calculates purity: Divides the target peak intensity by the total peak intensity for the isolation window

### Usage

    pcalc(peaks, mzmin, mzmax, mztarget, ppm = NA, iwNorm = FALSE,
      iwNormFun = NULL, ilim = 0, targetMinMZ = NA, targetMaxMZ = NA,
      isotopes = FALSE, im = NULL)

### Arguments

`peaks` | matrix; Matrix of peaks consisting of 2 columns: mz and i
`mzmin` | numeric; Isolation window (min)
`mzmax` | numeric; Isolation window (max)
`mztarget` | numeric; The mz window to target in the isolation window
`ppm` | numeric; PPM tolerance for the target mz value. If NA will presume targetMinMZ and targetMaxMZ will be used
`iwNorm` | boolean; If TRUE then the intensity of the isolation window will be normalised based on the iwNormFun function
`iwNormFun` | function; A function to normalise the isolation window intensity. The default function is very generalised and just accounts for edge effects
`ilim` | numeric; All peaks less than this percentage of the target peak will be removed from the purity calculation, default is 5% (0.05)
`targetMinMZ` | numeric; Range to look for the mztarget (min)
`targetMaxMZ` | numeric; Range to look for the mztarget (max)
`isotopes` | boolean; TRUE if isotopes are to be removed
`im` | matrix; Isotope matrix, default removes C13 isotopes (single, double and triple bonds)

### Value

a vector of the purity score and the number of peaks in the window e.g c(purity, pknm)

### Examples

    pm <- rbind(c(100, 1000),c(101.003, 10))
    pcalc(pm, mzmin = 98, mzmax = 102, mztarget=100, ppm=5)
    pcalc(pm, mzmin = 98, mzmax = 102, mztarget=100, ppm=5, isotopes = TRUE)

[Package msPurity version 1.10.0 Index]