knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
suppressPackageStartupMessages(library(metabolighteR))

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('aberHRML/metabolighteR')

library(metabolighteR)

Querying the Repository

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

all_study_ids <- get_studies()

studies <- as.vector(all_study_ids$study)

head(studies)

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

Download File Contents

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

studyFileList <- get_study_files('MTBLS264')

studyFileList

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

fileContents_A <- download_study_file('MTBLS264', studyFileList$file[1])

head(fileContents_A)

fileContents_B <- download_study_file('MTBLS264', studyFileList$file[4])

head(fileContents_B)


wilsontom/metabolighteR documentation built on Feb. 27, 2024, 7:58 p.m.