MSnExp-class: The 'MSnExp' Class for MS Data And Meta-Data

MSnExp-classR Documentation

The 'MSnExp' Class for MS Data And Meta-Data

Description

The MSnExp class encapsulates data and meta-data for mass spectrometry experiments, as described in the slots section. Several data files (currently in mzXML) can be loaded together with the function readMSData.

This class extends the virtual "pSet" class.

In version 1.19.12, the polarity slot had been added to the "Spectrum" class (previously in "Spectrum1"). Hence, "MSnExp" objects created prior to this change will not be valid anymore, since all MS2 spectra will be missing the polarity slot. Object can be appropriately updated using the updateObject method.

The feature variables in the feature data slot will depend on the file. See also the documentation in the mzR package that parses the raw data files and produces these data.

Objects from the Class

Objects can be created by calls of the form new("MSnExp",...). However, it is preferred to use the readMSData function that will read raw mass spectrometry data to generate a valid "MSnExp" instance.

Slots

assayData:

Object of class "environment" containing the MS spectra (see "Spectrum1" and "Spectrum2"). Slot is inherited from "pSet".

phenoData:

Object of class "AnnotatedDataFrame" containing experimenter-supplied variables describing sample (i.e the individual tags for an labelled MS experiment) See phenoData for more details. Slot is inherited from "pSet".

featureData:

Object of class "AnnotatedDataFrame" containing variables describing features (spectra in our case), e.g. identificaiton data, peptide sequence, identification score,... (inherited from "eSet"). See featureData for more details. Slot is inherited from "pSet".

experimentData:

Object of class "MIAPE", containing details of experimental methods. See experimentData for more details. Slot is inherited from "pSet".

protocolData:

Object of class "AnnotatedDataFrame" containing equipment-generated variables (inherited from "eSet"). See protocolData for more details. Slot is inherited from "pSet".

processingData:

Object of class "MSnProcess" that records all processing. Slot is inherited from "pSet".

.__classVersion__:

Object of class "Versions" describing the versions of R, the Biobase package, "pSet" and MSnExp of the current instance. Slot is inherited from "pSet". Intended for developer use and debugging (inherited from "eSet").

Extends

Class "pSet", directly. Class "VersionedBiobase", by class "pSet", distance 2. Class "Versioned", by class "pSet", distance 3.

Methods

See the "pSet" class for documentation on accessors inherited from pSet, subsetting and general attribute accession.

bin

signature(object = "MSnExp"): Bins spectra. See bin documentation for more details and examples.

clean

signature(object = "MSnExp"): Removes unused 0 intensity data points. See clean documentation for more details and examples.

compareSpectra

signature(x = "Spectrum", y = "missing"): Compares spectra. See compareSpectra documentation for more details and examples.

extractPrecSpectra

signature(object = "MSnExp", prec = "numeric"): extracts spectra with precursor MZ value equal to prec and returns an object of class 'MSnExp'. See extractPrecSpectra documentation for more details and examples.

pickPeaks

signature(object = "MSnExp"): Performs the peak picking to generate centroided spectra. Parameter msLevel. allows to restrict peak picking to spectra of certain MS level(s). See pickPeaks documentation for more details and examples.

estimateNoise

signature(object = "MSnExp"): Estimates the noise in all profile spectra of object. See estimateNoise documentation for more details and examples.

plot

signature(x = "MSnExp", y = "missing"): Plots the MSnExp instance. See plot.MSnExp documentation for more details.

plot2d

signature(object = "MSnExp", ...): Plots retention time against precursor MZ for MSnExp instances. See plot2d documentation for more details.

plotDensity

signature(object = "MSnExp", ...): Plots the density of parameters of interest. instances. See plotDensity documentation for more details.

plotMzDelta

signature(object = "MSnExp", ...): Plots a histogram of the m/z difference betwee all of the highest peaks of all MS2 spectra of an experiment. See plotMzDelta documentation for more details.

quantify

signature(object = "MSnExp"): Performs quantification for all the MS2 spectra of the MSnExp instance. See quantify documentation for more details. Also for OnDiskMSnExp objects.

removePeaks

signature(object = "MSnExp"): Removes peaks lower that a threshold t. See removePeaks documentation for more details and examples.

removeReporters

signature(object = "MSnExp", ...): Removes reporter ion peaks from all MS2 spectra of an experiment. See removeReporters documentation for more details and examples.

smooth

signature(x = "MSnExp"): Smooths spectra. See smooth documentation for more details and examples.

addIdentificationData

signature(object = "MSnExp", ...): Adds identification data to an experiment. See addIdentificationData documentation for more details and examples.

removeNoId

signature(object = "MSnExp", fcol = "pepseq", keep = NULL): Removes non-identified features. See removeNoId documentation for more details and examples.

removeMultipleAssignment

