The `MS2ID` class encapsulates, a MS2 spectra database along with its
metadata. Its internal structure allows to annotate query spectra - with the
annotate
function - using big spectra databases at high speed
and low RAM requirements (typically 100 query spectra/min against a 1M5
spectra library). MS2ID class uses a SQLite database with the metadata and
bigmemory files to store the spectra (i.e. peaks matrices) and their
mass-charge index. See
vignette.
createMS2ID
processes the data contained in a
CompDb
object (Stanstrup and Rainer 2021)
and
creates a MS2ID backend by saving data as SQL and bigMemory files in a
directory. Later on, that directory will be load as an MS2ID
object in order to be used repeatedly as reference library with the
annotate
function.
MS2ID(ms2idFolder) # S4 method for MS2ID show(object) createMS2ID( name = "MS2ID", path = ".", cmpdb, noiseThresh = 0.01, calcSplash = TRUE, calcMmi = TRUE, overwrite = FALSE )
ms2idFolder | character(1) with the directory's path of the MS2ID backend |
---|---|
object | character: signature supported |
name | character(1) name of the directory where the files will be saved. |
path | character(1) with the path where to create the MS2ID backend. |
cmpdb |
|
noiseThresh | A numeric defining the threshold used in the noise filtering of the MS/MS spectra. e.g. noiseThresh = 0.01 removes peaks with an intensity less than 1% of the base peak. |
calcSplash | boolean(1) indicating if SPLASH values (when missing) must
be calculated using the |
calcMmi | boolean(1) indicating if compound monoisotopic mass values
(when missing) must be calculated using the
|
overwrite | boolean(1) indicating if the function can overwrite results. |
createMS2ID
returns a character(1) with the MS2ID backend
location. This value must be used as ms2idFolder
parameter in the
MS2ID
constructor.
The createMS2ID
function creates a MS2ID backend that is
subsequently used by the MS2ID
constructor, which creates the
MS2ID
object.
createMS2ID(): Function to create MS2ID backends.
MS2ID(): Constructor function for MS2ID objects.
Stanstrup J, Rainer J (2021). CompoundDb: Creating and Using (Chemical) Compound Annotation Databases. R package version 0.8.1, https://github.com/EuracBiomedicalResearch/CompoundDb.
createMS2ID
function.
MS2ID class.
Josep M. Badia josepmaria.badia@urv.cat
Josep M. Badia josepmaria.badia@urv.cat
## OBTAIN MS2ID LIBRARY --- ## Decompress the MoNA subset that comes with MS2ID MoNAsubset <- system.file("extdata/MoNAsubset.sdf.gz", package = "MS2ID") ## Use CompoundDB to parse MoNA library(CompoundDb)#> Error in library(CompoundDb): there is no package called ‘CompoundDb’#> Error in compound_tbl_sdf(MoNAsubset): could not find function "compound_tbl_sdf"spctr <- msms_spectra_mona(MoNAsubset, collapsed = TRUE)#> Error in msms_spectra_mona(MoNAsubset, collapsed = TRUE): could not find function "msms_spectra_mona"spctr$predicted <- FALSE#> Error in spctr$predicted <- FALSE: object 'spctr' not foundmetad <- data.frame( name = c("source", "url", "source_version","source_date"), value = c("MoNA", "https://mona.fiehnlab.ucdavis.edu/downloads", "v1", '07-09') ) cmpdbDir <- file.path(tempdir(), "cmpdbDir") if(dir.exists(cmpdbDir)){ do.call(file.remove, list(list.files(cmpdbDir, full.names = TRUE))) }else{ dir.create(cmpdbDir) } db_file <- createCompDb(cmps, metadata = metad, msms_spectra = spctr, path = cmpdbDir)#> Error in createCompDb(cmps, metadata = metad, msms_spectra = spctr, path = cmpdbDir): could not find function "createCompDb"cmpdb <- CompDb(db_file)#> Error in CompDb(db_file): could not find function "CompDb"## Create the MS2ID backend library(MS2ID) MS2IDdirectory <- createMS2ID(cmpdb = cmpdb, overwrite = TRUE, path = tempdir())#> Error in is(cmpdb, "CompDb"): object 'cmpdb' not found## Obtain the MS2ID object MS2IDlib <- MS2ID(MS2IDdirectory)#> Error in file.exists(ms2idFolder): object 'MS2IDdirectory' not found