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.
metabolighteR can be installed from CRAN or, for the latest development version, directly from GitHub using the remotes
package.
install.packages('metabolighteR')
::install_github('wilsontom/metabolighteR')
remotes
library(metabolighteR)
A list of all public study identification codes can be easily retrieved.
get_studies()
all_study_ids <-#> Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame'
#> when loading 'dplyr'
as.vector(all_study_ids$study)
studies <-
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
purrr::map(studies[1:5], get_study_title)
study_titles <-names(study_titles) <- studies[1:5]
tibble::as_tibble(study_titles) %>% tidyr::gather()
study_titles <-names(study_titles) <- c('STUDY', 'Title')
get_study_tech()
study_tech <-
study_tech %>% dplyr::filter(STUDY %in% studies[1:5])
study_tech_filter <-
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
A list of all available files can be generated using the get_study_files
function.
get_study_files(studies[1])
studyFileList <-
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.
download_study_file('MTBLS264', studyFileList$file[1])
fileContents_A <-#> 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>
download_study_file('MTBLS264', studyFileList$file[4])
fileContents_B <-#> 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>