filterFragSpectra-purityA-method: Filter fragmentation spectra associated with an XCMS feature

filterFragSpectra,purityA-methodR Documentation

Filter fragmentation spectra associated with an XCMS feature

Description

General

Flag and filter features based on signal-to-noise ratio, relative abundance, intensity threshold and purity of the precursor ion.

Example LC-MS/MS processing workflow

  • Purity assessments

    • (mzML files) -> purityA -> (pa)

  • XCMS processing

    • (mzML files) -> xcms.findChromPeaks -> (optionally) xcms.adjustRtime -> xcms.groupChromPeaks -> (xcmsObj)

    • Older versions of XCMS — (mzML files) -> xcms.xcmsSet -> xcms.group -> xcms.retcor -> xcms.group -> (xcmsObj)

  • Fragmentation processing

    • (xcmsObj, pa) -> frag4feature -> filterFragSpectra -> averageAllFragSpectra -> createDatabase -> spectralMatching -> (sqlite spectral database)

Usage

## S4 method for signature 'purityA'
filterFragSpectra(
  pa,
  ilim = 0,
  plim = 0.8,
  ra = 0,
  snr = 3,
  rmp = FALSE,
  snmeth = "median",
  allfrag = FALSE
)

Arguments

pa

object; purityA object

ilim

numeric; min intensity of a peak

plim

numeric; min precursor ion purity of the associated precursor for fragmentation spectra scan

ra

numeric; minimum relative abundance of a peak

snr

numeric; minimum signal-to-noise of a peak within each file

rmp

boolean; TRUE if peaks are to be removed that do not meet the threshold criteria. Otherwise they will just be flagged.

snmeth

character; Method to calculate signal to noise ration (either median or mean)

allfrag

boolean; Whether to filter on all fragmentation spectra or just the fragmentation spectra grouped to XCMS feature

Value

Returns a purityA object with the pa@grped_msms spectra matrices are updated with the following columns

  • snr: Signal to noise ratio (calculated at scan level)

  • ra: Relative abundance (calculated at scan level)

  • purity_pass_flag: Precursor ion purity flag (1 pass, 0 fail)

  • intensity_pass_flag: Intensity flag (1 pass, 0 fail)

  • snr_pass_flag: Signal-to-noise pass flag (1 pass, 0 fail)

  • ra_pass_flag: Relative abundance pass flag (1 pass, 0 fail)

  • pass_flag: Overall pass flag, all flags must pass for this to pass (1 pass, 0 fail)

Examples

#====== XCMS =================================
## Read in MS data
#msmsPths <- list.files(system.file("extdata", "lcms", "mzML",
#           package="msPurityData"), full.names = TRUE, pattern = "MSMS")
#ms_data = readMSData(msmsPths, mode = 'onDisk', msLevel. = 1)

## Find peaks in each file
#cwp <- CentWaveParam(snthresh = 5, noise = 100, ppm = 10, peakwidth = c(3, 30))
#xcmsObj  <- xcms::findChromPeaks(ms_data, param = cwp)

## Optionally adjust retention time
#xcmsObj  <- adjustRtime(xcmsObj , param = ObiwarpParam(binSize = 0.6))

## Group features across samples
#pdp <- PeakDensityParam(sampleGroups = c(1, 1), minFraction = 0, bw = 30)
#xcmsObj <- groupChromPeaks(xcmsObj , param = pdp)

#====== msPurity ============================
#pa  <- purityA(msmsPths)
#pa <- frag4feature(pa, xcmsObj)
#pa <- filterFragSpectra(pa)

## Run from previously generated data
pa <- readRDS(system.file("extdata", "tests", "purityA",
                          "2_frag4feature_pa.rds", package="msPurity"))
pa <- filterFragSpectra(pa)


computational-metabolomics/msPurity documentation built on Sept. 8, 2023, 8:04 p.m.