getMS2Mat: Extract a scan x mass matrix from xcmsRaw object(s).

Description Usage Arguments Details Value Author(s) Examples

View source: R/functions.r

Description

For the defined scans, this function identifies consensus masses based on a minimal signal intensity cut-off. Then a data.frame is returned with EICs in columns for each identified mass.

Usage

1
getMS2Mat(xraw, region = NULL, precursors = NULL, rtrange = NULL, collisionEnergy = NULL, ppm = 30, minSignal = 100)

Arguments

xraw

xcmsRaw object or list of xcmsRaw objects

region

rows from a peak table where the feature of interest was detected (optional)

precursors

the precursors that the mass spec targeted

rtrange

range of scans to use

collisionEnergy

the collision energy of the scans to use

ppm

ppm error mass variability between scans

minSignal

smallest intensity that could initiate a mass to include as column

Details

if precursors, rtrange, or collsionEnergy are left out or NULL, all values present in xraw are used

Value

ms2_mat

a data.frame containing a row for each scan, with: xcmsRaw: index of xcmsRaw file scan: scan number rt: retention time of scan ce: collision energy of scan prec: precursor that was targeted and a column for every mass.

Author(s)

Igor Nikolskiy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (xraw, region = NULL, precursors = NULL, rtrange = NULL,
    collisionEnergy = NULL, ppm = 30, minSignal = 100)
{
    if (!is.null(region)) {
        rtrange = c(min(region$rtmin) - 5, max(region$rtmax) +
            5)
    }
    if (class(xraw) == "xcmsRaw") {
        xraw = c(xraw)
    }
    scans = lapply(xraw, selectScans, precursors = precursors,
        rtrange = rtrange, collisionEnergy = collisionEnergy)
    combinedScans = combineScans(xraw, scans, minSignal)
    if (nrow(combinedScans) > 2) {
        cons_masses = getConsensusMasses(combinedScans, ppm = ppm)
        ms2_mat = createMatrix(xraw, scans, cons_masses, ppm = ppm)
        return(ms2_mat)
    }
    else {
        cat("ms2 has no masses with intensity above: ", minSignal,
            "\n")
    }
  }

yufree/decoMS2 documentation built on May 27, 2019, 9:56 a.m.