BiocStyle::markdown()
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Package: r Biocpkg("rmzTabM")
Authors: Steffen Neumann
Modified: r file.info("mzTabM2MAF.Rmd")$mtime
Compiled: r date()

library(BiocStyle)
library(rmzTabM)
library(metabolighteR)
library(kableExtra)

Converting an mzTab-M file to MetaboLights MAF

The Metabolites Asignement File (MAF) is used by the EMBL-EBI MetaboLights repository to capture the metabolite abundances in the individual samples, the spectral characteristics of the features and, if present, the metabolite identifications.

The convertMzTab2MAF() function will read the mzTab-M via readMzTab() and extract the smlTable and the smfTable. Abundances are extracted from the smlTable, while m/z and retention time come from the feature table.

The MAF is created as a data.frame and written as TSV using write.MAF() from the metabolighteR package by Tom Wilson. The data.frame is also returned as (invisible) return value of convertMzTab2MAF().

# An example file:
mzTabfile <- system.file("testdata", 
                         "MTBLS263.mztab", 
                         package="rmzTabM",
                         mustWork=TRUE)

# Another example file shipped is:
mztabfile <- system.file("testdata", 
                         c("lcmsms_dda_hydrophilic_height_mzTab.mztab"), 
                         package="rmzTabM",
                         mustWork=TRUE)

MAFfile <- file.path(tempdir(check=TRUE), "m_MTBLS0815_v2_maf.tsv")                      

maf <- convertMzTab2MAF(mzTabfile=mztabfile,
                        MAFfile=MAFfile)
kable(head(maf[!(grepl ("MSP: Unknown", maf$database_identifier) | is.na(maf$database_identifier)), ])) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", font_size = 7)) %>% 
  scroll_box(width = "800px", height = "200px")

Session information

sessionInfo()

References



lifs-tools/rmzTab-m documentation built on Jan. 26, 2023, 4:45 p.m.