This document is the reproducible code for Open Source Spatial Reactomics (OSSpRe) workflow. This workflow is designed to process mass spectrometry imaging (MSI) data from raw data to exploratory data analysis.
We use renv package to restore all the R packages needed for this workflow.
install.packages('renv')
renv::restore()Part 1: Introduction: https://youtu.be/j26o3j2B1FI
Part 2: Installation: https://youtu.be/l_3MuLlQbbc
Part 3: Rmarkdown work-through: https://youtu.be/e_BcrRFrNCA
Part 4: Shiny application: https://youtu.be/W7lre03bUuc
workflow.Rmd: The reproducible R Markdown document for the OSSpRe workflow. It contains all the steps from raw data processing to exploratory data analysis.helper.r: An R script containing helper functions used in the workflow.lipidall.csv: A lipid m/z-CCS annotation database from Metlin and Lipid Atlas.metaall.csv: A metabolomics m/z-CCS annotation database from Metlin.ccs_to_one_over_k0.cpp: A C++ script to convert CCS values to 1/k0.one_over_k0_to_ccs.cpp: A C++ script to convert 1/k0 values to CCS.peak_finder.cpp: A C++ script to find local maximum peaks in the m/z-CCS 2D plane.peakalign.cpp: A C++ script to extract peaks with a reference peak list across pixels.
- Set the path to your raw data: In the
workflow.Rmdfile, change thepathvariable to the path of your.dfolder. - Accept the Bruker EULA: Set
accept_Bruker_EULA_and_on_Windows_or_LinuxtoTRUEto accept the Bruker End User License Agreement. - Run the workflow: You can run the entire workflow by clicking the "Knit" button in RStudio or by running
rmarkdown::render('workflow.Rmd')in the R console. You can also run each code chunk individually to better understand the process.
The OSSpRe workflow consists of the following major steps:
- Raw Data Processing: This step processes the raw MSI data to generate a reference peak list.
- Reference Peak Picking: This step identifies reference peaks from the super pixel data.
- Quantitative Peak List Generation: This step extracts peak intensities for all pixels based on the reference peaks and normalizes the data.
- Qualitative Peak List Generation: This step annotates the peaks using public databases for lipids and metabolites.
- Exploratory Data Analysis: This step includes data summary, peak statistics, visualization, segmentation, ion clustering, and reactomics analysis.
For large datasets, it is recommended to run the workflow on a High-Performance Computing (HPC) cluster. The following scripts are provided for HPC usage:
refpeakpicking.R: An R script to extract reference peaks from a super pixel.peakpicking.R: An R script to extract peak profiles with a reference peak list.msi.job: A Slurm job script for the peak picking process.
Please check the code and update the paths for your own data.
OSSpRe workflow is also available through the xcmsrocker project.
- Install Docker and run it on your system.
- Pull the image from DockerHub:
docker pull yufree/deepspace:latest - Run the image:
docker run -e PASSWORD=xcmsrocker -p 8787:8787 yufree/xcmsrocker - Open your browser and go to
http://localhost:8787orhttp://[your-ip-address]:8787. - Log in to RStudio Server with username
rstudioand passwordxcmsrocker. - To use the OSSpRe workflow, go to
File -> New File -> R Markdown..., selectFrom Template, chooseMass Spectrometry Imaging Workflow, and clickOK.