signature(object = "MSnExp", fcol = "nprot"): Removes protein groups (or feature belong to protein groups) with more than one member. The latter is defined by extracting a feature variable (default is "nprot"). Also removes non-identified features.

idSummary

signature(object = "MSnExp", ...): Prints a summary that lists the percentage of identified features per file (called coverage).

show

signature(object = "MSnExp"): Displays object content as text.

isolationWindow

signature(object = "MSnExp", ...): Returns the isolation window offsets for the MS2 spectra. See isolationWindow in the mzR package for details.

trimMz

signature(object = "MSnExp"): Trims the MZ range of all the spectra of the MSnExp instance. See trimMz documentation for more details and examples.

isCentroided(object, k = 0.025, qtl = 0.9, verbose = TRUE)

A heuristic assessing if the spectra in the object are in profile or centroided mode. The function takes the qtlth quantile top peaks, then calculates the difference between adjacent M/Z value and returns TRUE if the first quartile is greater than k. (See MSnbase:::.isCentroided for the code.) If verbose (default), a table indicating mode for all MS levels is printed.

The function has been tuned to work for MS1 and MS2 spectra and data centroided using different peak picking algorithms, but false positives can occur. See https://github.com/lgatto/MSnbase/issues/131 for details. For whole experiments, where all MS1 and MS2 spectra are expected to be in the same, albeit possibly different modes, it is advised to assign the majority result for MS1 and MS2 spectra, rather than results for individual spectra. See an example below.

as

signature(object = "MSnExp", "data.frame"): Coerces the MSnExp object to a four-column data.frame with columns "file" (file index in object), "rt" (retention time), "mz" (m/z values) and "i" (intensity values).

as

signature(object = "MSnExp", "MSpectra"): Coerces the MSnExp object to a MSpectra object with all feature annotations added as metadata columns (mcols).

Clarifications regarding scan/acquisition numbers and indices:

A spectrumId (or spectrumID) is a vendor specific field in the mzML file that contains some information about the run/spectrum, e.g.: controllerType=0 controllerNumber=1 scan=5281 file=2.

acquisitionNum is a more a less sanitize spectrum id generated from the spectrumId field by mzR (see https://github.com/sneumann/mzR/blob/master/src/pwiz/data/msdata/MSData.cpp#L552-L580).

scanIndex is the mzR generated sequence number of the spectrum in the raw file (which doesn't have to be the same as the acquisitionNum).

See also this issue: https://github.com/lgatto/MSnbase/issues/525.

Filtering and subsetting functions:

filterRt

signature(object = "MSnExp", rt = "numeric", msLevel. = "numeric"): Retains MS spectra of level msLevel. with a retention times within rt[1] and rt[2].

filterMsLevel

signature(object = "MSnExp", msLevel. = "numeric"): Retains MS spectra of level msLevel..

filterPolarity

signature(object = "MSnExp", polarity. = "numeric"): Retains MS spectra of polarity polarity..

filterMz

signature(object = "MSnExp", mz = "numeric", msLevel. = "numeric"). See filterMz for details.

filterFile

signature(object = "MSnExp", file): Retains MS data of files matching the file index or file name provided with parameter file.

filterAcquisitionNum
filterEmptySpectra

signature(object = "MSnExp"): Remove empty spectra from object (see isEmpty).

filterPrecursorScan

signature(object = "MSnExp", acquisitionNum = "numeric"): Retain parent (e.g. MS1) and children scans (e.g. MS2) of acquisitionNum. See OnDiskMSnExp for an example.

splitByFile

signature(object = "MSnExp", f = "factor"): split a MSnExp object by file into a list of MSnExp objects given the grouping in factor f.

filterPrecursorMz

signature(object = "MSnExp", mz, ppm = 10): retain spectra with a precursor m/z equal or similar to the one defined with parameter mz. Parameter ppm allows to define an accepted difference between the provided m/z and the spectrum's m/z.

filterIsolationWindow

signature(object = "MSnExp", mz): retain spectra with isolation windows that contain (which m/z range contain) the specified m/z.

Author(s)

Laurent Gatto <lg390@cam.ac.uk>

References

Information about the mzXML format as well converters from vendor specific formats to mzXML: http://tools.proteomecenter.org/wiki/index.php?title=Formats:mzXML.

See Also

"pSet" and readMSData for loading mzXML, mzData or mzML files to generate an instance of MSnExp.

The "OnDiskMSnExp" manual page contains further details and examples.

chromatogram to extract chromatographic data from a MSnExp or OnDiskMSnExp object.

write for the function to write the data to mzML or mzXML file(s).

Examples

mzxmlfile <- dir(system.file("extdata",package="MSnbase"),
                 pattern="mzXML",full.names=TRUE)
msnexp <- readMSData(mzxmlfile)
msnexp

lgatto/MSnbase documentation built on March 14, 2024, 7:06 a.m.