Actualizar MSI_julia-python_mapping.md
This commit is contained in:
@@ -21,13 +21,13 @@ Traditionally, MSI data analysis has relied on linear methods and standard imagi
|
||||
## 2. Methodology
|
||||
|
||||
### 2.1 MSI Data Acquisition (LD-LTP-MSI)
|
||||
Imaging was performed 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 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. The laser was oriented at 90° to the sample surface at a focal distance of 9 cm, producing a spot size of ~22 µm. Data were acquired in positive ion mode (*m/z* 50–700) with a spatial resolution of **150 µm** for the leaf samples.
|
||||
Imaging was performed 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 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 (Martínez-Jarquín & Winkler, 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. Data were acquired in positive ion mode (*m/z* 50–700) with a spatial resolution of **150 µm** for the leaf samples.
|
||||
|
||||
### 2.2 Computational Environment
|
||||
All computational analyses, including the high-performance data extraction in Julia and the deep learning-based representation learning in Python, were performed on a mobile workstation with the following specifications: **Processor:** Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz (4 cores, 8 threads), **Memory:** 32 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).
|
||||
|
||||
### 2.3 High-Performance Processing and Data Normalization (Julia)
|
||||
The preprocessing stage was conducted using the **JuliaMSI** framework (Sierra-Álvarez et al., 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-Álvarez et al., 2025), this architecture provides a significant performance advantage over interpreted environments such as Python or R, enabling the high-throughput extraction of mass slices without compromising spectral precision.
|
||||
The preprocessing stage was conducted using the **JuliaMSI** framework (Sierra-Álvarez et al., 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-Álvarez et al., 2025), this architecture provides a significant performance advantage over interpreted environments such as Python or R (Rosas-Román et al., 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-Álvarez et al., 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-Román et al., 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.
|
||||
|
||||
@@ -46,9 +46,9 @@ This transformation ensures that 98% of the chemical signal is represented withi
|
||||
3. **Spatial Standardization:** To ensure compatibility with the deep learning backbone, each normalized ion map was spatially resampled to a resolution of **224x224 pixels** using bilinear interpolation. This step standardizes the input geometry while maintaining the structural integrity of the leaf’s anatomical features, such as the vascular midrib and parenchymal regions (Hu et al., 2022).
|
||||
|
||||
### 2.4 Self-Supervised Representation Learning (Python)
|
||||
We implemented a **Contrastive Learning (SimCLR)** scheme in PyTorch, following the methodology proposed by Hu et al. (2022).
|
||||
We implemented a Contrastive Learning (SimCLR) scheme in PyTorch (Chen, T., et al., 2020), following the methodology proposed by Hu et al. (2022).
|
||||
|
||||
1. **Model Architecture:** **EfficientNet-B0** was used as the backbone encoder. The final classification layer was removed and replaced with a two-layer MLP projection head to project the data into a 128-dimensional space (Table. [1]).
|
||||
1. **Model Architecture:** **EfficientNet-B0** was used as the backbone encoder (Tan, M., & Le, Q., 2019). The final classification layer was removed and replaced with a two-layer MLP projection head to project the data into a 128-dimensional space (Table. [1]) (Kingma, D. P., & Ba, J., 2014).
|
||||
|
||||
**Table 1. Training hyperparameters and model configuration for the SimCLR-MSI workflow.**
|
||||
|
||||
@@ -82,7 +82,7 @@ Direct surface analysis of *D. innoxia* leaves was conducted using a Laser Desor
|
||||
**Figure 2. Mirrored MS/MS spectra for the confirmation of scopolamine (*m/z* 304.17) acquired via LD-LTP-MS in positive ion mode.** The upper panel (blue) represents the fragmentation profile obtained directly from the leaf surface of *D. innoxia*, while the lower panel (red) shows the commercial reference standard. Data were acquired in profile mode and are presented as refined centroids after baseline subtraction. Both spectra were generated using collision-induced dissociation (CID) at 20 eV. The axes denote relative abundance (%) and the mass-to-charge ratio (*m/z*), respectively.
|
||||
|
||||
### 3.2 Latent Space Geometry and Chemical Validation
|
||||
The high-dimensional embeddings generated by the EfficientNet-B0 backbone were projected into a 2-D manifold using t-SNE (Fig.[3]). The resulting latent space exhibits a highly structured geometry, where ions are grouped not by their absolute intensity, but by their shared spatial topographies. A cornerstone of the validation for this self-supervised approach is the emergence of **Isotopic Coherence** within the latent manifold (Table. [2]). In MSI, a molecular species and its naturally occurring isotopes (e.g., $[M+H]^+$ and $[M+H+1]^+$) are fundamentally tied by an identical spatial distribution, providing a form of natural "ground truth" that requires no manual annotation. Although the SimCLR framework is entirely agnostic to the mass-to-charge (*m/z*) values or the chemical identity of the inputs, the encoder consistently projected isotopic pairs into adjacent coordinates within the same latent clusters. This clustering behavior demonstrates that the network successfully prioritized the underlying morphological fingerprints over stochastic instrumental noise or absolute intensity variations. Such coherence serves as a robust internal control, confirming that the learned representations are anchored in biological reality rather than technical artifacts. Furthermore, this **Chemical Coherence** extends beyond isotopes to include adducts and related fragments, suggesting that the model effectively deconvolutes the chemical complexity of the tissue into meaningful metabolic domains.
|
||||
The high-dimensional embeddings generated by the EfficientNet-B0 backbone were projected into a 2-D manifold using t-SNE (Fig.[3]) (Van der Maaten & Hinton., 2008). The resulting latent space exhibits a highly structured geometry, where ions are grouped not by their absolute intensity, but by their shared spatial topographies. A cornerstone of the validation for this self-supervised approach is the emergence of **Isotopic Coherence** within the latent manifold (Table. [2]). In MSI, a molecular species and its naturally occurring isotopes (e.g., $[M+H]^+$ and $[M+H+1]^+$) are fundamentally tied by an identical spatial distribution, providing a form of natural "ground truth" that requires no manual annotation. Although the SimCLR framework is entirely agnostic to the mass-to-charge (*m/z*) values or the chemical identity of the inputs, the encoder consistently projected isotopic pairs into adjacent coordinates within the same latent clusters. This clustering behavior demonstrates that the network successfully prioritized the underlying morphological fingerprints over stochastic instrumental noise or absolute intensity variations. Such coherence serves as a robust internal control, confirming that the learned representations are anchored in biological reality rather than technical artifacts. Furthermore, this **Chemical Coherence** extends beyond isotopes to include adducts and related fragments, suggesting that the model effectively deconvolutes the chemical complexity of the tissue into meaningful metabolic domains.
|
||||
|
||||
**Table 2. Representative metabolites identified in *D. innoxia* and their latent space assignment.**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user