Skip to content

Commit

Permalink
Update Vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
jorainer committed Sep 5, 2024
1 parent 2adadcf commit e9d77fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

on:
push:
pull_request:
paths-ignore:
- 'README.md'

name: R-CMD-check-bioc

Expand Down
33 changes: 22 additions & 11 deletions vignettes/MsBackendMetaboLights.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ use of different *backends* to import MS data from a variety of sources and data
formats. The *MsBackendMetaboLights* package allows to retrieve MS data files
directly from the [MetaboLights](https://www.ebi.ac.uk/metabolights/)
repository. MetaboLights is one of the main public repositories for deposition
of metabolomics experiments including (raw) MS and/or NMR data files and
experimental and analytical results. The *MsBackendMetaboLights* package
of metabolomics experiments including (raw) MS and/or NMR data files and the
related experimental and analytical results. The *MsBackendMetaboLights* package
downloads and locally caches MS data files for a MetaboLights data set and
enables further analyses of this data directly in R.


# Installation

To install this package, start `R` and enter:
The package can be installed directly from within R with the few commands below:

```{r, eval = FALSE}
if (!requireNamespace("BiocManager", quietly = TRUE))
Expand All @@ -50,7 +50,6 @@ if (!requireNamespace("BiocManager", quietly = TRUE))
BiocManager::install("RforMassSpectrometry/MsBackendMetaboLights")
```

This will install this package and all eventually missing dependencies.


# Importing MS Data from MetaboLights
Expand All @@ -64,20 +63,22 @@ analyzed and at least one *assay* file that links between the experimental
samples and the (raw and processed) data files with quantification of
metabolites/features in these samples.

In this vignette we explore and load a MS data files from a small MetaboLights
In this vignette we explore and load MS data files from a small MetaboLights
experiment. MetaboLights provides information on a data set/experiment as a set
of plain text files in *ISA-tab* format. These consist generally of a file with
of plain text files in *ISA-tab* format. These can be accessed and read from the
data set's ftp folder. The set of files consist generally of a file with
information on the experiment/investigation (in a file with the file name
starting with *i_*) the samples of the data set (file name starting with *s_*),
the *assay* (measurements/analysis) of the experiment and a file with quantified
metabolite abundances (file name starting with *m_*). Note that a data set can
have more than one assay file.

Below we list all files from the MetaboLights data set with the ID MTBLS39.
Below we list all files from the MetaboLights data set with the ID *MTBLS39*.

```{r}
library(MsBackendMetaboLights)
#' List files of a MetaboLights data set
all_files <- mtbls_list_files("MTBLS39")
```

Expand All @@ -89,8 +90,10 @@ the ftp path for our test data set.
mtbls_ftp_path("MTBLS39")
```

The MS data files of a MetaboLights data set are defined in the assay data
file(s) that we load below.
We could inspect the content of this folder also using a browser supporting the
ftp file transfer protocol and also download the files. We can however access
the files also directly from within R. Below we read the *assay* data file
directly using the `read.table()` function.

```{r}
#' Get the assay files of the data set
Expand Down Expand Up @@ -123,15 +126,20 @@ Note that providing MS data files is not absolutely mandatory, thus, for some
data sets no MS data files might be available. For this particular data set the
MS data files are provided in the `"Raw Spectral Data File"` column. These files
are in CDF format and can hence be loaded using the `MsBackendMetaboLights`
backend into R as a `Spectra` object. By default, all MS data files of all
backend into R as a `Spectra` object (`MsBackendMetaboLights` directly extends
*Spectra*'s `MsBackendMzR` backend and therefore supports import of MS data
files in mzML, CDF or mzXML formats). By default, all MS data files of all
assays would be retrieved, but in our example below we restrict to few files to
reduce the amount of data that needs to be downloaded. We define for that a
pattern matching the file name of only some data files using the `filePattern`
parameter. In our case we load all MS data files that end with *63A.cdf*.
parameter. Alternatively, for data sets with more than one assay, it would also
be possible to select MS data files from one particular assay only using the
`assayId` parameter. In our case we load all MS data files that end with *63A.cdf*.

```{r}
library(Spectra)
#' Load MS data files of one data set
s <- Spectra("MTBLS39", filePattern = "63A.cdf",
source = MsBackendMetaboLights())
s
Expand Down Expand Up @@ -166,6 +174,9 @@ spectraData(s, c("mtbls_id", "mtbls_assay_name",
"derived_spectral_data_file"))
```

These variables can also be used to e.g. link the individual spectra back to the
original sample (e.g. through the *assay* and *sample* tables of the
MetaboLights data set.


# Session information
Expand Down

0 comments on commit e9d77fc

Please sign in to comment.