Subir archivos a "/"

Borrador manuscrito Julia + Python3
This commit is contained in:
2026-04-10 23:48:18 +02:00
commit ff5ddaea9f
3 changed files with 95 additions and 0 deletions
+95
View File
@@ -0,0 +1,95 @@
# Chemical-Anatomical Mapping of *Datura innoxia* via Mass Spectrometry Imaging (MSI): A Hybrid Approach Based on High-Performance Computing in Julia and Contrastive Learning in Python
**Authors:** Carlos Daniel Sierra Álvarez, Juan Francisco Moreno Luna, José Jovani Martínez, José Julián Sierra Álvarez.
**Affiliation:** Advanced Genomics Unit, Cinvestav, km 9.6 Libr. Nte. Irapuato-León, Irapuato, 36824, Gto., Mexico.
**Keywords:** MSI, Julia Language, Deep Learning, SimCLR, EfficientNet-B0, *Datura innoxia*, Spatial Metabolomics.
---
## Abstract
Mass Spectrometry Imaging (MSI) has emerged as a fundamental tool in spatial metabolomics (García-Rojas et al., 2024), enabling the *in situ* visualization of molecular distributions. However, the nature of these data—characterized by massive volumes of multivariate information and high levels of instrumental noise—poses critical challenges for traditional analysis methods. In this work, we present an innovative computational architecture that addresses the "two-language problem" by integrating **Julia** for high-performance data processing and **Python** for representation learning via deep neural networks. We implemented a self-supervised learning workflow based on the **SimCLR** architecture with an **EfficientNet-B0** encoder, designed to extract robust morphological features from ion images without the need for prior labeling. This system was applied to the study of *Datura innoxia* (toloache) leaves, achieving automated anatomical segmentation that accurately distinguishes vascular and parenchymal tissues. Our results demonstrate that the latent space generated by the neural network captures fundamental chemical relationships, such as the co-localization of isotopic patterns, offering a scalable and objective pathway for the interpretation of complex biological systems.
---
## 1. Introduction
The analysis of the spatial distribution of secondary metabolites in medicinal plants is essential for understanding biosynthesis, transport, and chemical defense processes (Ziegler & Facchini, 2008). *Datura innoxia*, known for its rich composition of tropane alkaloids, represents a highly complex biological model due to the biosynthesis of these compounds in the roots and their differential transport to the shoots (Schlesinger et al., 2021). Previous studies have employed laser desorption low-temperature plasma (LD-LTP) techniques to map these alkaloids in fruits and seeds (Moreno-Pedraza et al., 2019).
Traditionally, MSI data analysis has relied on linear methods and standard imaging protocols (Cole & Clench, 2023). However, a software engineering challenge arises: while Python possesses the most mature ecosystem for Artificial Intelligence, its performance in handling massive binary files in **imzML** format (Schramm et al., 2012) is limited. Conversely, Julia offers execution speeds comparable to C++, making it ideal for processing high-dimensional matrices in MSI, demonstrating speeds up to 200 times faster than R in data reading tasks (Rosas-Román et al., 2024). In this article, we propose that the synergy between these two languages enables a "next-generation" MSI workflow.
---
## 2. Methodology
### 2.1 Phase I: High-Performance Processing (Julia)
Preprocessing was conducted using the **JuliaMSI** platform (Sierra-Álvarez et al., 2025). The objective was to transform raw data into a series of standardized images ready for the neural network.
1. **Ion Extraction and Filtering:** The `Hoja.imzML` file was processed to extract mass slices in the ***m/z* 50.0 to 700.0** range. Peaks were selected based on an intensity threshold of 2% relative to the average spectrum.
2. **TrIQ Normalization (Threshold Intensity Quantization):** A dynamic TrIQ algorithm was implemented, calculating the 98th percentile to mitigate hotspots and preserve contrast in low-intensity regions.
3. **Spatial Standardization:** Using bilinear interpolation, each ion map was resampled to a resolution of **224x224 pixels**, ensuring compatibility with computer vision architectures.
### 2.2 Phase II: Self-Supervised Representation Learning (Python)
We implemented a **Contrastive Learning (SimCLR)** scheme in PyTorch, 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.
2. **MSI-Specific Data Augmentations:** Stochastic transformations were applied to simulate experimental variability, including slight rotations, Gaussian blur, and the addition of additive Gaussian noise to bolster the model against detector background noise.
3. **NT-Xent Loss Function:** The model was trained to maximize the similarity between two augmented views of the same ion, forcing the network to learn which spatial features define a molecule independently of its absolute intensity.
---
## 3. Results and Discussion
### 3.1 Latent Space Geometry and Chemical Validation
Following training, the 1280-dimensional embeddings were analyzed using t-SNE (t-Distributed Stochastic Neighbor Embedding). We observed a structured geometric organization where **Isotopic Coherence** served as a fundamental validation: ions corresponding to isotopic patterns (e.g., $[M+H]^+$, $[M+H+1]^+$, etc.) consistently clustered in adjacent regions of the latent space. Since isotopes share the same spatial distribution, their automated grouping confirms that the network has learned representations with physicochemical significance.
![[msi_tsne_clusters.png]]
Figure X. **Visualizing metabolic specialization across anatomical zones of a _D. innoxia_ leaf using t-SNE.** This scatter plot displays the t-SNE dimensionality reduction of MSI data acquired from a leaf section at a spatial resolution of 100 µm. The original dataset of 588 *m/z* feature intensities was projected into a 2D space to visualize metabolic similarity. Ten distinct clusters are identified via automated segmentation of the co-localized ion images and are represented here by a qualitative color bar (right). Points of the same color indicate pixels with closely related metabolic signatures, corresponding to different anatomical regions within the leaf. The strong segregation between groups highlights a sharp molecular differentiation of metabolic functions across the tissue.
### 3.2 Chemical-Anatomical Segmentation in *Datura innoxia*
The unsupervised clustering of the latent space yielded 10 distinct molecular domains, each reflecting a specific spatial organization within the *D. innoxia* leaf. The morphological patterns observed across these clusters provide significant insights into the plant's metabolic compartmentalization (see Fig. [X]).
3.2.1 Vascular and Transport Systems (Clusters 3, 7, and 8)
* Cluster 3 (Pure Vascular): This cluster clearly delineates the leaf's venation (midrib and lateral veins). It is primarily
composed of ions associated with the long-distance transport of metabolites. Notably, scopolamine ($m/z \approx 304$) was
categorized here, confirming its active movement through the vascular system.
* Cluster 7 and 8 (Mixed Vascular): Cluster 7 shows signals spanning both the venation and the entire lamina, while Cluster 8
specifically links the vascular system with the leaf tip. These patterns likely represent transition zones where metabolites move
from transport vessels into the surrounding parenchyma or accumulate at terminal apical points.
3.2.2 Apical Accumulation and Defense (Clusters 1, 6, 8, and 9)
* Cluster 1 (Pure Apical): Exclusively localized at the leaf tip, this cluster represents a highly specific chemical domain.
Concentration at the leaf apex is a known defense strategy in Solanaceae, potentially related to guttation or the directed
accumulation of toxins to deter herbivores at the most exposed parts of the leaf.
* Cluster 6 (Mixed Apical/Patchy): This cluster exhibits a unique combination of apical concentration and large, patchy
distributions across the leaf surface. Hyoscyamine ($m/z \approx 290$) was assigned to this domain, suggesting a dual role of
storage in specialized tissues (patchy "islands") and accumulation at the leaf tips for localized defense.
3.2.3 Compartmentalized Patchy Distributions (Clusters 0, 4, 5, and 9)
* Clusters 0, 4, and 5 (Patchy/Islands): These clusters present "island-like" or spotted patterns of varying sizes across the entire
leaf. Cluster 5 features numerous small islands, Cluster 9 shows medium-sized spots, and Clusters 0 and 4 exhibit large, active
spots. In Datura, these patterns are highly characteristic of glandular trichomes or specialized epidermal cells where secondary
metabolites are sequestered to avoid self-toxicity while remaining accessible for rapid defense response.
3.2.4 Ubiquitous Homogeneous Background (Cluster 2)
* Cluster 2 (Universal Distribution): This cluster encompasses ions distributed uniformly across the entire leaf surface. These
signals are likely associated with primary metabolism (e.g., chlorophylls, lipids, and structural carbohydrates) or common
background signals inherent to the biological matrix, serving as the metabolic baseline of the leaf tissue.
---
## 4. Conclusion
The integration of a hybrid Julia-Python pipeline (Sierra-Álvarez et al., 2025; Rosas-Román et al., 2024) represents a significant advancement in the democratization of advanced MSI analysis. While Julia overcomes performance barriers in massive data ingestion, contrastive learning in Python enables objective and automated biological interpretation. This approach establishes a standard for spatial metabolomics studies where tissue complexity exceeds manual analysis capacity.
---
## 5. References
* **Cole, L. M., & Clench, M. R. (Eds.). (2023).** *Imaging Mass Spectrometry: Methods and Protocols*. Springer US. https://doi.org/10.1007/978-1-0716-3319-9
* **García-Rojas, N. S., Sierra-Álvarez, C. D., et al. (2024).** Identification of Plant Compounds with Mass Spectrometry Imaging (MSI). *Metabolites*, 14(8), 419. https://doi.org/10.3390/metabo14080419
* **Hu, H., Bindu, J. P., & Laskin, J. (2022).** Self-supervised clustering of mass spectrometry imaging data using contrastive learning. *Chemical Science*, 13(1), 90–98. https://doi.org/10.1039/d1sc04077d
* **Moreno-Pedraza, A., Rosas-Román, I., et al. (2019).** Elucidating the Distribution of Plant Metabolites from Native Tissues with Laser Desorption Low-Temperature Plasma Mass Spectrometry Imaging. *Analytical Chemistry*, 91(4), 2734–2743. https://doi.org/10.1021/acs.analchem.8b04406
* **Rosas-Román, I., Guillén-Alonso, H., et al. (2024).** Technical Note: mzML and imzML Libraries for Processing Mass Spectrometry Data with the High-Performance Programming Language Julia. *Analytical Chemistry*, 96(10), 3999–4004. https://doi.org/10.1021/acs.analchem.3c05853
* **Schlesinger, D., et al. (2021).** Tropane alkaloid biosynthesis in Datura innoxia Mill. roots and their differential transport to shoots. *Phytochemistry Letters*, 43, 219–225. https://doi.org/10.1016/j.phytol.2021.04.012
* **Schramm, T., et al. (2012).** imzML — A common data format for the flexible exchange and processing of mass spectrometry imaging data. *Journal of Proteomics*, 75(16), 5106–5110. https://doi.org/10.1016/j.jprot.2012.07.026
* **Sierra-Álvarez, J. J., ..., Sierra-Álvarez, C. D., et al. (2025).** JuliaMSI: A high-performance graphical platform for mass spectrometry imaging data analysis. *Analytica Chimica Acta*, 1377, 344613. https://doi.org/10.1016/j.aca.2025.344613
* **Ziegler, J., & Facchini, P. J. (2008).** Alkaloid Biosynthesis: Metabolism and Trafficking. *Annual Review of Plant Biology*, 59(1), 735–769. https://doi.org/10.1146/annurev.arplant.59.032607.092730