diff --git a/.github/workflows/build_deploy.yaml b/.github/workflows/build_deploy.yaml index 741ecf0..9e7d7a2 100644 --- a/.github/workflows/build_deploy.yaml +++ b/.github/workflows/build_deploy.yaml @@ -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: @@ -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: @@ -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 diff --git a/DESCRIPTION b/DESCRIPTION index 78375bd..528dfa1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 = "philippine.louail@eurac.edu", role = c("aut", "cre"), comment = "ORCID: 0009-0007-5429-6846"), + person(given = "Anna", family = "Tagliaferri", + email = "Anna.Tagliaferri@student.unibz.it", + role = "ctb", + comment = "ORCID: 0009-0001-4044-4285"), + person(given = "Vinicius", family = "Verri Hernandes", + email = "vinicius.verri.hernandes@univie.ac.at", + 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 = "Johannes.Rainer@eurac.edu", role = "aut", @@ -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), diff --git a/Dockerfile b/Dockerfile index 1cdf48d..504ebe3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index a6d5075..28dd1de 100644 --- a/README.md +++ b/README.md @@ -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: @@ -18,9 +18,9 @@ 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 @@ -28,17 +28,22 @@ description of the dataset used throughout 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 diff --git a/_pkgdown.yml b/_pkgdown.yml index bf89b9e..0367b97 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -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 @@ -22,5 +24,4 @@ structure: right: - search - github - - lightswitch diff --git a/man/figures/sticker_small.png b/man/figures/sticker_small.png new file mode 100644 index 0000000..28dc7e0 Binary files /dev/null and b/man/figures/sticker_small.png differ diff --git a/vignettes/a-end-to-end-untargeted-metabolomics.qmd b/vignettes/a-end-to-end-untargeted-metabolomics.qmd index 5fa0065..f66c7c2 100644 --- a/vignettes/a-end-to-end-untargeted-metabolomics.qmd +++ b/vignettes/a-end-to-end-untargeted-metabolomics.qmd @@ -14,6 +14,7 @@ vignette: > ```{r setup, include=FALSE} library(knitr) library(quarto) +library(BiocStyle) knitr::opts_knit$set(root.dir = './') ``` @@ -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) @@ -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 diff --git a/vignettes/alignment-to-external-dataset.qmd b/vignettes/alignment-to-external-dataset.qmd index 3c2bdb4..56ff24b 100644 --- a/vignettes/alignment-to-external-dataset.qmd +++ b/vignettes/alignment-to-external-dataset.qmd @@ -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)) +} ``` @@ -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) @@ -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"]] @@ -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", @@ -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 diff --git a/vignettes/dataset-investigation.qmd b/vignettes/dataset-investigation.qmd index f05286a..a204473 100644 --- a/vignettes/dataset-investigation.qmd +++ b/vignettes/dataset-investigation.qmd @@ -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() -``` diff --git a/vignettes/install_v0.qmd b/vignettes/install_v0.qmd index 1066125..f4359e8 100644 --- a/vignettes/install_v0.qmd +++ b/vignettes/install_v0.qmd @@ -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 @@ -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.