MS2ID: MS2ID class for high-throughput MS/MS annotation

View source: R/MS2ID.R

MS2IDR Documentation

MS2ID class for high-throughput MS/MS annotation

Description

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 \insertCiteCompoundDBMS2ID 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.

Usage

MS2ID(ms2idFolder)

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

createMS2ID(
  name = "MS2ID",
  path = ".",
  cmpdb,
  noiseThresh = 0.01,
  calcSplash = TRUE,
  calcMmi = TRUE,
  overwrite = FALSE,
  removeRedundant = "compounds"
)

Arguments

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

CompDb(1) object (with MS/MS spectra).

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 getSplash function.

calcMmi

boolean(1) indicating if compound monoisotopic mass values (when missing) must be calculated using the check_chemform function.

overwrite

boolean(1) indicating if the function can overwrite results.

removeRedundant

character(1) eliminate redundant compounds and/or spectra. Expected options: "compounds", "spectra", "both" or "none". Redundant compounds are removed by comparing their InChIKeys. Redundant spectra are removed by comparing the spectrum and specific metadata variables, which include: "collisionEnergy", "polarity", "predicted", "instrumentType", and "precursorMz". If the metadata is incomplete or lacks the necessary fields, redundant spectra will not be removed.

Details

The createMS2ID function creates a MS2ID backend that is subsequently used by the MS2ID constructor, which creates the MS2ID object.

Value

createMS2ID returns a character(1) with the MS2ID backend location. This value must be used as ms2idFolder parameter in the MS2ID constructor.

General functions

  • createMS2ID(): Function to create MS2ID backends.

  • MS2ID(): Constructor function for MS2ID objects.

Author(s)

Josep M. Badia josepmaria.badia@urv.cat

References

\insertRef

CompoundDBMS2ID

See Also

createMS2ID function.

MS2ID class.

Examples

## 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)
cmps <- suppressWarnings(compound_tbl_sdf(MoNAsubset))
spctr <- msms_spectra_mona(MoNAsubset, collapsed = TRUE)
spctr$predicted <- FALSE
metad <- 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)
cmpdb <- CompDb(db_file)
## Create the MS2ID backend
library(MS2ID)
MS2IDdirectory <- createMS2ID(cmpdb = cmpdb, calcSplash = FALSE,
                              overwrite = TRUE, path = tempdir())
## Obtain the MS2ID object
MS2IDlib <- MS2ID(MS2IDdirectory)


jmbadia/MS2ID documentation built on Dec. 10, 2024, 2:33 p.m.