For tic()
: logical(1)
whether the initially
+
For tic()
: logical(1)
whether the initially
reported total ion current should be reported, or whether the
total ion current should be (re)calculated on the actual data
(initial = FALSE
).
@@ -647,7 +650,7 @@ Backend functionsacquisitionNum(): returns the acquisition number of each
spectrum. Returns an integer
of length equal to the number of
spectra (with NA_integer_
if not available).
backendBpparam()
: return the parallel processing setup supported by
@@ -670,7 +673,7 @@
Backend functionssetBackend() function from Spectra
. Note that eventually (for
read-only backends) also the supportsSetBackend
method would need
to be implemented to return TRUE
.
The backendInitialize()
method has also to ensure to correctly set
@@ -685,103 +688,103 @@ Backend functionsdataOrigin(): gets a character
of length equal to the number of
spectra in object
with the data origin of each spectrum. This could
e.g. be the mzML file from which the data was read.
-dataStorage()
: gets a character
of length equal to the number of
+
dataStorage()
: gets a character
of length equal to the number of
spectra in object
with the data storage of each spectrum. Note that
missing values (NA_character_
) are not supported for dataStorage
.
dataStorageBasePath()
, dataStorageBasePath<-: gets or sets the common *base* path of the directory containing all data files. If supported, the function is expected to return (or accept) a
characterof length 1. Most backends (such as for example the
MsBackendMemorywill not support this function and
dataStorageBasePath()will return
NA_character_. For
MsBackendMzR, this function allows to get or change the path to the directory containing the original data files, which is required if e.g. a serialized
MsBackendMzR` instance gets copied to another computer or
file system.
-dropNaSpectraVariables()
: removes spectra variables (i.e. columns in the
+
dropNaSpectraVariables()
: removes spectra variables (i.e. columns in the
object's spectraData
that contain only missing values (NA
). Note that
-while columns with only NA
s are removed, a spectraData()
call after
-dropNaSpectraVariables()
might still show columns containing NA
values
+while columns with only NA
s are removed, a spectraData()
call after
+dropNaSpectraVariables()
might still show columns containing NA
values
for core spectra variables.
-centroided()
, centroided<-
: gets or sets the centroiding
-information of the spectra. centroided()
returns a logical
+
centroided()
, centroided<-
: gets or sets the centroiding
+information of the spectra. centroided()
returns a logical
vector of length equal to the number of spectra with TRUE
if a
spectrum is centroided, FALSE
if it is in profile mode and NA
-if it is undefined. See also isCentroided()
for estimating from
+if it is undefined. See also isCentroided()
for estimating from
the spectrum data whether the spectrum is centroided. value
for centroided<-
is either a single logical
or a logical
of
length equal to the number of spectra in object
.
-collisionEnergy()
, collisionEnergy<-
: gets or sets the
-collision energy for all spectra in object
. collisionEnergy()
+
collisionEnergy()
, collisionEnergy<-
: gets or sets the
+collision energy for all spectra in object
. collisionEnergy()
returns a numeric
with length equal to the number of spectra
(NA_real_
if not present/defined), collisionEnergy<-
takes a
numeric
of length equal to the number of spectra in object
.
-export()
: exports data from a Spectra
class to a file. This method is
+
export()
: exports data from a Spectra
class to a file. This method is
called by the export,Spectra
method that passes itself as a second
argument to the function. The export,MsBackend
implementation is thus
expected to take a Spectra
class as second argument from which all data
is exported. Taking data from a Spectra
class ensures that also all
eventual data manipulations (cached in the Spectra
's lazy evaluation
queue) are applied prior to export - this would not be possible with only a
-MsBackend class. An example implementation is the export()
method
+MsBackend class. An example implementation is the export()
method
for the MsBackendMzR
backend that supports export of the data in
mzML or mzXML format. See the documentation for the MsBackendMzR
class below for more information.
-filterAcquisitionNum()
: filters the object keeping only spectra matching
+
filterAcquisitionNum()
: filters the object keeping only spectra matching
the provided acquisition numbers (argument n
). If dataOrigin
or
dataStorage
is also provided, object
is subsetted to the spectra with
an acquisition number equal to n
in spectra with matching dataOrigin
or dataStorage values retaining all other spectra.
-filterDataOrigin()
: filters the object retaining spectra matching the
+
filterDataOrigin()
: filters the object retaining spectra matching the
provided dataOrigin
. Parameter dataOrigin
has to be of type
character
and needs to match exactly the data origin value of the
spectra to subset.
-filterDataOrigin()
should return the data ordered by the provided
+filterDataOrigin()
should return the data ordered by the provided
dataOrigin
parameter, i.e. if dataOrigin = c("2", "1")
was provided,
the spectra in the resulting object should be ordered accordingly (first
spectra from data origin "2"
and then from "1"
).
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterDataStorage()
: filters the object retaining spectra matching the
+
filterDataStorage()
: filters the object retaining spectra matching the
provided dataStorage
. Parameter dataStorage
has to be of type
character
and needs to match exactly the data storage value of the
spectra to subset.
-filterDataStorage()
should return the data ordered by the provided
+filterDataStorage()
should return the data ordered by the provided
dataStorage
parameter, i.e. if dataStorage = c("2", "1")
was provided,
the spectra in the resulting object should be ordered accordingly (first
spectra from data storage "2"
and then from "1"
).
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterEmptySpectra()
: removes empty spectra (i.e. spectra without peaks).
+
filterEmptySpectra()
: removes empty spectra (i.e. spectra without peaks).
Implementation of this method is optional since a default implementation
for MsBackend
is available.
filterFile()
: retains data of files matching the file index or file name
provided with parameter file
.
-filterIsolationWindow()
: retains spectra that contain mz
in their
+
filterIsolationWindow()
: retains spectra that contain mz
in their
isolation window m/z range (i.e. with an isolationWindowLowerMz
<=
mz
and isolationWindowUpperMz
>=
mz
.
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterMsLevel()
: retains spectra of MS level msLevel
.
+
filterMsLevel()
: retains spectra of MS level msLevel
.
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterPolarity()
: retains spectra of polarity polarity
.
+
filterPolarity()
: retains spectra of polarity polarity
.
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterPrecursorMzRange()
(previously filterPrecursorMz
): retains
+
filterPrecursorMzRange()
(previously filterPrecursorMz
): retains
spectra with a precursor m/z within the provided m/z range.
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterPrecursorMzValues()
: retains spectra with a precursor m/z matching
+
filterPrecursorMzValues()
: retains spectra with a precursor m/z matching
any of the provided m/z values (given ppm
and tolerance
).
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterPrecursorCharge()
: retains spectra with the defined precursor
+
filterPrecursorCharge()
: retains spectra with the defined precursor
charge(s).
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterPrecursorScan()
: retains parent (e.g. MS1) and children scans (e.g.
+
filterPrecursorScan()
: retains parent (e.g. MS1) and children scans (e.g.
MS2) of acquisition number acquisitionNum
. Parameter f
is supposed to
define the origin of the spectra (i.e. the original data file) to ensure
related spectra from the same file/sample are selected and retained.
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterRanges()
: allows filtering of the Spectra
object based on user
+
filterRanges()
: allows filtering of the Spectra
object based on user
defined numeric ranges (parameter ranges
) for one or more available
spectra variables in object (spectra variable names can be specified with
parameter spectraVariables
). Spectra for which the value of a spectra
@@ -792,11 +795,11 @@
Backend functionsfilterRt(): retains spectra of MS level msLevel
with retention times
within (>=
) rt[1]
and (<=
) rt[2]
.
Implementation of this method is optional since a default implementation
for MsBackend
is available.
-filterValues()
: allows filtering of the Spectra
object based on
+
filterValues()
: allows filtering of the Spectra
object based on
similarities of numeric values of one or more spectraVariables(object)
(parameter spectraVariables
) to provided values (parameter values
)
given acceptable differences (parameters tolerance and ppm). If multiple
@@ -806,7 +809,7 @@
Backend functionsintensity(): gets the intensity values from the spectra. Returns
a NumericList()
of numeric
vectors (intensity values for each
spectrum). The length of the list
is equal to the number of
spectra
in object
.
@@ -815,34 +818,35 @@ Backend functionsionCount(): returns a numeric
with the sum of intensities for
+each spectrum. If the spectrum is empty (see isEmpty()
),
NA_real_
is returned.
-
isCentroided()
: a heuristic approach assessing if the spectra in
+
isCentroided()
: a heuristic approach assessing if the spectra in
object
are in profile or centroided mode. The function takes
the qtl
th quantile top peaks, then calculates the difference
between adjacent m/z value and returns TRUE
if the first
quartile is greater than k
. (See Spectra:::.peaks_is_centroided
for
the code.)
-isEmpty()
: checks whether a spectrum in object
is empty
+
isEmpty()
: checks whether a spectrum in object
is empty
(i.e. does not contain any peaks). Returns a logical
vector of
length equal number of spectra.
-isolationWindowLowerMz()
, isolationWindowLowerMz<-
: gets or sets the
+
isolationWindowLowerMz()
, isolationWindowLowerMz<-
: gets or sets the
lower m/z boundary of the isolation window.
-isolationWindowTargetMz()
, isolationWindowTargetMz<-
: gets or sets the
+
isolationWindowTargetMz()
, isolationWindowTargetMz<-
: gets or sets the
target m/z of the isolation window.
-isolationWindowUpperMz()
, isolationWindowUpperMz<-
: gets or sets the
+
isolationWindowUpperMz()
, isolationWindowUpperMz<-
: gets or sets the
upper m/z boundary of the isolation window.
isReadOnly()
: returns a logical(1)
whether the backend is read
only or does allow also to write/update data.
length()
: returns the number of spectra in the object.
-lengths()
: gets the number of peaks (m/z-intensity values) per
+
lengths()
: gets the number of peaks (m/z-intensity values) per
spectrum. Returns an integer
vector (length equal to the
number of spectra). For empty spectra, 0
is returned.
-msLevel()
: gets the spectra's MS level. Returns an integer
+
msLevel()
: gets the spectra's MS level. Returns an integer
vector (of length equal to the number of spectra) with the MS
level for each spectrum (or NA_integer_
if not available).
-mz()
: gets the mass-to-charge ratios (m/z) from the
+
msLevel<-
: replaces the spectra's MS level.
+mz()
: gets the mass-to-charge ratios (m/z) from the
spectra. Returns a NumericList()
or length equal to the number of
spectra, each element a numeric
vector with the m/z values of
one spectrum.
@@ -850,19 +854,19 @@ Backend functionspolarity(), polarity<-
: gets or sets the polarity for each
+spectrum. polarity()
returns an integer
vector (length equal
to the number of spectra), with 0
and 1
representing negative
and positive polarities, respectively. polarity<-
expects an
integer vector of length 1 or equal to the number of spectra.
-
precursorCharge()
, precursorIntensity()
, precursorMz()
,
+
precursorCharge()
, precursorIntensity()
, precursorMz()
,
precScanNum()
, precAcquisitionNum()
: get the charge (integer
),
intensity (numeric
), m/z (numeric
), scan index (integer
)
and acquisition number (interger
) of the precursor for MS level
2 and above spectra from the object. Returns a vector of length equal to
the number of spectra in object
. NA
are reported for MS1
spectra of if no precursor information is available.
-peaksData()
returns a list
with the spectras' peak data, i.e. m/z and
+
peaksData()
returns a list
with the spectras' peak data, i.e. m/z and
intensity values or other peak variables. The length of the list is
equal to the number of spectra in object
. Each element of the list has
to be a two-dimensional array (matrix
or data.frame
)
@@ -879,68 +883,68 @@
Backend functionspeaksVariables(): lists the available variables for mass peaks. Default
peak variables are "mz"
and "intensity"
(which all backends need to
support and provide), but some backends might provide additional variables.
All these variables are expected to be returned (if requested) by the
-peaksData()
function.
-reset()
a backend (if supported). This method will be called on the
+peaksData()
function.
+reset()
a backend (if supported). This method will be called on the
backend by the reset,Spectra
method that is supposed to restore the data
to its original state (see reset,Spectra
for more details). The function
returns the reset backend. The default implementation for MsBackend
returns the backend as-is.
-rtime()
, rtime<-
: gets or sets the retention times for each
-spectrum (in seconds). rtime()
returns a numeric
vector (length equal
+
rtime()
, rtime<-
: gets or sets the retention times for each
+spectrum (in seconds). rtime()
returns a numeric
vector (length equal
to the number of spectra) with the retention time for each spectrum.
rtime<-
expects a numeric vector with length equal to the
number of spectra.
-scanIndex()
: returns an integer
vector with the scan index
+
scanIndex()
: returns an integer
vector with the scan index
for each spectrum. This represents the relative index of the
spectrum within each file. Note that this can be different to the
-acquisitionNum()
of the spectrum which is the index of the
+acquisitionNum()
of the spectrum which is the index of the
spectrum as reported in the mzML file.
-selectSpectraVariables()
: reduces the information within the backend to
+
selectSpectraVariables()
: reduces the information within the backend to
the selected spectra variables. It is suggested to not remove values
for the "dataStorage"
variable, since this might be required for some
backends to work properly (such as the MsBackendMzR
).
-smoothed()
,smoothed<-
: gets or sets whether a spectrum is
-smoothed. smoothed()
returns a logical
vector of length equal
+
smoothed()
,smoothed<-
: gets or sets whether a spectrum is
+smoothed. smoothed()
returns a logical
vector of length equal
to the number of spectra. smoothed<-
takes a logical
vector
of length 1 or equal to the number of spectra in object
.
-spectraData()
, spectraData<-
: gets or sets general spectrum
-metadata (annotation, also called header). spectraData()
returns
+
spectraData()
, spectraData<-
: gets or sets general spectrum
+metadata (annotation, also called header). spectraData()
returns
a DataFrame
, spectraData<-
expects a DataFrame
with the same number
-of rows as there are spectra in object
. Note that spectraData()
has to
+of rows as there are spectra in object
. Note that spectraData()
has to
return the full data, i.e. also the m/z and intensity values (as a list
or SimpleList
in columns "mz"
and "intensity"
.
-spectraNames()
: returns a character
vector with the names of
+
spectraNames()
: returns a character
vector with the names of
the spectra in object
or NULL
if not set. spectraNames<-
allows to
set spectra names (if the object is not read-only).
-spectraVariables()
: returns a character
vector with the
+
spectraVariables()
: returns a character
vector with the
available spectra variables (columns, fields or attributes)
available in object
. This should return all spectra variables which
are present in object
, also "mz"
and "intensity"
(which are by
default not returned by the spectraVariables,Spectra
method).
-split()
: splits the backend into a list
of backends (depending on
+
split()
: splits the backend into a list
of backends (depending on
parameter f
). The default method for MsBackend
uses split.default()
,
thus backends extending MsBackend
don't necessarily need to implement
this method.
supportsSetBackend()
: whether a MsBackend
supports the Spectra
-setBackend()
function. For a MsBackend
to support setBackend()
it
+setBackend()
function. For a MsBackend
to support setBackend()
it
needs to have a parameter called data
in its backendInitialize()
method
that support receiving all spectra data as a DataFrame
from another
backend and to initialize the backend with this data. In general
-read-only backends do not support setBackend()
hence, the default
+read-only backends do not support setBackend()
hence, the default
implementation of supportsSetBackend()
returns !isReadOnly(object)
. If
-a read-only backend would support the setBackend()
and being initialized
+a read-only backend would support the setBackend()
and being initialized
with a DataFrame
an implementation of this method for that backend could
be defined that returns TRUE
(see also the MsBackend
vignette for
details and examples).
-tic()
: gets the total ion current/count (sum of signal of a
+
tic()
: gets the total ion current/count (sum of signal of a
spectrum) for all spectra in object
. By default, the value
reported in the original raw data file is returned. For an empty
spectrum, NA_real_
is returned.
-uniqueMsLevels()
: gets the unique MS levels of all spectra in object
.
+
uniqueMsLevels()
: gets the unique MS levels of all spectra in object
.
The default implementation calls unique(msLevel(object))
but more
efficient implementations could be defined for specific backends.