Introduction to metabolighteR

Thomas Wilson

Institute of Biological, Environmental & Rural Sciences (IBERS), Aberystwyth University, UK
tpw2@aber.ac.uk

Introduction

MetaboLights is a database for metabolomics experiments and associated information. The database allows users to deposit raw data, sample information, analysis protocols and metabolite annotation data.

metabolighteR provides easy access to publicly available MetaboLights studies via the MetaboLights RESTful API. Only API methods which retrieve data (GET) are supported by metabolighteR.

Installation

metabolighteR can be installed from CRAN or, for the latest development version, directly from GitHub using the remotes package.

install.packages('metabolighteR')

remotes::install_github('wilsontom/metabolighteR')

library(metabolighteR)

Querying the Repository

A list of all public study identification codes can be easily retrieved.

all_study_ids <- get_studies()
#> Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame'
#> when loading 'dplyr'

studies <- as.vector(all_study_ids$study)

head(studies)
#> [1] "MTBLS164" "MTBLS394" "MTBLS120" "MTBLS398" "MTBLS405" "MTBLS217"

Generate a summary table containing; Study ID, Study Title and Study Technology, for publicly available studies.

# For the first five studies

study_titles <- purrr::map(studies[1:5], get_study_title)
names(study_titles) <- studies[1:5]

study_titles <- tibble::as_tibble(study_titles) %>% tidyr::gather()
names(study_titles) <- c('STUDY', 'Title')

study_tech <- get_study_tech()

study_tech_filter <- study_tech %>% dplyr::filter(STUDY %in% studies[1:5])

StudyInfoTable <-
  dplyr::left_join(study_titles, study_tech_filter, by = 'STUDY')

StudyInfoTable
#> # A tibble: 5 x 3
#>   STUDY   Title                                     TECH                        
#>   <chr>   <chr>                                     <chr>                       
#> 1 MTBLS1… Searching for metabolic changes in urine… PTR-MS                      
#> 2 MTBLS3… Lipid Data Analyzer: Decision rule set d… HPLC-QTOF-MS;UPLC-QTOF-MS/M…
#> 3 MTBLS1… Metabolomic Discrimination of Near Isoge… UPLC-QTOF-MS/MS             
#> 4 MTBLS3… Lipid Data Analyzer: Discrimination of s… HPLC-LTQ-MS;UPLC-LTQ-MS;UPL…
#> 5 MTBLS4… Proteomic and metabolic changes in cance… HPLC-TQ-MS/MS

Download File Contents

A list of all available files can be generated using the get_study_files function.


studyFileList <- get_study_files(studies[1])

studyFileList
#> # A tibble: 4 x 6
#>   createdAt      directory file                     status timestamp  type      
#>   <chr>          <lgl>     <chr>                    <chr>  <chr>      <chr>     
#> 1 March 10 2017… FALSE     a_vierdagse_urine_metab… active 201703101… metadata_…
#> 2 December 04 2… FALSE     i_Investigation.txt      active 201912041… metadata_…
#> 3 March 10 2017… FALSE     m_vierdagse_urine_metab… active 201703101… metadata_…
#> 4 March 10 2017… FALSE     s_VIERDAGURI.txt         active 201703101… metadata_…

The contents of these files can then be downloaded using the download_file function.


fileContents_A <- download_study_file('MTBLS264', studyFileList$file[1])
#> No encoding supplied: defaulting to UTF-8.

head(fileContents_A)
#> # A tibble: 0 x 1
#> # … with 1 variable:
#> #   X.message..Could.not.find.file.a_vierdagse_urine_metabolite_profiling_mass_spectrometry.txt. <lgl>

fileContents_B <- download_study_file('MTBLS264', studyFileList$file[4])
#> No encoding supplied: defaulting to UTF-8.

head(fileContents_B)
#> # A tibble: 0 x 1
#> # … with 1 variable: X.message..Could.not.find.file.s_VIERDAGURI.txt. <lgl>