The "Spectrum" Class
Spectrum-class.RdVirtual container for spectrum data common to all different types of
spectra. A Spectrum object can not be directly instanciated. Use
"Spectrum1" and "Spectrum2"
instead.
In version 1.19.12, the polarity slot has been added to this
class (previously in "Spectrum1").
Slots
msLevel:Object of class
"integer"indicating the MS level: 1 for MS1 levelSpectrum1objects and 2 for MSMSMSpectrum2objects. Levels > 2 have not been tested and will be handled as MS2 spectra.polarity:Object of class
"integer"indicating the polarity if the ion.peaksCount:Object of class
"integer"indicating the number of MZ peaks.rt:Object of class
"numeric"indicating the retention time (in seconds) for the current ions.tic:Object of class
"numeric"indicating the total ion current, as reported in the original raw data file.acquisitionNum:Object of class
"integer"corresponding to the acquisition number of the current spectrum.scanIndex:Object of class
"integer"indicating the scan index of the current spectrum.mz:Object of class
"numeric"of length equal to the peaks count (seepeaksCountslot) indicating the MZ values that have been measured for the current ion.intensity:Object of class
"numeric"of same length asmzindicating the intensity at which eachmzdatum has been measured.centroided:Object of class
"logical"indicating if instance is centroided ('TRUE') of uncentroided ('FALSE'). Default isNA.smoothed:Object of class
"logical"indicating if instance is smoothed ('TRUE') of unsmoothed ('FALSE'). Default isNA.fromFile:Object of class
"integer"referencing the file the spectrum originates. The file names are stored in theprocessingDataslot of the"MSnExp"or"MSnSet"instance that contains the current"Spectrum"instance..__classVersion__:Object of class
"Versions"indicating the version of theSpectrumclass. Intended for developer use and debugging.
Extends
Class "Versioned", directly.
Methods
acquisitionNum(object)Returns the acquisition number of the spectrum as an integer.
scanIndex(object)Returns the scan index of the spectrum as an integer.
centroided(object)Indicates whether spectrum is centroided (
TRUE), in profile mode (FALSE), or unkown (NA).isCentroided(object, k=0.025, qtl=0.9)A heuristic assessing if a spectrum is in profile or centroided mode. The function takes the
qtlth quantile top peaks, then calculates the difference between adjacent M/Z value and returnsTRUEif the first quartile is greater thank. (SeeMSnbase:::.isCentroidedfor the code.) 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. It should however be safe to use is at the experiment level, assuming that all MS level have the same mode. Seeclass?MSnExpfor an example.smoothed(object)Indicates whether spectrum is smoothed (
TRUE) or not (FALSE).centroided(object) <- valueSets the
centroidedstatus of the spectrum object.smoothed(object) <- valueSets the
smoothedstatus of the spectrum object.fromFile(object)Returns the index of the raw data file from which the current instances originates as an integer.
intensity(object)Returns an object of class
numericcontaining the intensities of the spectrum.msLevel(object)Returns an MS level of the spectrum as an integer.
mz(object, ...)Returns an object of class
numericcontaining the MZ value of the spectrum peaks. Additional arguments are currently ignored.peaksCount(object)Returns the number of peaks (possibly of 0 intensity) as an integer.
rtime(object, ...)Returns the retention time for the spectrum as an integer. Additional arguments are currently ignored.
ionCount(object)Returns the total ion count for the spectrum as a numeric.
tic(object, ...)Returns the total ion current for the spectrum as a numeric. Additional arguments are currently ignored. This is the total ion current as originally reported in the raw data file. To get the current total ion count, use
ionCount.
%% -------------------------------------------------- %%
- bin
signature(object = "Spectrum"): Bins Spectrum. Seebindocumentation for more details and examples.- clean
signature(object = "Spectrum"): Removes unused 0 intensity data points. Seecleandocumentation for more details and examples.- compareSpectra
signature(x = "Spectrum", y = "Spectrum"): Compares spectra. SeecompareSpectradocumentation for more details and examples.- estimateNoise
signature(object = "Spectrum"): Estimates the noise in a profile spectrum. SeeestimateNoisedocumentation for more details and examples.- pickPeaks
signature(object = "Spectrum"): Performs the peak picking to generate a centroided spectrum. SeepickPeaksdocumentation for more details and examples.- plot
signature(x = "Spectrum", y = "missing"): Plots intensity against mz. Seeplot.Spectrumdocumentation for more details.- plot
signature(x = "Spectrum", y = "Spectrum"): Plots two spectra above/below each other. Seeplot.Spectrum.Spectrumdocumentation for more details.- plot
signature(x = "Spectrum", y = "character"): Plots an MS2 level spectrum and its highlight the fragmention peaks. Seeplot.Spectrum.characterdocumentation for more details.- quantify
signature(object = "Spectrum"): Quatifies defined peaks in the spectrum. Seequantifydocumentation for more details.- removePeaks
signature(object = "Spectrum"): Remove peaks lower that a thresholdt. SeeremovePeaksdocumentation for more details and examples.- smooth
signature(x = "Spectrum"): Smooths spectrum. Seesmoothdocumentation for more details and examples.- show
signature(object = "Spectrum"): Displays object content as text.- trimMz
signature(object = "Spectrum"): Trims the MZ range of all the spectra of theMSnExpinstance. SeetrimMzdocumentation for more details and examples.- isEmpty
signature(x = "Spectrum"): Checks if thexis an emptySpectrum.
%% -------------------------------------------------- %%
- as
signature(object = "Spectrum", "data.frame"): Coerces theSpectrumobject to a two-columndata.framecontaining intensities and MZ values.