export2xlsx: Export an annotation object to an xlsx file

View source: R/export2xlsx.R

export2xlsxR Documentation

Export an annotation object to an xlsx file

Description

export2xlsx function exports the data contained in an Annot object to a xlsx file.

Usage

export2xlsx(
  anRslt = NULL,
  file = NULL,
  summarizeHits = TRUE,
  overwrite = FALSE,
  ...
)

Arguments

anRslt

Annot object with the results to export.

file

char(1) name of the resulting xlsx file

summarizeHits

boolean(1). A TRUE value summarizes the resulting excel, keeping only, for every query spectrum, the best annotation per compound.

overwrite

boolean(1) If TRUE, overwrite any existing file.

...

other arguments passed to function

Details

export2xlsx function distributes the annotation results among different worksheets of an xlsx file, one per query file, and every row corresponds to an annotation. Annotations of the same query spectrum have identical row colours. Contiguous annotations with equal query precursor mass have similar row colours (e.g. variations of orange); the best distance metric and the most common compound name among those contiguous annotations are bolded in red and black. Moreover:

  • Column names that contain QRY, REF or CONS refer to query, reference or consensus entities, respectively. e.g. QRYprecursorMz contains the precursor M/z of the query spectra, REFadduct the adducts of the reference spectra and QRYrtime_CONS the retention times of the query spectra that conform every consensus spectrum.

  • The column massNum.QRY_CMN_REF (e.g. 7/4/5) shows the number of fragments of the query and reference spectra, and the number of fragments they have in common.

  • REFinchikey contains the inchikey of the reference compound and a link to a Pubchem's page listing compounds with that inchikey.

  • ppmPrecMass refers to the absolute difference value in ppm between query and reference precursor masses.

Author(s)

Josep M. Badia josepmaria.badia@urv.cat

See Also

Annot class and annotate function.

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)

## EXPORT TO XLSX FILE---
export2xlsx(anRslt = annotResult, file = "sample",
            summarizeHits = FALSE, overwrite=TRUE)

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