`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)
x | character: signature supported |
---|---|
object | character: signature supported |
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
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.
annotate
function, and post annotation tools
MS2IDgui
and export2xlsx
.
Josep M. Badia josepmaria.badia@urv.cat
## 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)#>#>#>#>## 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)#>#>#>#> #>#>#> #>#>#> #> #> #> #> #> #>#> #>#>#> #>#>#>#> #>#>#> #>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]