Subir archivos a "/"
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
title: "A scalable deep learning workflow for mass spectrometry imaging: benchmarking Julia-Python hybrid processing across multi-instrument datasets"
|
title: "A scalable deep learning workflow for mass spectrometry imaging: benchmarking Julia-Python hybrid processing across multi-instrument datasets"
|
||||||
bibliography: zotero.bib
|
bibliography: zotero.bib
|
||||||
abstract: |
|
abstract: |
|
||||||
Mass spectrometry imaging (MSI) generates terabyte-scale datasets whose analysis is increasingly bottlenecked by software rather than instrumentation. Most MSI processing pipelines are written in interpreted languages whose memory and speed limits scale poorly with next-generation instruments, and the deep learning ecosystem needed for modern unsupervised analysis lives almost entirely in Python. We present an open-source hybrid Julia-Python workflow that resolves this: a Julia engine performs all high-throughput preprocessing — memory-mapped imzML parsing, peak picking, ion image extraction, TrIQ normalization, and PNG export of every ion map in a single pass — and hands a clean, file-based corpus to a Python self-supervised (SimCLR) convolutional encoder for representation learning and clustering. We benchmark the Julia preprocessing stage on an equalized per-stage workload (imzML load and one ion slice generation at each dataset's reference *m/z*) against Cardinal (R/Bioconductor) and MALDIquant (R) on seven public datasets spanning 0.07–4.4 GB (LD-LTP, AP-SMALDI, MALDI, DESI), covering both centroid and profile acquisitions. Under this equalized workload, the Julia engine generates an ion slice up to two orders of magnitude faster than Cardinal on every dataset and materially faster than MALDIquant, while its memory-mapped loader keeps peak load RAM at only 7–84 MB (lower than Cardinal's lazy loader on all seven datasets) and it completes the additional normalization and export steps within the same memory envelope, all orchestrated by a single reproducible entry point. The Python layer learns a 128-dimensional latent space from the exported ion corpus and clusters the ions into spatially coherent metabolic domains; we detail the algorithmic choices — Group Normalization, gradient accumulation for consumer GPUs, chemical-noise augmentation, and spherical K-Means — that make the deep learning stage tractable on big, zero-padded MSI data. The complete environment is containerized with Docker and released under a permissive license, so the entire analysis — from raw imzML to trained embeddings — is fully reproducible on any hardware. As a demonstration of the workflow's biological utility, we apply it to *Datura innoxia* leaves and roots (2.0 GB and 2.5 GB): self-supervised segmentation recovers spatially coherent metabolic domains that resolve the tropane alkaloid biosynthetic and transport architecture of the tissue.
|
Mass spectrometry imaging (MSI) generates terabyte-scale datasets whose analysis is increasingly bottlenecked by software rather than instrumentation. Most MSI processing pipelines are written in interpreted languages whose memory and speed limits scale poorly with next-generation instruments, and the deep learning ecosystem needed for modern unsupervised analysis lives almost entirely in Python. We present an open-source hybrid Julia-Python workflow that resolves this: a Julia engine performs all high-throughput preprocessing — memory-mapped imzML parsing, peak picking, ion image extraction, TrIQ normalization, and PNG export of every ion map in a single pass — and hands a clean, file-based corpus to a Python self-supervised (SimCLR) convolutional encoder for representation learning and clustering. We benchmark the Julia preprocessing stage on an equalized per-stage workload (imzML load and one ion slice generation at each dataset's reference *m/z*) against Cardinal (R/Bioconductor) and MALDIquant (R) on seven public datasets spanning 0.07–4.4 GB (LD-LTP, AP-SMALDI, MALDI, DESI), covering both centroid and profile acquisitions. Under this equalized workload, the Julia engine generates an ion slice up to two orders of magnitude faster than Cardinal on every dataset and materially faster than MALDIquant, while its memory-mapped loader keeps peak load RAM at only 7–84 MB (lower than Cardinal's lazy loader on all seven datasets) and it completes the additional normalization and export steps within the same memory envelope, all orchestrated by a single reproducible entry point. The Python layer learns a 128-dimensional latent space from the exported ion corpus and clusters the ions into spatially coherent metabolic domains; we detail the algorithmic choices (Group Normalization, gradient accumulation for consumer GPUs, chemical-noise augmentation, and spherical K-Means) that make the deep learning stage tractable on big, zero-padded MSI data. The complete environment is containerized with Docker and released under a permissive license, so the entire analysis (from raw imzML to trained embeddings) is fully reproducible on any hardware. As a demonstration of the workflow's biological utility, we apply it to *Datura innoxia* leaves and roots (2.0 GB and 2.5 GB): self-supervised segmentation recovers spatially coherent metabolic domains that resolve the tropane alkaloid biosynthetic and transport architecture of the tissue.
|
||||||
keywords: mass spectrometry imaging, Julia language, Python, hybrid pipeline, benchmark, peak RAM, reproducibility, Docker, deep learning, SimCLR, contrastive learning, spatial metabolomics
|
keywords: mass spectrometry imaging, Julia language, Python, hybrid pipeline, benchmark, peak RAM, reproducibility, deep learning, SimCLR, contrastive learning, spatial metabolomics
|
||||||
---
|
---
|
||||||
|
|
||||||
# Introduction
|
# Introduction
|
||||||
@@ -110,6 +110,24 @@ We implemented a Contrastive Learning (SimCLR) scheme in PyTorch [@paszke_pytorc
|
|||||||
|
|
||||||
To demonstrate the biological utility of the workflow, we acquired an MSI dataset from a *Datura innoxia* leaf, a medicinal plant whose root-biosynthesized tropane alkaloids are transported to the shoot [@schlesinger_tropane_2021], and whose imaging has previously been pursued with laser desorption low-temperature plasma (LD-LTP) techniques [@moreno-pedraza_elucidating_2019]. We performed imaging using an LD-LTP-MSI system coupled to an LCQ Fleet Ion Trap mass spectrometer (Thermo Scientific). The custom ionization source consisted of a Low-Temperature Plasma (LTP) probe [@harper_low-temperature_2008] and a continuous-wave violet laser (400–450 nm, 1.0 W). The LTP probe was operated with helium (0.1 L/min) at 3.3 kV and ~13 kHz, positioned at a 45° angle and 4 mm from the ion transfer capillary [@martinez-jarquin_low-temperature_2017]. The laser was oriented at 90° to the sample surface at a focal distance of 9 cm, producing a spot size of ~22 µm. We acquired data in positive ion mode (*m/z* 50–700) with a spatial resolution of 150 µm for the leaf sample.
|
To demonstrate the biological utility of the workflow, we acquired an MSI dataset from a *Datura innoxia* leaf, a medicinal plant whose root-biosynthesized tropane alkaloids are transported to the shoot [@schlesinger_tropane_2021], and whose imaging has previously been pursued with laser desorption low-temperature plasma (LD-LTP) techniques [@moreno-pedraza_elucidating_2019]. We performed imaging using an LD-LTP-MSI system coupled to an LCQ Fleet Ion Trap mass spectrometer (Thermo Scientific). The custom ionization source consisted of a Low-Temperature Plasma (LTP) probe [@harper_low-temperature_2008] and a continuous-wave violet laser (400–450 nm, 1.0 W). The LTP probe was operated with helium (0.1 L/min) at 3.3 kV and ~13 kHz, positioned at a 45° angle and 4 mm from the ion transfer capillary [@martinez-jarquin_low-temperature_2017]. The laser was oriented at 90° to the sample surface at a focal distance of 9 cm, producing a spot size of ~22 µm. We acquired data in positive ion mode (*m/z* 50–700) with a spatial resolution of 150 µm for the leaf sample.
|
||||||
|
|
||||||
|
## Benchmark Datasets: MALDI-TOF MSI of Mouse Liver and Stomach on Bruker neoFlex
|
||||||
|
|
||||||
|
The mouse liver (2.2 GB) and mouse stomach (4.4 GB) datasets were acquired on a Bruker neoFlex MALDI-TOF mass spectrometer (Bruker Daltonics) at the Biomolecular Analysis Facility Core, W.M. Keck Biomedical Mass Spectrometry Laboratory, University of Virginia School of Medicine. Liver and stomach tissues were obtained from mice and, after being washed with 1× PBS, were embedded in a mold with 20% fish gelatin and frozen on dry ice. They were subsequently transferred to −20 °C for one hour and stored at −80 °C until use. Sectioning was performed on a microtome cryostat equipped with a blade holder (Epredia CryoStar NX50 OP 957250), and the sections were carefully mounted using a fine paintbrush to pull the tissues onto an Intelligent Slide previously cooled to −15 °C.
|
||||||
|
|
||||||
|
The DHB matrix (2,5-dihydroxybenzoic acid) was applied to both tissues using the Bruker method on an HTX Imaging M3+ Sprayer. Briefly, the method consists of dissolving 15 mg/mL of DHB in 90% ACN / 0.1% TFA, with a flow rate of 125 µL/min, 14 passes in a criss-cross pattern, and a pressure of 10 psi. Subsequently, the slides were dried in a vacuum desiccator for 40 minutes before data acquisition on the neoFlex.
|
||||||
|
|
||||||
|
The parameters used on the neoFlex for data acquisition were as follows:
|
||||||
|
|
||||||
|
- Laser power: 35%
|
||||||
|
- Laser shots per pixel: 2000
|
||||||
|
- Laser frequency: 10,000 Hz
|
||||||
|
- Acquisition mode: Reflector
|
||||||
|
- Polarity: Positive
|
||||||
|
- Mass range: 400–1400 *m/z*
|
||||||
|
- Spatial resolution: 20 µm
|
||||||
|
- External calibration: Red phosphorus using the Bruker method RedP_Positive_0_to_2000
|
||||||
|
- Acquisition method: Bruker Imaging_Lipids_pos_R.par
|
||||||
|
|
||||||
# Results and Discussion
|
# Results and Discussion
|
||||||
|
|
||||||
## Computational Benchmark: Julia vs Cardinal and MALDIquant Across Seven Datasets
|
## Computational Benchmark: Julia vs Cardinal and MALDIquant Across Seven Datasets
|
||||||
@@ -171,6 +189,10 @@ In keeping with the open-science philosophy that motivates this work, all code i
|
|||||||
|
|
||||||
The complete computational environment is containerized: the Docker image pins the Julia package set, the Python virtual environment, the R/Bioconductor stack, and all system-level dependencies. Building the image and running the container reproduces every figure, table, and quantitative result reported here on any host with Docker, without manual installation or version resolution. All seven benchmark datasets are public: the LD-LTP *Datura* leaf and root, the MALDI San Pedro cactus, the MALDI mouse liver and mouse stomach, the AP-SMALDI mouse bladder, and the DESI human colon datasets, with access instructions in the repository. All raw data, intermediate artifacts, and figures are archived for long-term access.
|
The complete computational environment is containerized: the Docker image pins the Julia package set, the Python virtual environment, the R/Bioconductor stack, and all system-level dependencies. Building the image and running the container reproduces every figure, table, and quantitative result reported here on any host with Docker, without manual installation or version resolution. All seven benchmark datasets are public: the LD-LTP *Datura* leaf and root, the MALDI San Pedro cactus, the MALDI mouse liver and mouse stomach, the AP-SMALDI mouse bladder, and the DESI human colon datasets, with access instructions in the repository. All raw data, intermediate artifacts, and figures are archived for long-term access.
|
||||||
|
|
||||||
|
# Funding
|
||||||
|
|
||||||
|
This work was supported by the University of Virginia's School of Medicine grant to the Biomolecular Analysis Facility Core and W.M. Keck Biomedical Mass Spectrometry Laboratory (RRID:SCR_025476).
|
||||||
|
|
||||||
# Conclusion
|
# Conclusion
|
||||||
|
|
||||||
The equalized benchmark against Cardinal (R/Bioconductor) and MALDIquant (R) — identical per-stage workloads on the same hardware across seven public datasets spanning 0.07 to 4.4 GB — shows that the Julia engine generates ion slices one to two orders of magnitude faster than Cardinal on every dataset (0.00009--0.32 s vs 6.3--19.5 s, 54- to 79,949-fold) while keeping peak load resident memory (VmRSS) at 7--84 MB, lower than Cardinal's ~120 MB and far below MALDIquant's up to 4.0 GB, and it completes the additional normalization and export steps within the same memory envelope. We report the per-stage timings transparently, including where the R ecosystem is competitive (Cardinal's eager load is faster in wall time on the larger files), and we note that MALDIquant exhausted the reference machine on the two heaviest datasets. This decoupling of peak RAM from on-disk file size is what makes the workflow scale from commodity laptops to GPU-equipped workstations, and the containerized environment and permissive open-source license allow any researcher to rebuild the entire analysis — from raw imzML to trained embeddings and final segmentation — on any hardware.
|
The equalized benchmark against Cardinal (R/Bioconductor) and MALDIquant (R) — identical per-stage workloads on the same hardware across seven public datasets spanning 0.07 to 4.4 GB — shows that the Julia engine generates ion slices one to two orders of magnitude faster than Cardinal on every dataset (0.00009--0.32 s vs 6.3--19.5 s, 54- to 79,949-fold) while keeping peak load resident memory (VmRSS) at 7--84 MB, lower than Cardinal's ~120 MB and far below MALDIquant's up to 4.0 GB, and it completes the additional normalization and export steps within the same memory envelope. We report the per-stage timings transparently, including where the R ecosystem is competitive (Cardinal's eager load is faster in wall time on the larger files), and we note that MALDIquant exhausted the reference machine on the two heaviest datasets. This decoupling of peak RAM from on-disk file size is what makes the workflow scale from commodity laptops to GPU-equipped workstations, and the containerized environment and permissive open-source license allow any researcher to rebuild the entire analysis — from raw imzML to trained embeddings and final segmentation — on any hardware.
|
||||||
@@ -179,4 +201,4 @@ On the deep learning side, we have shown how the Python stage is engineered for
|
|||||||
|
|
||||||
# Acknowledgments
|
# Acknowledgments
|
||||||
|
|
||||||
We thank Dr. Nicolas Sherman, Dra. Ana Oliveira, and Yulica Santos Ortega for providing the Mouse liver (2.2 GB) and Mouse stomach (4.4 GB) imaging datasets. The datasets were provided by Yulica Santos Ortega, Spatial Biology Core, University of Virginia, Charlottesville, VA.
|
We thank Dr. Nicholas E. Sherman, Dr. Ana Oliveira, and Yulica Santos Ortega for providing the mouse liver (2.2 GB) and mouse stomach (4.4 GB) imaging datasets. The datasets were generated at the Biomolecular Analysis Facility Core, W.M. Keck Biomedical Mass Spectrometry Laboratory, University of Virginia School of Medicine, Charlottesville, VA. This facility is funded by a grant from the University of Virginia's School of Medicine (RRID:SCR_025476). All investigators are asked to acknowledge the Biomolecular Analysis Facility Core and W.M. Keck Biomedical Mass Spectrometry Laboratory personnel and funding sources in any publications using these data.
|
||||||
|
|||||||
Reference in New Issue
Block a user