Sovereign 8s.is mirror of standardgalactic/fluxNotebooks
  • Jupyter Notebook 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-04-07 07:23:13 +02:00
PH-LCMS initial commit with the first xcms sample script 2022-05-31 16:58:56 +03:00
spectra-convert initial commit with the first xcms sample script 2022-05-31 16:58:56 +03:00
LICENSE Create LICENSE 2023-08-12 19:37:31 +02:00
README.md extended documentation added 2026-04-07 07:23:13 +02:00

An example notebook for analysis of flux changes from raw LCMS data.

Convert spectra

Before running notebooks, spectra must be converted to mzML. Thermo RAW spectra can be converted using thermorawfileparser as shown in [spectra-convert/convert.sh].

PH-LCMS

Phenylhydrazine derivatives of ketoacids are analyzed on Thermo Exactive HF. LCMS settings are attached in TXT and instrument format.

flux-an-xcms-ms1.ipynb is an R-based Jupyter notebook for metabolic flux analysis using 13C-labeled metabolomics data, specifically targeting pyruvate and alpha-ketoglutarate (α-KG) via MS1 mass spectrometry with XCMS library. Here's how to use it:

Purpose

The notebook analyzes isotopomer distributions from 13C-labeled metabolites (pyruvate and α-KG) in LC-MS/MS data, comparing experimental (D) versus control (m/M) conditions to study changes in metabolic flux.

Requirements

R Libraries

You need the following R packages installed before running the notebook:

  • xcms — core MS data processing
  • enviPat — theoretical isotope pattern generation
  • ggplot2, ggtext, ggRColorBrewer, gridExtra, pheatmap — visualization
  • dplyr, reshape2, magrittr, stringr — data manipulation

Input Data

The notebook expects .mzML files located at a path like data/com/con1/ketoacids/mzml/sc13*. Files are named according to the condition following a certain pattern.

Workflow Steps

  1. Load libraries — Run the first cell to import all required R packages.
  2. Define file sources — We use Sys.glob() to locate and list all .mzML files. Update the glob pattern to point to your own data directory.
  3. Assign sample conditions — The fileConds vector maps each file to a condition label (d1–d4, D1–D6, m1–m6, M1–M6). Adjust these to match your experimental design.
  4. Compute theoretical isotope patterns — The notebook uses enviPat::isopattern() to calculate expected 13C isotopomer distributions for pyruvate (C9H9O2N2) and α-KG (C11H11O4N2). Note that we used phenylhydrazine derivatives.
  5. Load and filter MS data — readMSData() from xcms reads the .mzML files in onDisk mode. Scans are then filtered by the scanWindowLowerLimit/scanWindowUpperLimit for the relevant m/z windows (e.g., 176–180 for pyruvate, 234–238 for α-KG).
  6. Extract chromatograms — The helper function genChrom() converts XCMS chromatogram objects into ggplot2-compatible data frames for visualization.
  7. Quantify isotopomer peaks — genPData() extracts peak areas for each isotopomer (M+0, M+1, M+2, …) across all samples by matching m/z windows from the theoretical patterns.
  8. Plot isotopomeric distributions — preparePlotImer() normalizes the data relative to M+0 and formats it for bar or line plots comparing measured vs. theoretical distributions across conditions.
  9. Pyruvate analysis — Repeat steps 5–8 for pyruvate specifically, using the left and right chromatographic peaks (it is known to come as two peaks due two unknown reasons) at its retention time.
  10. Alpha-KG analysis — Repeat the same pipeline for α-KG in the 234–238 m/z window.

Key Parameters to Customize

Parameter Description
fileSrc glob pattern Path to your .mzML files
fileConds Condition labels per file
mzr (m/z range) Adjust per compound
nMeres Number of isotopomers to analyze (e.g., 3 for M0–M2)
threshold Mass tolerance in Da (default: 0.002)

Shield: CC BY 4.0

This work is licensed under a Creative Commons Attribution 4.0 International License.

CC BY 4.0