Constructor and methods to handle mass spectrometry spectra results
Source:R/class_MassSpecResults_Spectra.R
MassSpecResults_Spectra.Rd
The MassSpecResults_Spectra
class is a child of Results and is used to store mass spectrometry spectra results.
Usage
MassSpecResults_Spectra(
spectra = list(),
replicates = character(),
is_averaged = FALSE,
is_neutralized = FALSE,
peaks = list(),
charges = list()
)
# S3 method for class 'MassSpecResults_Spectra'
validate_object(x)
# S3 method for class 'MassSpecResults_Spectra'
show(x)
# S3 method for class 'MassSpecResults_Spectra'
x[i]
# S3 method for class 'MassSpecResults_Spectra'
get_spectra(
x,
analyses = NULL,
levels = NULL,
mass = NULL,
mz = NULL,
rt = NULL,
mobility = NULL,
ppm = 20,
sec = 60,
millisec = 5,
id = NULL,
allTraces = TRUE,
isolationWindow = 1.3,
minIntensityMS1 = 0,
minIntensityMS2 = 0
)
# S3 method for class 'MassSpecResults_Spectra'
plot_spectra(
x,
analyses = NULL,
levels = NULL,
mass = NULL,
mz = NULL,
rt = NULL,
mobility = NULL,
ppm = 20,
sec = 60,
millisec = 5,
id = NULL,
allTraces = TRUE,
isolationWindow = 1.3,
minIntensityMS1 = 0,
minIntensityMS2 = 0,
legendNames = TRUE,
colorBy = "analyses",
xVal = "mz",
xLab = NULL,
yLab = NULL,
title = NULL,
interactive = TRUE,
renderEngine = "webgl"
)
# S3 method for class 'MassSpecResults_Spectra'
plot_spectra_3d(
x,
analyses = NULL,
levels = NULL,
mass = NULL,
mz = NULL,
rt = NULL,
mobility = NULL,
ppm = 20,
sec = 60,
millisec = 5,
id = NULL,
allTraces = TRUE,
isolationWindow = 1.3,
minIntensityMS1 = 0,
minIntensityMS2 = 0,
legendNames = TRUE,
colorBy = "analyses",
xVal = "rt",
yVal = "mz",
xLab = NULL,
yLab = NULL,
zLab = NULL,
renderEngine = "webgl"
)
# S3 method for class 'MassSpecResults_Spectra'
plot_spectra_charges(
x,
analyses = NULL,
legendNames = NULL,
title = NULL,
colorBy = "analyses",
xLab = NULL,
yLab = NULL,
interactive = TRUE,
renderEngine = "webgl"
)
# S3 method for class 'MassSpecResults_Spectra'
get_spectra_matrix(x, analyses = NULL)
# S3 method for class 'MassSpecResults_Spectra'
get_spectra_peaks(x, analyses = NULL)
# S3 method for class 'MassSpecResults_Spectra'
plot_spectra_peaks(
x,
analyses = NULL,
legendNames = TRUE,
colorBy = "analyses",
xVal = "mz",
xLab = NULL,
yLab = NULL,
title = NULL,
interactive = TRUE,
renderEngine = "webgl"
)
Arguments
- spectra
A list of spectra data.table objects.
- replicates
A character vector of replicate names.
- is_averaged
Logical indicating if the spectra are averaged.
- is_neutralized
Logical indicating if the spectra are neutralized.
- peaks
A list of data.table objects containing peak information for each spectrum.
- charges
A list of data.table objects containing charge information for each spectrum
- x
A
MassSpecResults_Spectra
object.- analyses
Character or numeric vector with names or indexes of analyses in the
Analyses
object.- levels
Integer vector with the levels of MS data.
- mass
A vector with target neutral mass value/s (in Da) or a two columns data.table or data.frame named
min
andmax
with minimum and maximum neutral mass values (in Da), respectively. Alternatively, neutral mass (in Da) and retention time (in seconds) and/or drift time values (in milliseconds) can be given as one data.table or data.frame with columns namedmass
andrt
and/ordrift
. Then, the deviations given in theppm
,sec
andmillisec
arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of neutral mass, retention time and drift time targets. In this case, the column names must bemin
,max
,rtmin
,rtmax
,driftmin
anddriftmax
. Note that when mass/time ranges are given, theppm
,sec
andmillisec
arguments are not used.- mz
A vector with target m/z value/s (in Da) or a two columns data.table or data.frame named
mzmin
andmzmax
with minimum and maximum m/z values (in Da), respectively. Alternatively, m/z (in Da) and retention time values (in seconds) can be given as one data.table or data.frame with columns namedmz
andrt
and/ordrift
. Then, the deviations given in theppm
,sec
andmillisec
arguments are used to calculate the ranges. Also works with a data.table or data.frame with minimum and maximum values of m/z, retention time and drift time targets. In this case, the column names must bemzmin
,mzmax
,rtmin
,rtmax
,driftmin
anddriftmax
. Note that when mass/time ranges are given, theppm
,sec
andmillisec
arguments are not used.- rt
A vector with target retention time values (in seconds) or a two columns data.table or data.frame with minimum and maximum retention time values (in seconds).
- mobility
A vector with target drift time values (in milliseconds) or a two columns data.table or data.frame with minimum and maximum drift time values (in milliseconds).
- ppm
Numeric of length one with the mass deviation, in ppm.
- sec
Numeric of length one with the time deviation, in seconds.
- millisec
Numeric of length one with the drift time deviation, in milliseconds.
- id
Character with the same length as m/z and retention time targets to be used as identifier/s. When not given, the id is built as a combination of the m/z and retention time ranges or values.
- allTraces
Logical, when
TRUE
all level 2 data is returned. WhenFALSE
and level has 2, only the MS2 traces of MS1 targets are returned, using theisolationWindow
to calculate the mass window.- isolationWindow
Numeric value with the isolation window (in Da) applied for ion isolation and fragmentation during acquisition of tandem data (i.e., MS2 data).
- minIntensityMS1
Numeric value with the minimum intensity of level 1 data (i.e., MS1 data).
- minIntensityMS2
Numeric value with the minimum intensity of level 2 data (i.e., MS2 data).
- legendNames
A character vector with the same length as the targets or
TRUE
orFALSE
for using the name in the added targets as legend of the plot.- colorBy
A string defining how to legend the plot. Possible values are
analyses
,targets
(the default) orreplicates
.- xVal
A character string indicating the x-axis variable. Options are "mz", "mass", or "mobility".
- xLab
A string with the title for the x axis.
- yLab
A string with the title for the y axis.
- title
A string with the title.
- interactive
Logical (length 1). When
TRUE
, the data is plotted interactively using plotly.- renderEngine
The engine to render the data. The default is "webgl".
- yVal
A character string indicating the y-axis variable. Options are "rt", "mz", "mass", or "mobility".
- zLab
A character string indicating the z-axis label. Default is "Intensity / counts".
Methods (by generic)
validate_object(MassSpecResults_Spectra)
: Validate the MassSpecResults_Spectra object, returning NULL if valid.show(MassSpecResults_Spectra)
: Show the MassSpecResults_Spectra object.[
: Subset the MassSpecResults_Spectra object.get_spectra(MassSpecResults_Spectra)
: Get spectra from the MassSpecResults_Spectra object, returning a list of data.table objects.plot_spectra(MassSpecResults_Spectra)
: Plot spectra from the MassSpecResults_Spectra object.plot_spectra_3d(MassSpecResults_Spectra)
: Plot 3D spectra from the MassSpecResults_Spectra object.plot_spectra_charges(MassSpecResults_Spectra)
: Plot spectra charges from the MassSpecResults_Spectra object.get_spectra_matrix(MassSpecResults_Spectra)
: Get spectra matrix from the MassSpecResults_Spectra object.get_spectra_peaks(MassSpecResults_Spectra)
: Get spectra peaks from the MassSpecResults_Spectra object.plot_spectra_peaks(MassSpecResults_Spectra)
: Plot spectra peaks from the MassSpecResults_Spectra object.