View source: R/MsBackendCompDb-functions.R
MsBackendCompDb | R Documentation |
The MsBackendCompDb
represents MS2 spectra data from a CompDb()
object/database. The object keeps only the primary keys of the spectra,
the associated compound IDs and the precursor m/z values in memory and
has thus only a very low memory footprint. All spectra variables, including
m/z and intensity values are retrieved from the database on-demand. By
extending the Spectra::MsBackendCached()
class directly, MsBackendCompDb
supports adding/replacing spectra variables. These values are however only
cached within the object and not propagated (written) to the database.
It is not intended that users create or use instances of this class directly,
the Spectra::Spectra()
call on CompDb()
will return a Spectra
object that uses this backend.
The MsBackendCompDb
does not support parallel processing because the
database connection stored within the object can not be used across
multiple parallel processes. The backendBpparam()
method for
MsBackendCompDb
thus returns always SerialParam
and hence any
function that uses this method to check for parallel processing capability
of a MsBackend
will by default disable parallel processing.
MsBackendCompDb()
## S4 method for signature 'MsBackendCompDb'
backendInitialize(object, x, filter, ...)
## S4 method for signature 'MsBackendCompDb'
show(object)
## S4 method for signature 'MsBackendCompDb'
peaksData(object, columns = c("mz", "intensity"))
## S4 method for signature 'MsBackendCompDb'
peaksVariables(object)
## S4 method for signature 'MsBackendCompDb'
dataStorage(object)
## S4 replacement method for signature 'MsBackendCompDb'
intensity(object) <- value
## S4 replacement method for signature 'MsBackendCompDb'
mz(object) <- value
## S4 method for signature 'MsBackendCompDb'
spectraData(object, columns = spectraVariables(object))
## S4 method for signature 'MsBackendCompDb'
spectraNames(object)
## S4 replacement method for signature 'MsBackendCompDb'
spectraNames(object) <- value
## S4 method for signature 'MsBackendCompDb,ANY'
x[i, j, ..., drop = FALSE]
## S4 method for signature 'MsBackendCompDb,ANY'
extractByIndex(object, i)
## S4 replacement method for signature 'MsBackendCompDb'
x$name <- value
## S4 method for signature 'MsBackendCompDb'
precScanNum(object)
## S4 method for signature 'MsBackendCompDb'
tic(object, initial = TRUE)
## S4 method for signature 'MsBackendCompDb'
backendBpparam(object, BPPARAM = bpparam())
object |
an |
x |
an |
filter |
for |
... |
ignored. |
columns |
for |
value |
for |
i |
For |
j |
For |
drop |
For |
name |
for |
initial |
for |
BPPARAM |
for |
See the description of the respective function.
MsBackendCompDb
The methods listed here are implemented for the MsBackendCompDb
. All other
methods are inherited directly from the parent Spectra::MsBackendCached()
class. See the help of Spectra::MsBackend()
in the Spectra
package for a
complete listing of methods.
peaksData()
: gets the full list of peak matrices. Returns a list()
,
length equal to the number of spectra and each element being a matrix
with columns "mz"
and "intensity"
with the spectra's m/z and intensity
values.
peaksVariables()
: lists the available peaks variables in the backend
(database). These can be used for parameter columns
of peaksData()
.
intensity<-
: not supported.
mz<-
: not supported.
spectraData()
: returns the complete spectrum data including m/z and
intensity values as a S4Vectors::DataFrame()
.
$<-
: replace or add a spectrum variable. Note that mz
, intensity
and
spectrum_id
variables can not be replaced.
For higher performance it is suggested to change the backend of the
Spectra::Spectra()
object to an Spectra::MsBackendMemory()
backend
with the Spectra::setBackend()
method of Spectra
objects.
Johannes Rainer
## MsBackendCompDb are not expected to be created/instanciated by users
## directly. Users also almost never directly interact with this type of
## object, as it is intented as a pure data backend for the `Spectra` object.
## Users will thus access MS data through such `Spectra` object, which can
## be created for `CompDb` objects using the `Spectra` method (see help
## of the `CompDb` object for more information. This examples shows how
## a `MsBackendCompDb` could be created purely from an SQLite database
## with data from a CompoundDb database.
## Connect to the SQLite database of a `CompDb` distributed via this package
library(RSQLite)
library(Spectra)
cdb <- CompDb(system.file("sql/CompDb.MassBank.sql", package = "CompoundDb"))
be <- backendInitialize(MsBackendCompDb(), cdb)
be
## Accessing m/z values
mz(be)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.