Annot: S4 class containing annotation results

View source: R/Annot.R

AnnotR Documentation

S4 class containing annotation results

Description

'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:

  • Getters of the object. See next section

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

Usage

## S4 method for signature 'Annot'
refCompound(x)

## S4 method for signature 'Annot'
qrySpectra(x)

## S4 method for signature 'Annot'
refSpectra(x)

## S4 method for signature 'Annot'
hits(x)

## S4 method for signature 'Annot'
infoAnnotation(x)

## S4 method for signature '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 \insertCiteSpectraMS2ID 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

Author(s)

Josep M. Badia josepmaria.badia@urv.cat

References

\insertRef

SpectraMS2ID

See Also

annotate function, and post annotation tools MS2IDgui and export2xlsx.

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)

## 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]

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