Package 'metabolighteR'

Title: Interface to the 'Metabolights' REST API
Description: Access to the 'Metabolights' REST API <https://www.ebi.ac.uk/metabolights/index>. Retrieve elements of publicly available 'Metabolights' studies.
Authors: Tom Wilson [aut, cre] (ORCID: <https://orcid.org/0000-0003-3112-4682>), Steffen Neumann [ctb] (ORCID: <https://orcid.org/0000-0002-7899-7192>)
Maintainer: Tom Wilson <[email protected]>
License: GPL (>= 3)
Version: 0.1.4
Built: 2026-05-29 09:59:15 UTC
Source: https://github.com/wilsontom/metabolighteR

Help Index


All Public GET Methods

Description

Retrieve a list of all the available public GET methods

Usage

all_get_methods()

Value

a tbl_df of API GET methods


Create a dataframe representing a MAF file

Description

MAF files combine the metabolite abundance matrix, the spectral data like m/z and retention time, and the metabolite names, structures and database identifiers.

Usage

create.MAF(assaytype = "LCMS", nrow = NULL, abundances = NULL)

Arguments

assaytype

Currently unused, but would be used for different MAF files for NMR and MS

nrow

Create the MAF with nrow empty rows.

abundances

is a data frame or matrix with the metabolite abundances, intensities or concentrations.

Details

If an abundance matrix is given, the the generated MAF will have as many (empty) spectral and identification metadata rows as abundance rows, joined to the provided abundance matrix.

nrow and abundances should be mutually exclusive, but that is not yet tested.

Examples

maf <- create.MAF(nrow=17)

Download Study File Contents

Description

Download the contents of a specified file from a public study

Usage

download_study_file(study_id, filename)

Arguments

study_id

a character string of a valid MTBLS study id

filename

a character of the full filename and extension to download

Value

a tibble of file contents


Get ISA Investigation File

Description

Retrieve the ISA Investigation for a specified Metabolights Study

Usage

get_isa_investigation(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

the ISA-tab Investigation output

Examples

## Not run: 
ISA <- get_isa_investigation('MTBLS375')
writeLines(isa_investigation_parse, con = paste0('outpath/ISA.txt'))

## End(Not run)

Get Private Studies

Description

Retrieve all private studies which belong to your user account

Usage

get_private_studies()

Value

a tibble of your private Study IDs

Examples

## Not run: 
get_private_studies()

## End(Not run)

Get Studies

Description

Retrieve a list of all publically available Metabolights studies

Usage

get_studies()

Value

a tibble of Study IDs

Examples

get_studies()

Get Study Assay File

Description

Retrieve the filename details for available assays of a public study

Usage

get_study_assay_file(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a character string of the study assay filename

Examples

get_study_assay_file('MTBLS375')

Get Study Description

Description

Retrieve the abstract based description of a public study

Usage

get_study_assay_list(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a list off the study assays and associated details

Examples

get_study_assay_list('MTBLS375')

Get Study Audit

Description

Retrieve a list of available audit folders for a study

Usage

get_study_audit(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a list of available audit folders

Examples

get_user_studies

Get Study Contacts

Description

Retrieve the contact details for a specified public study '

Usage

get_study_contacts(study_id)

Arguments

study_id

a character string of a valid MTBLS study id

Value

a tibble of study contacts

Examples

get_study_contacts('MTBLS375')

Get Study Description

Description

Retrieve the abstract based description of a public study

Usage

get_study_desc(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a character string of the study description

Examples

get_study_desc('MTBLS375')

Get Study Descriptors

Description

Retrieve the study descriptors and annotation values for a publically available study

Usage

get_study_descriptors(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a tibble of study descriptors

Examples

get_study_descriptors('MTBLS375')

Get Study Factors

Description

Retrieve the study factors and annotation values for a publically available study

Usage

get_study_factors(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a tibble of study factors

Examples

get_study_factors('MTBLS375')

Get Study Files

Description

Retrieve the names and type of all files that have been deposited with the public study. If raw_data is TRUE then details of raw data files(ie, .mzML) are also returned.

Usage

get_study_files(study_id, raw_data = FALSE)

Arguments

study_id

A character string of a valid MTBLS study id

raw_data

logical; if TRUE then raw data file info is also returned. (Default is FALSE)

Value

a tibble of file info

Examples

get_study_files('MTBLS375', raw_data = FALSE)

Get Study Meta

Description

Retrieve the meta data for a publically available study

Usage

get_study_meta(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a tibble of study meta data

Examples

get_study_meta('MTBLS375')

Get Study Organisms

Description

Retrieve the organisms used within a study

Usage

get_study_org(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a tibble of study organism data

Examples

## Not run: 
get_study_org('MTBLS375')

## End(Not run)

Get Study Protocols

Description

Retrieve the protocol information that has been deposited for a public study

Usage

get_study_protocols(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a tibble of study protocols

Examples

get_study_protocols('MTBLS375')

Get Study Publications

Description

Retrieve details on any publications that have been associated with the study

Usage

get_study_pubs(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a tibble of study publications

Examples

get_study_pubs('MTBLS375')

Get Study Samples

Description

Get a list of all sample names mapped to files within the study

Usage

get_study_samples(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a tibble of filename sample name and reliability score. 1.0 indicates a perfect match

Examples

## Not run: 
get_study_samples('MTBLS375')

## End(Not run)

Get Study Technology

Description

Retrieve a tibble of all Study IDs and the analytical technology used in the study

Usage

get_study_tech()

Value

a tibble of study id and technology

Examples

get_study_tech()

Get Study Title

Description

Retrieve the full title of the study

Usage

get_study_title(study_id)

Arguments

study_id

A character string of a valid MTBLS study id

Value

a character string of the study title

Examples

get_study_title('MTBLS375')

Get Studies for User

Description

Retrieve a list of studies for a user

Usage

get_user_studies()

Value

a list of user owned studies

Examples

get_user_studies

Get Web-service details

Description

Retrieve details about the Metabolights RESTful WebService

Usage

get_webservice()

Value

a list of the MTBLS webservice information

Examples

get_webservice()

Set API Token

Description

Set your Metabolights API Token as global option. If MTBLS_API_KEY is set in .Renviron then this variable will be passed directly to the MTBLS_API_KEY option. If no MTBLS_API_KEY is set in .Renviron, then the API Token must be passed as an input in the set_api_token function

Usage

mtbls_key(API_KEY = NULL)

Arguments

API_KEY

a character string of your Metabolights API Token (Default is NULL)

Examples

## Not run: 

# If API Token is set in `.Renviron`

mtbls_key()

# If API Token is not set in `.Renviron`

mtbls_key('XXXX-0000-XXXX-0000')

## End(Not run)

Read MAF file to dataframe

Description

Read the MAF file as data frame.

Usage

read.MAF(file)

Arguments

file

A filename to a MAF file

Value

a data frame. Row and column names are NOT "fixed" via make.names

Examples

file <- system.file("examples/m_MTBLS1968_LC-MS_positive_reverse-phase_metabolite_profiling_v2_maf.tsv",
                    package = "metabolighteR")
maf <- read.MAF(file)

Write a dataframe to a MAF file

Description

Write a suitably formatted data frame to a MAF file.

Usage

write.MAF(maf, file = "")

Arguments

maf

MAF data frame to write

file

either a character string naming a file or a connection open for writing. "" indicates output to the console.

Examples

maf <- create.MAF(nrow=17)
write.MAF(maf, file=tempfile())