MsBackendMassbankSql: MS backend accessing the MassBank MySQL database

Description Usage Arguments Value Supported Backend functions Not supported Backend functions Retrieving compound annotations for spectra Author(s) Examples

View source: R/MsBackendMassbankSql-functions.R

Description

The MsBackendMassbankSql provides access to mass spectrometry data from MassBank by directly accessing its MySQL/MariaDb database. In addition it supports adding new spectra variables or locally changing spectra variables provided by MassBank (without changing the original values in the database).

Note that MsBackendMassbankSql requires a local installation of the MassBank database since direct database access is not supported for the main MassBank instance.

Also, some of the fields in the MassBank database are not directly compatible with Spectra, such as the collision energy which is not available as a numeric value. The collision energy as available in MassBank is reported as spectra variable "collision_energy_text". Also, precursor m/z values reported for some spectra can not be converted to a numeric and hence NA is reported with the spectra variable precursorMz for these spectra. The variable "precursor_mz_text" can be used to get the original precursor m/z reported in MassBank.

Usage

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
MsBackendMassbankSql()

## S4 method for signature 'MsBackendMassbankSql'
show(object)

## S4 method for signature 'MsBackendMassbankSql'
backendInitialize(object, dbcon, ...)

## S4 method for signature 'MsBackendMassbankSql'
acquisitionNum(object)

## S4 method for signature 'MsBackendMassbankSql'
peaksData(object)

## S4 method for signature 'MsBackendMassbankSql'
centroided(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
centroided(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
collisionEnergy(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
collisionEnergy(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
dataOrigin(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
dataOrigin(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
dataStorage(object)

## S4 method for signature 'MsBackendMassbankSql'
intensity(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
intensity(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
ionCount(object)

## S4 method for signature 'MsBackendMassbankSql'
isEmpty(x)

## S4 method for signature 'MsBackendMassbankSql'
isolationWindowLowerMz(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
isolationWindowLowerMz(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
isolationWindowTargetMz(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
isolationWindowTargetMz(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
isolationWindowUpperMz(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
isolationWindowUpperMz(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
length(x)

## S4 method for signature 'MsBackendMassbankSql'
msLevel(object)

## S4 method for signature 'MsBackendMassbankSql'
mz(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
mz(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
lengths(x, use.names = FALSE)

## S4 method for signature 'MsBackendMassbankSql'
polarity(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
polarity(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
precursorCharge(object)

## S4 method for signature 'MsBackendMassbankSql'
precursorIntensity(object)

## S4 method for signature 'MsBackendMassbankSql'
precursorMz(object)

## S4 method for signature 'MsBackendMassbankSql'
reset(object)

## S4 method for signature 'MsBackendMassbankSql'
rtime(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
rtime(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
scanIndex(object)

## S4 method for signature 'MsBackendMassbankSql'
selectSpectraVariables(object, spectraVariables = spectraVariables(object))

## S4 method for signature 'MsBackendMassbankSql'
smoothed(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
smoothed(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
spectraData(object, columns = spectraVariables(object))

## S4 replacement method for signature 'MsBackendMassbankSql'
spectraData(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
spectraNames(object)

## S4 replacement method for signature 'MsBackendMassbankSql'
spectraNames(object) <- value

## S4 method for signature 'MsBackendMassbankSql'
spectraVariables(object)

## S4 method for signature 'MsBackendMassbankSql'
tic(object, initial = TRUE)

## S4 method for signature 'MsBackendMassbankSql'
x[i, j, ..., drop = FALSE]

## S4 method for signature 'MsBackendMassbankSql'
x$name

## S4 replacement method for signature 'MsBackendMassbankSql'
x$name <- value

## S4 method for signature 'Spectra'
compounds(object, ...)

## S4 method for signature 'MsBackendMassbankSql'
compounds(object, ...)

Arguments

object

Object extending MsBackendMassbankSql.

dbcon

For backendInitialize,MsBackendMassbankSql: SQL database connection to the MassBank (MariaDb) database.

...

Additional arguments.

value

replacement value for <- methods. See individual method description or expected data type.

x

Object extending MsBackendMassbankSql.

use.names

For lengths: whether spectrum names should be used.

spectraVariables

For selectSpectraVariables: character with the names of the spectra variables to which the backend should be subsetted.

columns

For spectraData accessor: optional character with column names (spectra variables) that should be included in the returned DataFrame. By default, all columns are returned.

initial

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).

i

For [: integer, logical or character to subset the object.

j

For [: not supported.

drop

For [: not considered.

name

For $ and $<-: the name of the spectra variable to return or set.

Value

See documentation of respective function.

Supported Backend functions

The following functions are supported by the MsBackendMassbankSqlMassbankDb.

Not supported Backend functions

The following functions are not supported by the MsBackendMassbankSql since the original data can not be changed.

backendMerge, export, filterDataStorage, filterPrecursorScan, peaksData<-, filterAcquisitionNum, intensity<-, mz<-, precScanNum, spectraData<-, spectraNames<-.

Retrieving compound annotations for spectra

While compound annotations are also provided via the spectraVariables of the backend, it would also be possible to use the compounds function on a Spectra object (that uses a MsBackendMassbankSql backend) to retrieve compound annotations for the specific spectra.

Author(s)

Johannes Rainer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Create a connection to a database with MassBank data - in the present
## example we connect to a tiny SQLite database bundled in this package
## as public access to the MassBank MySQL is not (yet) supported. See the
## vignette for more information on how to install MassBank locally and
## enable MySQL database connections
library(RSQLite)
con <- dbConnect(SQLite(), system.file("sql/minimassbank.sql",
    package = "MsBackendMassbank"))

## Given that we have the connection to a MassBank databas we can
## initialize the backend:
be <- backendInitialize(MsBackendMassbankSql(), dbcon = con)
be

## Access MS level
msLevel(be)
be$msLevel

## Access m/z values
be$mz

## Access the full spectra data (including m/z and intensity values)
spectraData(be)

## Add a new spectra variable
be$new_variable <- "b"
be$new_variable

## Subset the backend
be_sub <- be[c(3, 1)]

spectraNames(be)
spectraNames(be_sub)

michaelwitting/MsBackendMassbank documentation built on March 16, 2021, 2:14 a.m.