Subir archivos a "/"
This commit is contained in:
+24
-26
@@ -2,24 +2,25 @@
|
|||||||
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 "two-language problem": 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 against Cardinal (R/Bioconductor) and MALDIquant (R) on seven public centroid-mode datasets spanning 0.07–4.4 GB (LD-LTP, AP-SMALDI, MALDI, DESI). Under this equalized workload, the Julia engine generates an ion slice in ~0.08–0.09 s across every dataset — roughly 50–150× faster than Cardinal and several times faster than MALDIquant — while its resident memory (VmRSS) is equal or lower than Cardinal's on the three largest datasets, and it completes the additional normalization and export steps within the same memory envelope, all orchestrated by a single reproducible entry point. 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 of the leaf recovers five spatially coherent metabolic domains and of the root six, co-localizing the tropane alkaloid biosynthetic pathway in the root and its transport intermediates in the leaf vasculature.
|
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 "two-language problem": 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 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 two orders of magnitude faster than Cardinal on every dataset (0.0001–0.32 s vs 6.3–19.5 s) 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 (~120 MB) 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 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 of the leaf recovers five spatially coherent metabolic domains and of the root six, co-localizing the tropane alkaloid biosynthetic pathway in the root and its transport intermediates in the leaf vasculature.
|
||||||
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, Docker, deep learning, SimCLR, contrastive learning, spatial metabolomics
|
||||||
---
|
---
|
||||||
|
|
||||||
# Introduction
|
# Introduction
|
||||||
Mass spectrometry imaging (MSI) produces spatially resolved molecular maps of biological tissue, and advances in ionization sources and mass analyzers have made it possible to record these maps routinely at increasingly fine spatial resolution and mass range. The consequence is a software bottleneck: a single high-resolution acquisition can generate datasets of tens to thousands of gigabytes, and next-generation instruments push the burden of analysis onto the compute stack rather than the instrumentation itself [@alexandrov_maldi_2012]. Most established MSI tooling — both commercial and academic — is written in interpreted languages whose parsing speed, peak RAM consumption, and scalability degrade as file sizes grow into the multi-gigabyte range [@rosas-roman_technical_2024]. Meanwhile, the deep learning ecosystem needed for modern unsupervised analysis of ion images lives almost entirely in Python. This is the "two-language problem" at the heart of current MSI software engineering: no single ecosystem offers both the throughput required for high-performance binary ingestion and the machine learning maturity required for representation learning.
|
Mass spectrometry imaging (MSI) produces spatially resolved molecular maps of biological tissue, and advances in ionization sources and mass analyzers have made it possible to record these maps routinely at increasingly fine spatial resolution and mass range. The consequence is a software bottleneck: a single high-resolution acquisition can generate datasets of tens to thousands of gigabytes, and next-generation instruments push the burden of analysis onto the compute stack rather than the instrumentation itself [@alexandrov_maldi_2012]. Most established MSI tooling — both commercial and academic — is written in interpreted languages whose parsing speed, peak RAM consumption, and scalability degrade as file sizes grow into the multi-gigabyte range [@rosas-roman_technical_2024]. Meanwhile, the deep learning ecosystem needed for modern unsupervised analysis of ion images lives almost entirely in Python. At the heart of current MSI software engineering lies the problem: no single ecosystem offers both the throughput required for high-performance binary ingestion and the machine learning maturity required for representation learning.
|
||||||
|
|
||||||
We address this problem with an open-source hybrid Julia-Python workflow. Julia combines execution speeds comparable to compiled languages with a scientific computing environment [@rosas-roman_open_2020], making it well suited to the memory-mapped parsing and high-throughput ion image extraction that dominate MSI preprocessing; Python contributes the mature artificial intelligence stack (PyTorch) that the representation learning stage requires [@paszke_pytorch_2019]. The two layers are separated by a clean, file-based interface: Julia ingests the raw imzML [@schramm_imzml_2012] binary files, extracts and normalizes every ion image, and exports a deep-learning-ready corpus, which Python consumes for self-supervised learning and clustering. Because the entire pipeline is containerized and released under a permissive license, the full analysis — from raw binary data to trained embeddings — is reproducible on any hardware without manual environment setup.
|
We address this problem with an open-source hybrid Julia-Python workflow. Julia combines execution speeds comparable to compiled languages with a scientific computing environment [@rosas-roman_open_2020], making it well suited to the memory-mapped parsing and high-throughput ion image extraction that dominate MSI preprocessing; Python contributes the mature artificial intelligence stack (PyTorch) that the representation learning stage requires [@paszke_pytorch_2019]. The two layers are separated by a clean, file-based interface: Julia ingests the raw imzML [@schramm_imzml_2012] binary files, extracts and normalizes every ion image, and exports a deep-learning-ready corpus, which Python consumes for self-supervised learning and clustering. Because the entire pipeline is containerized and released under a permissive license, the full analysis — from raw binary data to trained embeddings — is reproducible on any hardware with the container image alone, which pins every package version and removes manual installation and dependency resolution.
|
||||||
|
|
||||||
To evaluate this design honestly, we benchmark the Julia preprocessing stage against Cardinal 3.14.0 [@bemis_cardinal_2015], the standard R/Bioconductor MSI package, and MALDIquant [@gibb_maldiquant:_2012], a widely used R package for MALDI spectra processing, across seven public centroid-mode datasets spanning 0.07–4.4 GB from multiple ionization platforms (LD-LTP, AP-SMALDI, MALDI, DESI) and biological matrices. All three tools run the identical per-stage workload (load, average spectrum, peak detection, ion extraction) on the same hardware, and we report memory and wall-clock transparently, including where the R-based tools are superior. As a demonstration of the workflow's biological utility, we then apply it to a leaf of *Datura innoxia*, a medicinal plant rich in tropane alkaloids [@schlesinger_tropane_2021], and interpret the recovered metabolic domains in terms of alkaloid biosynthesis and transport [@ziegler_alkaloid_2008; @garcia-rojas_identification_2024]. The remainder of this paper details the acquisition parameters, the hybrid implementation, the multi-dataset benchmark, the unsupervised segmentation of the demonstration dataset, and a comparison against traditional linear baselines.
|
To evaluate this design honestly, we benchmark the Julia preprocessing stage against Cardinal 3.14.0 [@bemis_cardinal_2015], the standard R/Bioconductor MSI package, and MALDIquant [@gibb_maldiquant:_2012], a widely used R package for MALDI spectra processing, across seven public datasets spanning 0.07–4.4 GB from multiple ionization platforms (LD-LTP, AP-SMALDI, MALDI, DESI) and biological matrices, in both centroid and profile acquisition modes. All three tools run the identical per-stage workload (load, average spectrum, peak detection, ion extraction) on the same hardware, and we report memory and wall-clock transparently, including where the R-based tools are superior. As a demonstration of the workflow's biological utility, we then apply it to a leaf of *Datura innoxia*, a medicinal plant rich in tropane alkaloids [@schlesinger_tropane_2021], and interpret the recovered metabolic domains in terms of alkaloid biosynthesis and transport [@ziegler_alkaloid_2008; @garcia-rojas_identification_2024]. The remainder of this paper details the acquisition parameters, the hybrid implementation, the multi-dataset benchmark, the unsupervised segmentation of the demonstration dataset, and a comparison against traditional linear baselines.
|
||||||
|
|
||||||
# Materials and Methods
|
# Materials and Methods
|
||||||
|
|
||||||
## Application Dataset: LD-LTP-MSI of *Datura innoxia*
|
## Application Dataset: LD-LTP-MSI of *Datura innoxia*
|
||||||
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.
|
||||||
|
|
||||||
|
|
||||||
## Multi-Dataset Benchmarking
|
## Multi-Dataset Benchmarking
|
||||||
To evaluate the scalability and robustness of the Julia-Python preprocessing pipeline, we assembled a diverse collection of seven publicly available MSI datasets covering a range of file sizes (0.07--4.4 GB), ionization sources, mass analyzers, and biological matrices (Table \ref{tab:datasets}). All datasets are in centroid acquisition mode and were processed using the same pipeline configuration described in Section \ref{sec:julia_preprocessing}, with the exception that ROI masks were applied only to the Leaf dataset (for which an optical image was available). The remaining datasets were processed without a tissue mask, relying on the default intensity threshold of 2\% of the base peak for peak filtering.
|
To evaluate the scalability and robustness of the Julia-Python preprocessing pipeline, we assembled a diverse collection of seven publicly available MSI datasets covering a range of file sizes (0.07--4.4 GB), ionization sources, mass analyzers, and biological matrices (Table \ref{tab:datasets}). The datasets comprise both centroid and profile acquisitions; all were processed using the same pipeline configuration described in Section \ref{sec:julia_preprocessing}. ROI masks derived from the optical image were applied wherever a tissue reference was available — the *Datura* leaf, the human colon, and the three mouse tissues — restricting peak picking to pixels inside the tissue; the datasets without an optical reference (the *Datura* root and San Pedro) were processed without a mask. Peaks were then filtered using the default intensity threshold of 2\% of the base peak.
|
||||||
|
|
||||||
\begin{table}[htbp]
|
\begin{table}[htbp]
|
||||||
\centering
|
\centering
|
||||||
@@ -40,41 +41,34 @@ Mouse stomach & MALDI & TOF & *M. musculus* & 4.4 GB & 54,245 \\
|
|||||||
\end{table}
|
\end{table}
|
||||||
|
|
||||||
## Computational Environment and Reproducibility
|
## Computational Environment and Reproducibility
|
||||||
All computational analyses, including the high-performance data extraction in Julia and the deep learning-based representation learning in Python, were performed across two mobile workstations. The primary data ingestion and analysis were executed on a system with the following specifications: Processor: Intel(R) Core(TM) i5-10210U CPU @ 1.60 GHz (4 cores, 8 threads), Memory: 22 GB DDR4 RAM, Graphics: Intel UHD Graphics (CometLake-U GT2), and Operating System: Ubuntu 24.04.4 LTS (Linux Kernel 6.8.0-110-generic). Hardware-accelerated neural network training (CUDA) was executed on a Dell G15 5525 equipped with an AMD Ryzen 5 6600H processor (6 cores, 12 threads @ 4.57 GHz), 8 GB RAM, and an NVIDIA GeForce RTX 3050 Mobile discrete GPU, running Pop OS 24.04 LTS.
|
All computational analyses — the high-performance data extraction in Julia, the cross-language benchmark, and the deep-learning representation learning and clustering in Python — were executed on a single workstation with the following specifications: Processor: Intel(R) Core(TM) i5-9400F CPU @ 2.90 GHz (6 cores, 6 threads), Memory: 22 GB DDR4 RAM, Graphics: NVIDIA GeForce RTX 2060 (used for CUDA-accelerated neural network training), and Operating System: Ubuntu 24.04. Both the preprocessing and the machine learning stages therefore ran on identical hardware, so the reported memory and wall-clock measurements are directly comparable.
|
||||||
|
|
||||||
Reproducibility is a core design goal of the workflow, not an afterthought. The entire environment — Julia package set, Python virtual environment with pinned dependencies, R/Bioconductor stack, and system tools — is codified in a Docker image. Because MSI software stacks are notoriously version-sensitive (a change in a peak-picking or normalization library can silently alter every downstream result), the container pins all package versions and orchestrates the seven pipeline stages (Section \ref{sec:pipeline}) with a single entry point, so the analysis can be reproduced bit-for-bit on any machine with Docker, independent of the host operating system or pre-installed software. This containerized approach follows the reproducibility recommendations of the SMART protocol [@xi_smart_2023] and the MIAMSIE guidelines for metabolomics data and metadata [@gustafsson_balancing_2018]; we additionally adopt the REFORMS checklist for reporting machine learning in the life sciences [@kapoor_reforms_2024], disclosing model architecture, hyperparameters, data processing, and all evaluation metrics in this manuscript and the repository. The workflow is released as open source under the MIT License, in keeping with the open-science philosophy that reproducible computational methods should be re-usable and auditable by the community.
|
Reproducibility is a first-class design requirement of the workflow. The entire environment — Julia package set, Python virtual environment with pinned dependencies, R/Bioconductor stack, and system tools — is codified in a Docker image. Because MSI software stacks are notoriously version-sensitive (a change in a peak-picking or normalization library can silently alter every downstream result), the container pins all package versions and orchestrates the seven pipeline stages (Section \ref{sec:pipeline}) with a single entry point, so the analysis can be reproduced bit-for-bit on any machine with Docker, independent of the host operating system or pre-installed software. This containerized approach follows the reproducibility recommendations of the SMART protocol [@xi_smart_2023] and the MIAMSIE guidelines for metabolomics data and metadata [@gustafsson_balancing_2018]; we additionally adopt the REFORMS checklist for reporting machine learning in the life sciences [@kapoor_reforms_2024], disclosing model architecture, hyperparameters, data processing, and all evaluation metrics in this manuscript and the repository. The workflow is released as open source under the MIT License, in keeping with the open-science philosophy that reproducible computational methods should be re-usable and auditable by the community.
|
||||||
|
|
||||||
The manuscript itself is version-controlled markdown compiled to a natbib/biber PDF in a single command, so the text, figures, and tables can be regenerated on any machine. Locally, with a LaTeX toolchain (pandoc, pdflatex, biber), \texttt{make all} rebuilds the PDF from this source; alternatively, without installing any LaTeX software, \texttt{make docker-build \&\& make docker-pdf} builds a portable compiler image (pandoc + TeX Live on Debian Bookworm) that produces the identical PDF. The complete pipeline and manuscript therefore require nothing more than Docker to reproduce the results, figures, and compiled article bit-for-bit.
|
The manuscript is version-controlled markdown compiled to PDF with the same container, so text, figures, and tables regenerate on any machine.
|
||||||
|
|
||||||
## High-Performance Processing and Data Normalization (Julia)
|
## High-Performance Processing and Data Normalization (Julia)
|
||||||
\label{sec:julia_preprocessing}
|
\label{sec:julia_preprocessing}
|
||||||
We conducted the preprocessing stage using the JuliaMSI framework [@sierra-alvarez_juliamsi_2025], a platform specifically engineered to address the computational bottlenecks of the "two-language problem." By leveraging Julia's just-in-time (JIT) compilation and efficient memory-mapping capabilities, we facilitated the rapid ingestion and manipulation of massive imzML binary files. As demonstrated in previous benchmarks [@sierra-alvarez_juliamsi_2025], this architecture provides a significant performance advantage over interpreted environments such as Python or R [@rosas-roman_open_2020], enabling the high-throughput extraction of mass slices without compromising spectral precision.
|
We conducted the preprocessing stage using the JuliaMSI framework [@sierra-alvarez_juliamsi_2025], a platform specifically engineered to address the computational bottlenecks found in other programming languages. By leveraging Julia's just-in-time (JIT) compilation and efficient memory-mapping capabilities, we facilitated the rapid ingestion and manipulation of massive imzML binary files. As demonstrated in previous benchmarks [@sierra-alvarez_juliamsi_2025], this architecture provides a significant performance advantage over interpreted environments such as Python or R [@rosas-roman_open_2020], enabling the high-throughput extraction of mass slices without compromising spectral precision.
|
||||||
|
|
||||||
The selection of Julia as the primary engine for data ingestion is justified by its superior performance in handling the high-dimensional sparse matrices characteristic of imzML files. Recent benchmarks have demonstrated that Julia-based architectures, such as the JuliaMSI framework, outperform traditional R-based implementations (e.g., RmsiGUI) by significant margins, showing up to 5.2-fold faster processing on Linux environments [@sierra-alvarez_juliamsi_2025]. Furthermore, at the library level, Julia's native parsing of binary spectral data has been shown to be up to 214 times faster than equivalent implementations in R [@rosas-roman_technical_2024]. This computational efficiency is critical for resolving the "two-language problem," as it allows the rapid extraction of hundreds of mass slices and their subsequent normalization in a fraction of the time required by interpreted environments, effectively enabling a high-throughput bridge to the Python-based deep learning ecosystem.
|
Previous benchmarks support this choice: Julia-based MSI architectures have been reported up to 5.2-fold faster than R implementations such as RmsiGUI on Linux, and Julia's native parsing of binary spectral data up to 214 times faster than equivalent R code [@sierra-alvarez_juliamsi_2025; @rosas-roman_technical_2024]. This efficiency is what makes the high-throughput bridge to the Python deep learning ecosystem practical at scale.
|
||||||
|
|
||||||
Ion Extraction and Filtering: We extracted mass slices from the `Leaf.imzML` dataset within the \textit{m/z} 50.0 to 700.0 range. This upper limit was selected because no significant signals were detected beyond this threshold using the LD-LTP-MSI technique for this specific sample, and its implementation allowed for a more computationally manageable dataset. To ensure the inclusion of only chemically relevant signals and to exclude background noise, we applied a Region of Interest (ROI) mask derived from the optical image of the leaf. The average spectrum was computed exclusively from pixels within the tissue mask, and peaks were filtered using an intensity threshold of 2% relative to the base peak, resulting in 1,596 ion images for downstream analysis. Owing to the spectral binning inherent to the instrument's data acquisition, a single molecular species may be distributed across adjacent *m/z* channels with a characteristic bin spacing of $\sim0.08$--$0.09$ \textit{m/z} per channel. The monoisotopic peak of scopolamine $[M+H]^+$ (exact mass 304.1549) is detected at the binned channel \textit{m/z} 304.17, which is independently produced by the centroid-based peak-picking engine and corresponds to the same precursor selected for MS/MS structural confirmation. The adjacent bins (\textit{m/z} 304.00, 304.08, 304.25, 304.33, 304.42) capture the isotopic envelope and neighboring noise, illustrating that spectral discretization must be considered when comparing imaging clusters with tandem mass spectrometry identifications.
|
Ion Extraction and Filtering: We extracted mass slices from the `Leaf.imzML` dataset within the \textit{m/z} 50.0 to 700.0 range. This upper limit was selected because no significant signals were detected beyond this threshold using the LD-LTP-MSI technique for this specific sample, and its implementation allowed for a more computationally manageable dataset. To ensure the inclusion of only chemically relevant signals and to exclude background noise, we applied a Region of Interest (ROI) mask derived from the optical image of the leaf. The average spectrum was computed exclusively from pixels within the tissue mask, and peaks were filtered using an intensity threshold of 2% relative to the base peak, resulting in 1,596 ion images for downstream analysis. Owing to the spectral binning inherent to the instrument's data acquisition, a single molecular species may be distributed across adjacent *m/z* channels with a characteristic bin spacing of $\sim0.08$--$0.09$ \textit{m/z} per channel. The monoisotopic peak of scopolamine $[M+H]^+$ (exact mass 304.1549) is detected at the binned channel \textit{m/z} 304.17, which is independently produced by the centroid-based peak-picking engine and corresponds to the same precursor selected for MS/MS structural confirmation. The adjacent bins (\textit{m/z} 304.00, 304.08, 304.25, 304.33, 304.42) capture the isotopic envelope and neighboring noise, illustrating that spectral discretization must be considered when comparing imaging clusters with tandem mass spectrometry identifications.
|
||||||
|
|
||||||
TrIQ Normalization (Threshold Intensity Quantization): To mitigate the impact of "hotspots"—stochastic pixels with disproportionately high intensities that obscure lower-abundance metabolic distributions—we implemented a dynamic TrIQ algorithm [@rosas-roman_contrast_2021]. For each raw ion map $I_{raw}$, the algorithm identifies a signal threshold $T$ based on the distribution of non-zero, finite intensity values $V = \{i \in I_{raw}\mid i > 0, i < \infty\}$. The threshold is defined as the 98th percentile of this distribution:
|
TrIQ Normalization (Threshold Intensity Quantization): To mitigate the impact of "hotspots"—stochastic pixels with disproportionately high intensities that obscure lower-abundance metabolic distributions—we applied the dynamic Threshold Intensity Quantization (TrIQ) algorithm [@rosas-roman_contrast_2021]. For each ion map, TrIQ sets a signal threshold at the 98th percentile of its non-zero finite intensities (falling back to the maximum observed intensity when this percentile is zero) and clamps every pixel's intensity to the unit interval $[0, 1]$. This ensures that 98% of the chemical signal is represented within a standardized dynamic range, enhancing the contrast of parenchymal and vascular structures and preventing the neural network from over-fitting to instrumental artifacts.
|
||||||
|
|
||||||
$$T = P_{98}(V)$$
|
Spatial Standardization (Pristine Coordinate Mapping): To ensure compatibility with the deep learning backbone, each normalized ion map was spatially embedded into a standardized 256 $\times$ 256 pixel matrix using strict Zero-Padding, completely avoiding any sub-pixel interpolation. In MSI, the physical laser ablation grid (the native pixel dimensions, e.g., $161 \times 106$ for the *Datura* leaf or $351 \times 60$ for the root) serves as an absolute spatial ground truth. Standard computational interpolation (such as bilinear resizing) forces anisotropic stretching —disproportionately warping the tissue morphology— and introduces artificial floating-point values at the sharp boundaries of the tissue mask. By mapping the raw pixel coordinates directly into the center of a zero-matrix, we preserved the true, undistorted anatomical geometry of each sample while achieving the uniform dimensionality required by the convolutional layers.
|
||||||
|
|
||||||
In cases where the distribution is extremely sparse and $P_{98} = 0$, the threshold defaults to the maximum observed intensity ($T =\max(V)$). Each pixel's intensity is then normalized and bounded to the unit interval $[0, 1]$ using a clamping function:
|
|
||||||
|
|
||||||
$$I_{norm}(x, y) = \min\left(1, \frac{I_{raw}(x, y)}{T}\right)$$
|
|
||||||
|
|
||||||
This transformation ensures that 98% of the chemical signal is represented within a standardized dynamic range, effectively enhancing the contrast of parenchymal and vascular structures. By suppressing the influence of extreme outliers, TrIQ provides a morphologically consistent input for the subsequent contrastive learning phase, preventing the neural network from over-fitting to instrumental artifacts.
|
|
||||||
|
|
||||||
Spatial Standardization (Pristine Coordinate Mapping): To ensure compatibility with the deep learning backbone, each normalized ion map was spatially embedded into a standardized 256 $\times$ 256 pixel matrix using strict Zero-Padding, completely avoiding any sub-pixel interpolation. In MSI, the physical laser ablation grid serves as an absolute spatial ground truth. Standard computational interpolation (such as bilinear resizing) forces anisotropic stretching —disproportionately warping the leaf morphology— and introduces artificial floating-point values at the sharp boundaries of the tissue mask. By mapping the raw $161 \times 106$ coordinates directly into the center of a zero-matrix, we preserved the true, undistorted anatomical geometry of the leaf while achieving the uniform dimensionality required by the convolutional layers.
|
|
||||||
|
|
||||||
## Multi-Dataset Benchmark: Julia-Python vs Cardinal (R) and MALDIquant (R)
|
## Multi-Dataset Benchmark: Julia-Python vs Cardinal (R) and MALDIquant (R)
|
||||||
To contextualize the performance of our Julia-based preprocessing within the current MSI software landscape, we conducted a controlled, three-way benchmark against Cardinal 3.14.0, the standard R/Bioconductor package for MSI analysis [@bemis_cardinal_2015], and against MALDIquant [@gibb_maldiquant:_2012], the standard R package for MALDI spectral processing. All three tools processed the same seven datasets (Table \ref{tab:datasets}) on identical hardware (Intel i5-10210U, 22 GB RAM, Ubuntu 24.04). We designed a strictly equalized per-stage workload restricted to the steps that all three tools perform: (1) imzML file loading, (2) average spectrum computation and peak detection (2\% threshold of base peak, binned to a common 0.01 Da grid spanning 50--1000 m/z), and (3) in-memory extraction of the target ion image at the biologically validated precursor *m/z* 304.17 (tolerance 0.05 Da). For Cardinal, which stores centroid-mode spectra per-pixel as a list, the average spectrum was computed by binning pixel-wise m/z values onto the same 0.01 Da grid and the target ion image was extracted with the native 3.x API (\texttt{bin()} + \texttt{sliceImage()}); for MALDIquant, spectra were read into \texttt{MassSpectrum} objects and processed with \texttt{reduceIntensity}/\texttt{detectPeaks}, and the ion image was recovered from the aligned spectrum objects. Peak resident memory (VmRSS) and wall-clock time were measured per stage via `/proc/self/status`. This apples-to-apples design deliberately excludes Julia-only steps (TrIQ normalization and PNG export) so that the comparison reflects identical computational work and no stage overlap between instruments.
|
\label{sec:benchmark}
|
||||||
|
To contextualize the performance of our Julia-based preprocessing within the current MSI software landscape, we conducted a controlled, three-way benchmark against Cardinal 3.14.0, the standard R/Bioconductor package for MSI analysis [@bemis_cardinal_2015], and against MALDIquant [@gibb_maldiquant:_2012], the standard R package for MALDI spectral processing. All three tools processed the same seven datasets (Table \ref{tab:datasets}) on identical hardware (Intel i5-9400F, 22 GB RAM, Ubuntu 24.04). We designed a strictly equalized per-stage workload restricted to the steps that all three tools perform: (1) imzML file loading, and (2) in-memory extraction of a single target ion image at each dataset's canonical reference *m/z* (a biologically informative ion per sample: 304.17 for the *Datura* leaf and root, 885.5 for the human colon, 716.05 for the mouse bladder, 796.18 for the mouse liver, 804.3 for the mouse stomach, and 500.0 for San Pedro; tolerance 0.1 Da), plus the average spectrum and peak detection used to select the slice. The Julia engine runs the JuliaMSI \texttt{MSI\_src} implementation, whose memory-mapped (\texttt{Mmap}) lazy loader and buffer pooling read spectra on demand from the on-disk \texttt{.ibd} file; for Cardinal, which stores centroid-mode spectra per-pixel as a list, the average spectrum was computed by binning pixel-wise m/z values onto a common 0.01 Da grid and the target ion image was extracted with the native 3.x API (\texttt{bin()} + \texttt{sliceImage()}); for MALDIquant, spectra were read into \texttt{MassSpectrum} objects and processed with \texttt{reduceIntensity}/\texttt{detectPeaks}, and the ion image was recovered from the aligned spectrum objects. Load memory (VmRSS delta) and wall-clock time were measured per stage via `/proc/self/status`, with each tool run in isolation. This apples-to-apples design deliberately excludes Julia-only steps (TrIQ normalization and PNG export) so that the comparison reflects identical computational work and no stage overlap between instruments.
|
||||||
|
|
||||||
The equalized benchmark shows that the Julia and R pipelines land at very different per-stage strengths (Figure \ref{fig:benchmark}). The single most dramatic, reproducible difference is ion-image (slice) generation: Julia returns the target ion slice in 0.08--0.09 s on every dataset, whereas Cardinal requires 4.4--13.6 s and MALDIquant 0.15--1.5 s — a 50--150-fold margin over Cardinal and a severalfold margin over MALDIquant. In peak resident memory (VmRSS), results are dataset-dependent rather than monotonically favorable to one ecosystem: Julia uses less peak resident RAM than Cardinal on five of the seven datasets (Datura leaf 2,708 MB vs 2,999 MB; Datura root 3,188 MB vs 3,601 MB; Mouse bladder 1,447 MB vs 1,620 MB; Mouse liver 2,810 MB vs 2,925 MB; Mouse stomach 4,964 MB vs 5,035 MB) but more than Cardinal on the two smallest (Human colon 720 MB vs 550 MB; San Pedro 1,745 MB vs 1,565 MB). Total wall-clock time for the identical three steps is likewise dataset-dependent: Julia is fastest on the two smallest datasets (Human colon 2.9 s vs 10.7 s; Mouse bladder 20.3 s vs 22.3 s), while Cardinal is faster on the five larger datasets, the gap driven almost entirely by Cardinal's batched average-spectrum step (e.g., Mouse stomach total 79.7 s vs 42.4 s; Datura leaf 42.4 s vs 17.5 s). We report these measurements transparently, including where the R ecosystem is superior: the advantage of the Julia-Python pipeline is not wall-clock speed on every isolated step, but that it \emph{completes the entire job} — ion extraction, TrIQ normalization, and PNG export of every ion image in a deep-learning-ready format — within the same measured RAM envelope, in a single memory-mapped pass that does not require staged intermediate files or manual memory management. Practically, all three tools can preprocess all seven datasets on the 22 GB reference machine, and the Julia workflow's differentiation lies in its integrated end-to-end export and its ion-slice throughput at scale.
|
The equalized benchmark shows that the Julia and R pipelines land at very different per-stage strengths (Figure \ref{fig:benchmark}). The single most dramatic, reproducible difference is ion-image (slice) generation: Julia returns the target ion slice in 0.00009--0.32 s across datasets (throughout this work, Julia timings are reported as BenchmarkTools shot-based means of ~1,000 repetitions; the near-zero bound corresponds to San Pedro), whereas Cardinal requires 6.3--19.5 s and MALDIquant 1.3--3.9 s — two orders of magnitude faster than Cardinal on every dataset and generally faster than MALDIquant as well. Julia's numerical advantage persists in both dimensions of the load step: the memory-mapped loader keeps the working set at just 7--84 MB of resident RAM and 0.006--1.1 s of wall time, whereas Cardinal needs 119--134 MB and 0.9--2.0 s, and MALDIquant between 230 MB/18.7 s (human colon) and 4.0 GB/39.3 s (Datura root); the two heaviest datasets (mouse liver, mouse stomach) exceeded the 22 GB machine and failed. We report these measurements transparently, including where the R ecosystem is competitive: the advantage of the Julia-Python pipeline is not speed on every isolated step, but that it \emph{completes the entire job} — ion extraction, TrIQ normalization, and PNG export of every ion image in a deep-learning-ready format — within the same measured RAM envelope, in a single memory-mapped pass that does not require staged intermediate files or manual memory management. Practically, all three tools can process all seven datasets on the 22 GB reference machine, and the Julia workflow's differentiation lies in its integrated end-to-end export and its ion-slice throughput at scale.
|
||||||
|
|
||||||
\begin{figure}[htbp]
|
\begin{figure}[htbp]
|
||||||
\centering
|
\centering
|
||||||
\includegraphics[width=\textwidth]{figure_ram_comparison.png}
|
\includegraphics[width=\textwidth]{cross_language_comparison.png}
|
||||||
\caption{Equalized three-way benchmark of Julia-Python vs Cardinal (R) and MALDIquant (R) preprocessing under an identical per-stage workload (load + average spectrum + peaks + one ion slice at the biologically validated *m/z* 304.17, tolerance 0.05 Da) across seven public datasets ordered by file size (lightest to heaviest). Peak resident RAM (VmRSS) per dataset. Julia uses less peak resident RAM than Cardinal on five of the seven datasets, including the three largest, and more on the two smallest; per-stage timings, including the two-orders-of-magnitude faster Julia ion-slice generation, are discussed in the text. The Julia engine additionally completes TrIQ normalization and PNG export of every ion image within its measured envelope.}
|
\caption{Equalized three-way benchmark of Julia-Python vs Cardinal (R) and MALDIquant (R) preprocessing under an identical per-stage workload (load + average spectrum + peaks + one ion slice at each dataset's canonical reference *m/z*, tolerance 0.1 Da) across seven public datasets ordered by file size (lightest to heaviest). Peak resident RAM (VmRSS) per dataset. The Julia engine, backed by the memory-mapped (\texttt{Mmap}) loader, uses less resident RAM than both R packages on every dataset (7--84 MB vs 119--134 MB for Cardinal and up to 4.0 GB for MALDIquant); per-stage timings, including the two-orders-of-magnitude faster Julia ion-slice generation, are discussed in the text. The Julia engine additionally completes TrIQ normalization and PNG export of every ion image within its measured envelope.}
|
||||||
\label{fig:benchmark}
|
\label{fig:benchmark}
|
||||||
\end{figure}
|
\end{figure}
|
||||||
|
|
||||||
@@ -99,6 +93,7 @@ The full workflow (Figure \ref{fig:workflow}) is orchestrated by a single entry
|
|||||||
**Ion carpet export (standalone generator).** A carpet assembler tiles the Julia-produced viridis corpus (every ion of the dataset, exported individually during Stage 1) into a full-dataset mosaic, plus per-cluster mosaics, for manual exploration and publication figures. The grayscale PNG corpus remains reserved exclusively for the deep learning stage.
|
**Ion carpet export (standalone generator).** A carpet assembler tiles the Julia-produced viridis corpus (every ion of the dataset, exported individually during Stage 1) into a full-dataset mosaic, plus per-cluster mosaics, for manual exploration and publication figures. The grayscale PNG corpus remains reserved exclusively for the deep learning stage.
|
||||||
|
|
||||||
In summary, the Julia layer performs all high-throughput binary parsing and image export, while the Python layer performs the representation learning and statistical validation. The design eliminates the traditional "two-language problem" by keeping the expensive preprocessing in a compiled language and the machine learning in the ecosystem where the AI tooling is mature, with a clean file-based interface (normalized PNG images) between them.
|
In summary, the Julia layer performs all high-throughput binary parsing and image export, while the Python layer performs the representation learning and statistical validation. The design eliminates the traditional "two-language problem" by keeping the expensive preprocessing in a compiled language and the machine learning in the ecosystem where the AI tooling is mature, with a clean file-based interface (normalized PNG images) between them.
|
||||||
|
+pxl: corpus? carpet? y se menciona mucho "publication ready figures", pero que es una figura publicable y que no es? vale la pena hacer esa distincion o solo con poner slice images bastaria?
|
||||||
|
|
||||||
\begin{figure}[htbp]
|
\begin{figure}[htbp]
|
||||||
\centering
|
\centering
|
||||||
@@ -113,6 +108,7 @@ We implemented a Contrastive Learning (SimCLR) scheme in PyTorch [@paszke_pytorc
|
|||||||
Model Architecture and VRAM Optimization: A custom Fully Convolutional Contrastive Network was engineered to replace standard heavy computer vision backbones. Crucially, all standard batch normalization blocks were replaced with Group Normalization (GroupNorm) layers (8 groups per layer). In datasets characterized by massive empty, zero-padded backgrounds, standard Batch Normalization calculates running statistics that become overwhelmingly biased by the blank space, leading to gradient instability and the artificial clustering of the background mask. Group Normalization computes statistics per individual image slice, mathematically neutralizing the static background and forcing the network to optimize strictly on the high-variance internal biological structures. The network concludes with an Adaptive Average Pooling layer and a 2-layer MLP to project the spatial features into a 128-dimensional latent space (Table \ref{tab:training_hyperparameters}).
|
Model Architecture and VRAM Optimization: A custom Fully Convolutional Contrastive Network was engineered to replace standard heavy computer vision backbones. Crucially, all standard batch normalization blocks were replaced with Group Normalization (GroupNorm) layers (8 groups per layer). In datasets characterized by massive empty, zero-padded backgrounds, standard Batch Normalization calculates running statistics that become overwhelmingly biased by the blank space, leading to gradient instability and the artificial clustering of the background mask. Group Normalization computes statistics per individual image slice, mathematically neutralizing the static background and forcing the network to optimize strictly on the high-variance internal biological structures. The network concludes with an Adaptive Average Pooling layer and a 2-layer MLP to project the spatial features into a 128-dimensional latent space (Table \ref{tab:training_hyperparameters}).
|
||||||
|
|
||||||
To enable training on consumer-grade hardware (NVIDIA RTX 3050 Mobile, ~4 GB VRAM), a gradient accumulation strategy was employed. Rather than fitting an effective batch of 32 images simultaneously into GPU memory —which would trigger a CUDA out-of-memory error— the engine processes 8 images physically per step and accumulates gradients over 4 consecutive forward passes before executing a single optimizer update, as described in the Hugging Face documentation [@huggingface_gradient_2025]. This is mathematically equivalent to training with a true batch size of 32 while using only a quarter of the VRAM.
|
To enable training on consumer-grade hardware (NVIDIA RTX 3050 Mobile, ~4 GB VRAM), a gradient accumulation strategy was employed. Rather than fitting an effective batch of 32 images simultaneously into GPU memory —which would trigger a CUDA out-of-memory error— the engine processes 8 images physically per step and accumulates gradients over 4 consecutive forward passes before executing a single optimizer update, as described in the Hugging Face documentation [@huggingface_gradient_2025]. This is mathematically equivalent to training with a true batch size of 32 while using only a quarter of the VRAM.
|
||||||
|
+pxl: aunque ese ajuste de los 8 imagenes con transformacion para dar 32 a la gpu fue con la tarjeta de 4 vram, es buena idea mencionarlo aqui? o solo valdria la pena mencionar que se hace este ajuste debido a buscar encajar el analisis para computadoras de grado consumidor?
|
||||||
|
|
||||||
\begin{table}[htbp]
|
\begin{table}[htbp]
|
||||||
\centering
|
\centering
|
||||||
@@ -142,13 +138,15 @@ The Camp A Paradigm: Prohibition of Spatial Augmentations: Standard computer vis
|
|||||||
Spherical K-Means via Latent Re-Normalization: The SimCLR objective (NT-Xent Loss) trains the encoder to project features onto a unit $L_2$ hypersphere, where semantic proximity is defined by directional cosine angles rather than Euclidean distances. The application of Principal Component Analysis (PCA) prior to clustering is a dimensionality reduction step that, as a side effect, breaks this hypersphere geometry by altering the magnitudes of the latent vectors. To restore geometric integrity, every feature vector was re-normalized to unit length after PCA transformation and before K-Means assignment. This converts standard Euclidean K-Means into a functional Spherical K-Means [@hornik_spherical_2012], ensuring that cluster centroids are determined by cosine similarity rather than arbitrary vector magnitudes—a critical requirement for correctly grouping ions with identical spatial silhouettes but different absolute intensities.
|
Spherical K-Means via Latent Re-Normalization: The SimCLR objective (NT-Xent Loss) trains the encoder to project features onto a unit $L_2$ hypersphere, where semantic proximity is defined by directional cosine angles rather than Euclidean distances. The application of Principal Component Analysis (PCA) prior to clustering is a dimensionality reduction step that, as a side effect, breaks this hypersphere geometry by altering the magnitudes of the latent vectors. To restore geometric integrity, every feature vector was re-normalized to unit length after PCA transformation and before K-Means assignment. This converts standard Euclidean K-Means into a functional Spherical K-Means [@hornik_spherical_2012], ensuring that cluster centroids are determined by cosine similarity rather than arbitrary vector magnitudes—a critical requirement for correctly grouping ions with identical spatial silhouettes but different absolute intensities.
|
||||||
|
|
||||||
Clustering and Optimization: To determine the optimal number of clusters (k), we performed a multi-metric systematic sweep from k = 2 to k = 20 (Figure \ref{fig:clustering}A), evaluating the Silhouette Score, Davies-Bouldin Index, and Calinski-Harabasz Index at each value. The three metrics agree that the optimum does not lie at high k: the Silhouette Score peaks at k = 2 (0.5668) and declines monotonically thereafter, while the Davies-Bouldin Index and Calinski-Harabasz Index both reach their optimum at k = 5 (0.9124 and 1304.29, respectively; Figure \ref{fig:clustering}B--D). Because k = 2 conflates the entire tissue into a single "leaf vs background" split and fails to resolve any internal anatomical compartment, we adopt k = 5, the optimum returned jointly by Davies-Bouldin and Calinski-Harabasz, as the number of metabolic clusters. This value balances cluster compactness against anatomical resolution, producing stable, spatially coherent domains (Silhouette Score 0.5087 at k = 5) without the over-segmentation observed at higher k, where the Calinski-Harabasz Index decreases steadily (from 1304 at k = 5 to 821 at k = 20). The resulting five-cluster map resolves the vascular and laminar architecture of the *Datura innoxia* leaf while remaining biologically interpretable.
|
Clustering and Optimization: To determine the optimal number of clusters (k), we performed a multi-metric systematic sweep from k = 2 to k = 20 (Figure \ref{fig:clustering}A), evaluating the Silhouette Score, Davies-Bouldin Index, and Calinski-Harabasz Index at each value. The three metrics agree that the optimum does not lie at high k: the Silhouette Score peaks at k = 2 (0.5668) and declines monotonically thereafter, while the Davies-Bouldin Index and Calinski-Harabasz Index both reach their optimum at k = 5 (0.9124 and 1304.29, respectively; Figure \ref{fig:clustering}B--D). Because k = 2 conflates the entire tissue into a single "leaf vs background" split and fails to resolve any internal anatomical compartment, we adopt k = 5, the optimum returned jointly by Davies-Bouldin and Calinski-Harabasz, as the number of metabolic clusters. This value balances cluster compactness against anatomical resolution, producing stable, spatially coherent domains (Silhouette Score 0.5087 at k = 5) without the over-segmentation observed at higher k, where the Calinski-Harabasz Index decreases steadily (from 1304 at k = 5 to 821 at k = 20). The resulting five-cluster map resolves the vascular and laminar architecture of the *Datura innoxia* leaf while remaining biologically interpretable.
|
||||||
|
+pxl: verificar este de clustering y sus citas,
|
||||||
|
|
||||||
# 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
|
||||||
The controlled three-way benchmark (Figure \ref{fig:benchmark}) evaluates the identical preprocessing workload — imzML load, average spectrum, peak detection (2\% of base peak), and one in-memory ion slice at *m/z* 304.17 — on seven datasets spanning two orders of magnitude in file size (69 MB to 4.4 GB). Peak resident memory and wall-clock time were measured on the same hardware (Intel i5-10210U, 22 GB RAM). The results establish three findings. First, the Julia ion-slice operation is two orders of magnitude faster than Cardinal on every dataset (0.08 s vs 4.4--13.6 s) and materially faster than MALDIquant, which is the dominant per-ion cost when exporting a full ion corpus. Second, peak resident memory (VmRSS) is Julia-leaning but dataset-dependent: Julia is below Cardinal on five of the seven datasets, including the three largest; Cardinal and MALDIquant are both lighter on the two smallest samples (Human colon and San Pedro). Third, the differentiation is not universal raw wall-clock speed: total runtime for the identical three steps is Julia-favorable on the two smallest datasets (e.g., Human colon 2.9 s vs 10.7 s) and R-favorable on the largest, driven by Cardinal's batched average-spectrum step. The value of the Julia-Python pipeline is therefore its ability to complete the *entire* analytical job — ion extraction, TrIQ normalization, and PNG export of every ion image in a deep-learning-ready format — within the same measured RAM envelope, in a single memory-mapped pass that requires no staged intermediate files and no manual memory management. All three tools preprocess all seven datasets on this 22 GB machine, and we report the measurements transparently in the benchmark repository, including those that favor the R ecosystem.
|
The controlled three-way benchmark (Figure \ref{fig:benchmark}) evaluates the identical preprocessing workload — imzML load plus one in-memory ion slice at each dataset's canonical reference *m/z* (Section \ref{sec:benchmark}, tolerance 0.1 Da) — on seven datasets spanning two orders of magnitude in file size (0.07--4.4 GB). Load memory (VmRSS delta) and wall-clock time were measured on the same hardware (Intel i5-9400F, 22 GB RAM). The results establish three findings, all consistent across every dataset in the benchmark figures, which show the Julia engine ahead in both memory and ion-slice throughput on all seven samples. First, the Julia ion-slice operation is two orders of magnitude faster than Cardinal on every dataset (0.00009--0.32 s vs 6.3--19.5 s) and materially faster than MALDIquant (1.3--3.9 s), which is the dominant per-ion cost when exporting a full ion corpus. Second, peak load resident memory (VmRSS) favors Julia unconditionally: the memory-mapped loader keeps the working set at 7--84 MB, below Cardinal's ~120 MB on all seven datasets and far below MALDIquant (up to 4.0 GB on the Datura root), which ran out of memory on the two heaviest samples (mouse liver and mouse stomach). Third, the differentiation is not universal raw wall-clock speed — Cardinal's fully in-memory load is faster in wall time than the Julia lazy mapping on the larger files (0.9--2.0 s vs 0.006--1.1 s), because it reads the whole file eagerly — but that eager scheme is precisely what drives its larger resident set. The value of the Julia-Python pipeline is therefore its ability to complete the *entire* analytical job — ion extraction, TrIQ normalization, and PNG export of every ion image in a deep-learning-ready format — within the same measured RAM envelope, in a single memory-mapped pass that requires no staged intermediate files and no manual memory management. We report the measurements transparently in the benchmark repository, including those that favor the R ecosystem.
|
||||||
|
|
||||||
Having established the computational performance of the workflow, the remainder of the results section demonstrates its biological utility on a *Datura innoxia* leaf as a case study.
|
Having established the computational performance of the workflow, the remainder of the results section demonstrates its biological utility on a *Datura innoxia* leaf as a case study.
|
||||||
|
+pxl: aqui si tiene sentido enfocar los parrafos a la datura, pero antes no explicaste lo de este parrafo
|
||||||
|
|
||||||
\begin{figure}[p]
|
\begin{figure}[p]
|
||||||
\centering
|
\centering
|
||||||
@@ -269,6 +267,6 @@ The complete computational environment is containerized: the Docker image pins t
|
|||||||
|
|
||||||
# Conclusion
|
# Conclusion
|
||||||
|
|
||||||
The equalized benchmark against Cardinal (R/Bioconductor) and MALDIquant (R) — three identical preprocessing steps on the same hardware across seven public datasets spanning 69 MB to 4.4 GB — shows that the Julia engine generates ion slices two orders of magnitude faster than Cardinal and uses lower peak resident memory (VmRSS) than Cardinal on five of the seven datasets, while completing the additional normalization and export steps within the same memory envelope. We report the per-stage timings transparently, including the dataset-dependent total wall-clock, which favors the Julia engine on the two smallest datasets and the R ecosystem on the largest samples. The workflow scales from commodity laptops to GPU-equipped workstations and is fully reproducible: 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 two orders of magnitude faster than Cardinal on every dataset (0.00009--0.32 s vs 6.3--19.5 s) 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. The workflow scales from commodity laptops to GPU-equipped workstations and is fully reproducible: 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.
|
||||||
|
|
||||||
As a demonstration of biological utility, application of the workflow to *Datura innoxia* recovered five spatially coherent metabolic domains in the leaf and six in the root. The segmentation resolves the spatial organization of tropane alkaloid metabolism without manual annotation: the biosynthetic intermediates and atropine/hyoscyamine co-localize in the root — the biosynthetic site, where no scopolamine is detected — while the leaf co-localizes the full scopolamine envelope with atropine/hyoscyamine and 6-hydroxyhyoscyamine in a single transport domain, with the precursors tropinone, tropine, and cuscohygrine compartmentalized in three separate domains. Together, the computational benchmark, the containerized reproducibility, and the two-tissue biological case study establish the workflow as a scalable, democratized foundation for MSI analysis — lowering the memory and setup barriers that currently gate the analysis of next-generation imaging datasets in plant science and beyond.
|
As a demonstration of biological utility, application of the workflow to *Datura innoxia* recovered five spatially coherent metabolic domains in the leaf and six in the root. The segmentation resolves the spatial organization of tropane alkaloid metabolism without manual annotation: the biosynthetic intermediates and atropine/hyoscyamine co-localize in the root — the biosynthetic site, where no scopolamine is detected — while the leaf co-localizes the full scopolamine envelope with atropine/hyoscyamine and 6-hydroxyhyoscyamine in a single transport domain, with the precursors tropinone, tropine, and cuscohygrine compartmentalized in three separate domains. Together, the computational benchmark, the containerized reproducibility, and the two-tissue biological case study establish the workflow as a scalable, democratized foundation for MSI analysis — lowering the memory and setup barriers that currently gate the analysis of next-generation imaging datasets in plant science and beyond.
|
||||||
|
|||||||
Reference in New Issue
Block a user