`Annot` object structures the annotation results returned by the annotate function. It contains reference spectra (with metadata) along with their reference compound metadata, the query spectra (with metadata), and a hits table linking all three items; the hits table also contains the distance metrics and other variables that may define a hit (e.g. adduct assumed on the query spectrum).

An Annot object is created internally by the annotate function, but its content can be accessed externally by using:

  • MS2IDgui function: A GUI interface that browses visually the Annot content.

  • export2xlsx function: Export all the data to an xlsx file.

More info in the corresponding vignette.

# S4 method for Annot
refCompound(x)

# S4 method for Annot
qrySpectra(x)

# S4 method for Annot
refSpectra(x)

# S4 method for Annot
hits(x)

# S4 method for Annot
infoAnnotation(x)

# S4 method for Annot
show(object)

Arguments

x

character: signature supported

object

character: signature supported

Getters

To obtain the content of any Annot's slot, please use the following methods

  • hits: returns a cross-reference dataframe containing the hits along with their proposed adducts and common masses.

  • qrySpectra(object): returns a Spectra object (Gatto et al. 2021) containing the query spectra with hits.

  • refSpectra(object): returns a Spectra object with successful reference spectra.

  • refCompound(object): returns a dataframe containing (reference) compound metadata of successful reference spectra.

  • infoAnnotation(object): returns the variables used on the annotation process

References

Gatto L, Rainer J, Gibb S (2021). Spectra: Spectra Infrastructure for Mass Spectrometry Data. R package version 1.3.4, https://github.com/RforMassSpectrometry/Spectra.

See also

annotate function, and post annotation tools MS2IDgui and export2xlsx.

Author

Josep M. Badia josepmaria.badia@urv.cat

Examples

## LOAD MS2ID LIBRARY --- ## Decompress the MS2ID library that comes with MS2ID MS2IDzipFile <- system.file("extdata/MS2IDLibrary.zip", package = "MS2ID", mustWork = TRUE) library(utils) MS2IDFolder <- dirname(unzip(MS2IDzipFile, exdir = tempdir()))[1] ## SELECT QUERY SPECTRA --- ## Decompress the query mzML files that come with MS2ID queryFile <- system.file("extdata/QRYspectra.zip", package = "MS2ID", mustWork = TRUE) queryFolder <- file.path(tempdir(), "QRYspectra") library(utils) unzip(queryFile, exdir = queryFolder) ## ANNOTATION --- library(MS2ID) MS2IDlib <- MS2ID(MS2IDFolder) annotResult <- annotate(QRYdata = queryFolder, MS2ID = MS2IDlib)
#> Loading query spectra ...
#> Obtaining consensus spectra ...
#> Solving distance metrics between query and reference spectra ...
#> Processing results obtained ...
## ANNOTATION HANDLING--- #merge hits and compound info result <- merge(x = hits(annotResult), y = refCompound(annotResult), by.x = "idREFcomp", by.y = "id", all.y = FALSE) #Subset spectra and metadata considering first hit query spectra library(Spectra)
#> Loading required package: S4Vectors
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> #> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:stats’: #> #> IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’: #> #> anyDuplicated, append, as.data.frame, basename, cbind, colnames, #> dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep, #> grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget, #> order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, #> rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply, #> union, unique, unsplit, which.max, which.min
#> #> Attaching package: ‘S4Vectors’
#> The following objects are masked from ‘package:base’: #> #> expand.grid, I, unname
#> Loading required package: BiocParallel
#> Loading required package: ProtGenerics
#> #> Attaching package: ‘ProtGenerics’
#> The following object is masked from ‘package:stats’: #> #> smooth
idQRYspect_1 <- result$idQRYspect[1] result_1 <- dplyr::filter(result, idQRYspect == idQRYspect_1) qrySpct_1 <- qrySpectra(annotResult) qrySpct_1 <- qrySpct_1[qrySpct_1$id %in% result_1$idQRYspect] refSpct_1 <- refSpectra(annotResult) refSpct_1 <- refSpct_1[refSpct_1$id %in% result_1$idREFspect]