Skip to content

Commit

Permalink
Merge pull request #5 from rformassspectrometry/phili
Browse files Browse the repository at this point in the history
Small updates
  • Loading branch information
philouail authored Oct 21, 2024
2 parents d8dde1f + 5d8f1ac commit be4e82b
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 85 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/build_deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: pkgdown

on:
push:
branches:
- jomain

# on:
# repository_dispatch:
# types: [trigger-workflow-2]
on:
repository_dispatch:
types: [trigger-workflow-2]

jobs:
build-and-deploy:
Expand All @@ -32,10 +28,10 @@ jobs:
- name: Verify Quarto Installation
run: quarto --version

- name: Install rcmdcheck
run: |
install.packages('rcmdcheck')
shell: Rscript {0}
#- name: Install rcmdcheck
# run: |
# install.packages('rcmdcheck')
# shell: Rscript {0}

# - name: Check
# env:
Expand All @@ -54,10 +50,6 @@ jobs:
install.packages('pkgdown')
shell: Rscript {0}

# - name: Install package
# if: github.ref == 'refs/heads/main'
# run: R CMD INSTALL .

- name: Build site
env:
QUARTO_PRINT_STACK: true
Expand Down
16 changes: 14 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
Package: metabonaut
Title: Exploring and Analyzing LC-MS Data
Version: 0.0.1
Version: 0.0.2
Authors@R:
c(person(given = "Philippine", family = "Louail",
email = "[email protected]",
role = c("aut", "cre"),
comment = "ORCID: 0009-0007-5429-6846"),
person(given = "Anna", family = "Tagliaferri",
email = "[email protected]",
role = "ctb",
comment = "ORCID: 0009-0001-4044-4285"),
person(given = "Vinicius", family = "Verri Hernandes",
email = "[email protected]",
role = "ctb",
comment = "ORCID: 0000-0002-3057-6460"),
person(given = "Daniel", family = "Marques de Sá e Silva",
role = "ctb",
comment = "ORCID: 0000-0002-9674-042X"),
person(given = "Johannes", family = "Rainer",
email = "[email protected]",
role = "aut",
Expand All @@ -18,7 +29,8 @@ Encoding: UTF-8
LazyData: false
Roxygen: list(markdown = TRUE)
Depends:
R (>= 4.3)
R (>= 4.3),
BiocParallel (>= 1.8.0)
Suggests:
MsCoreUtils,
xcms (>= 4.1.5),
Expand Down
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ RUN gdebi --non-interactive quarto-linux-amd64.deb
RUN mkdir -p /shared/data

## Install the required packages
RUN Rscript -e "BiocManager::install(c('RCurl', 'xcms', 'MsExperiment', 'SummarizedExperiment', \
'Spectra', 'MetaboCoreUtils', 'limma', 'matrixStats', 'pander', 'RColorBrewer', \
'pheatmap', 'vioplot', 'ggfortify', 'gridExtra', 'AnnotationHub', 'CompoundDb', \
'MetaboAnnotation', 'RforMassSpectrometry/MsIO', 'RforMassSpectrometry/MsBackendMetaboLights', 'quarto'), \
ask = FALSE, dependencies = TRUE)" && \
Rscript -e "BiocManager::install('sneumann/xcms', ref = 'phili', ask = FALSE)"
RUN Rscript -e "BiocManager::install(c('RforMassSpectrometry/MsIO', 'RforMassSpectrometry/MsBackendMetaboLights'), ask = FALSE, dependencies = TRUE)"

## Install the current package with vignettes
RUN Rscript -e "devtools::install('.', dependencies = TRUE, type = 'source', build_vignettes = FALSE)"
RUN Rscript -e "devtools::install('.', dependencies = TRUE, type = 'source', build_vignettes = FALSE, repos = BiocManager::repositories())"

USER rstudio

Expand Down
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@


# Let's explore and learn to analyze untargeted metabolomics data
## Let's explore and learn to analyze untargeted metabolomics data

[![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc/4.0/)

![metabonaut](man/figures/sitcker_draft.png)
![metabonaut](man/figures/sitcker_small.png)

Welcome to **Metabonaut**! :astronaut:

Expand All @@ -18,27 +18,32 @@ The primary workflow is the

The full R code for all examples, along with detailed descriptions, is available
in the
[end-to-end-untargeted-metabolomics.Rmd](https://rformassspectrometry.github.io/metabonaut/vignettes/end-to-end-untargeted-metabolomics.Rmd)
[end-to-end-untargeted-metabolomics.qmd](https://rformassspectrometry.github.io/metabonaut/vignettes/a-end-to-end-untargeted-metabolomics.qmd)
file. This file can be opened in RStudio, allowing you to execute each individual
R command (see the section below for additional required R packages).
R command.

Other vignettes on this website are interlinked, and you can find a detailed
description of the dataset used throughout
[here](https://rformassspectrometry.github.io/metabonaut/articles/dataset-investigation.html).

We strive for reproducibility. These workflows are designed to remain stable
over time, allowing you to run all the vignettes together as one comprehensive
"super-vignette."
"super-vignette". Any **major** change will be document here and for smaller updates
check the [News](https://rformassspectrometry.github.io/metabonaut/news/index.html)

## Important Notes
## For R beginners

The tutorials provided assume that users have basic knowledge of R and RMarkdown.
If you're unfamiliar with either, we recommend completing a short tutorial to help
you test the code and adapt it to your data. For RMarkdown, click
[here](https://bookdown.org/yihui/rmarkdown/). For R, check out
[this](https://learn-r.org/) or try an interactive course
you test the code and adapt it to your data.
The vignettes are written in Quarto format, to learn more about this go [here](https://quarto.org/docs/guide/),
this is a farily new format, and some functionallity are shared with the [RMarkdown](https://bookdown.org/yihui/rmarkdown/) format, therefore
learning about it can be usefull to you too.

For basic R course and documentation, I would recommand to check out
[this website](https://learn-r.org/) or try an interactive course
[here](https://swirlstats.com/students.html) for a fun introduction to basic R
programming.
programming. This [cheatsheet](https://github.com/wurli/r-best-practice) could also be of help.

## Known Issues

Expand Down
9 changes: 5 additions & 4 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
url: https://rformassspectrometry.github.io/metabonaut/
template:
bootstrap: 5
bootswatch: flatly
light-switch: yes
bslib:
bootswatch: lux
pkgdown-nav-height: 100px
navbar:
bg: dark
title: Metabonaut
left:
- text: Installation instruction
href: articles/install_v0.html
- text: Vignettes
- text: Workflows
menu:
- text: 'Dataset investigation: What to do when you get your data'
href: articles/dataset-investigation.html
Expand All @@ -22,5 +24,4 @@ structure:
right:
- search
- github
- lightswitch

Binary file added man/figures/sticker_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 7 additions & 12 deletions vignettes/a-end-to-end-untargeted-metabolomics.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ vignette: >
```{r setup, include=FALSE}
library(knitr)
library(quarto)
library(BiocStyle)
knitr::opts_knit$set(root.dir = './')
```

Expand Down Expand Up @@ -42,10 +43,6 @@ and general tips on what should be done when you first get your data.
Our workflow is therefore based on the following dependencies:

```{r packages-used, message=FALSE, warning=FALSE}
## General bioconductor package
library(BiocStyle)
library(knitr)
## Data Import and handling
library(readxl)
library(MsExperiment)
Expand Down Expand Up @@ -114,18 +111,16 @@ configured through the `r Biocpkg("BiocParallel")` Bioconductor package. With
the code below we use a *fork-based* parallel processing on unix system, and a
*socket-based* parallel processing on the Windows operating system.

```{r par-process, eval = FALSE}
register(SerialParam())
```{r par-process, message=FALSE, warning=FALSE}
#' Set up parallel processing using 2 cores
## if (.Platform$OS.type == "unix") {
## register(MulticoreParam(2))
## } else {
## register(SnowParam(2))
## }
if (.Platform$OS.type == "unix") {
register(MulticoreParam(2))
} else {
register(SnowParam(2))
}
```


# Data organisation

The experimental data is now represented by a `MsExperiment` object from the
Expand Down
27 changes: 14 additions & 13 deletions vignettes/alignment-to-external-dataset.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ library(MsBackendMetaboLights)
library(xcms)
library(MsExperiment)
library(Spectra)
library(vioplot)
```

Setting parallel processing to improve the efficiency of the process:

```{r, message=FALSE, warning=FALSE}
register(SerialParam())
#' Set up parallel processing using 2 cores
## if (.Platform$OS.type == "unix") {
## register(MulticoreParam(2))
## } else {
## register(SnowParam(2))
## }
if (.Platform$OS.type == "unix") {
register(MulticoreParam(2))
} else {
register(SnowParam(2))
}
```

Expand Down Expand Up @@ -242,7 +242,7 @@ ref_vs_obs <- matchedRtimes(param)
Now we can adjust the retention time of the LC-MS/MS dataset using the
`adjustRtime()` function.

```{r}
```{r warning=FALSE}
#' input into `adjustRtime()`
lcms2 <- adjustRtime(lcms2, param = param)
lcms2 <- applyAdjustedRtime(lcms2)
Expand Down Expand Up @@ -329,6 +329,8 @@ To quantitatively assess the quality of the alignment, we compute the distance
between the chromatographic peaks in our LC-MS data and the anchor peaks (Lamas)
both before and after the alignment.

library(vioplot)

```{r}
# Extract data for sample 3 directly
ref_obs_sample_1 <- ref_vs_obs[["1"]]
Expand All @@ -347,8 +349,7 @@ distances <- data.frame(
# Set factor levels for Alignment to ensure correct order
distances$Alignment <- factor(distances$Alignment, levels = c("Before", "After"))
# Plot the violin plot
library(vioplot)
# Plot distances between anchor peaks between the two runs before and after alignment.
vioplot(Distance ~ Alignment, data = distances, xlab = "",
rectCol = "#c4114580",
lineCol = "white",
Expand All @@ -367,15 +368,15 @@ peaks in the file. Additionally, it is feasible to directly `plot()` the `param`
object for the file of interest, showcasing the distribution of these
chromatographic peaks along with the fitted model line.

```{r}
#' access summary of matches and model information
```{r warning=FALSE}
#' Access summary of matches and model information
summary <- summarizeLamaMatch(param)
summary
#' coverage for each file
#' Coverage for each file
summary$Matched_peaks / summary$Total_peaks * 100
#' access the information on the model of for the first file
#' Access the information on the model of for the first file
summary$Model_summary[[1]]
#' Plot obs vs. lcms1 with fitting line
Expand Down
6 changes: 0 additions & 6 deletions vignettes/dataset-investigation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,3 @@ separation was achieved using hydrophilic interaction liquid chromatography
quality.
- Compare pool lc-ms and pool lc-ms/ms and show that we have better separation
on the second run.

```{r}
getwd()
list.files()
list.dirs()
```
42 changes: 26 additions & 16 deletions vignettes/install_v0.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,29 @@ vignette: >
For manual installation, an [R](https://www.r-project.org/) version \>= 4.4.0 is
required.

# Install packages required for metabonaut tutorials
[Notes]{.underline}: only a development version of `metabonaut` is available as
of now but a stable version will come soon. Therefore, if you are having
difficulty to run some part of the code we strongly recommend to use the Docker
image, as it will have all the package necessary to run all the analysis
presented in these workflows.

Notes: only a development version of metabonaut is available as of now but a
stable version will come soon.
# Running workflows locally

The following packages need to be installed for proper functioning of the
tutorials:
To install on your computer all the packages necessary for the workflows run the
code as follow:

Run the code as follow:
BiocManager::install("rformassspectrometry/metabonaut",

dependencies = TRUE, ask = FALSE, update = TRUE)

```{r eval=FALSE}
install.packages("BiocManager")
BiocManager::install(c('RCurl', 'xcms', 'MsExperiment', 'SummarizedExperiment',
'Spectra', 'MetaboCoreUtils', 'limma', 'matrixStats', 'pander',
'RColorBrewer', 'pheatmap', 'vioplot', 'ggfortify', 'gridExtra',
'AnnotationHub', 'CompoundDb', 'MetaboAnnotation',
'RforMassSpectrometry/MsIO', 'RforMassSpectrometry/MsBackendMetaboLights'))
## Packa
BiocManager::install(c('RforMassSpectrometry/MsIO', 'RforMassSpectrometry/MsBackendMetaboLights'), ask = FALSE, dependencies = TRUE)
BiocManager::install("rformassspectrometry/metabonaut",
dependencies = TRUE, ask = FALSE, update = TRUE)
```

# Docker image
Expand All @@ -45,16 +51,20 @@ code and examples from the vignettes can be evaluated within this environment
installation information [here](https://docs.docker.com/desktop/).
- Get the [docker
image](https://hub.docker.com/r/rformassspectrometry/metabonaut) of this
tutorial e.g. from the command line with
`docker pull rformassspectrometry/metabonaut:latest`.
tutorial e.g. from the command line with:

```
docker pull rformassspectrometry/metabonaut:latest
```

- Start the docker container, either through the Docker Desktop, or on the
command line with

```
docker run -e PASSWORD=bioc -p 8787:8787 rformassspectrometry metabonaut:latest
docker run -e PASSWORD=bioc -p 8787:8787 rformassspectrometry/metabonaut:latest
```

- Enter [`http://localhost:8787`](http://localhost:8787) in a web browser and
log in with username `rstudio` and password `bioc`.
- In the RStudio server version: open any of the R-markdown (*.Rmd*) files in
the *vignettes* folder and evaluate the R code blocks in that document.
- In the RStudio server version: open any of the Quarto files in the
*vignettes* folder and evaluate the R code blocks in that document.

0 comments on commit be4e82b

Please sign in to comment.