RamanSPy: An Open-Source Python Package for Integrative Raman Spectroscopy Data Analysis

Dimitar Georgiev, Simon Vilms Pedersen, Ruoxiao Xie, A. Fernandez-Galiana, Molly M. Stevens, Mauricio Barahona

Introduction

Raman spectroscopy (RS) is a powerful, non-destructive technique for label-free chemical analysis, with applications ranging from cancer diagnostics to mineralogy. Despite its potential, the field is often hindered by a "software bottleneck." Most data analysis is performed using proprietary, "black-box" software provided by hardware vendors, leading to fragmented workflows, data silos, and a lack of standardization.

To address these challenges, we introduce RamanSPy, an open-source Python package designed to standardize and streamline the entire Raman spectroscopy data analysis lifecycle. By providing a modular, technology-agnostic framework, RamanSPy bridges the gap between raw spectral data and the modern Python ecosystem for machine learning (ML) and artificial intelligence (AI).

Methods and Architecture

RamanSPy is built on a modular, object-oriented architecture designed for flexibility and reproducibility.

RamanSPy workflow and core features alongside a representative code snippet.

The core components include:

  • Common Data Representation: A SpectralContainer class serves as a universal translator for 1D spectra, 2D images, and 3D volumes from various vendors.
  • Preprocessing Suite: A library of standardized tools for denoising, baseline correction (e.g., ASLS, asPLS), cosmic spike removal, and normalization.
  • Pipelining Infrastructure: A dedicated Pipeline class allows users to stack preprocessing steps into reproducible workflows that can be saved and shared.
  • Analysis & Visualization: Modules for spectral unmixing (N-FINDR), clustering (K-Means), and decomposition (NMF), complemented by high-level plotting tools.
  • AI Integration: The framework is designed to be "permeable," allowing users to wrap PyTorch or TensorFlow models as preprocessing or analysis steps seamlessly.

Datasets and Applications

The utility of RamanSPy is demonstrated through several high-quality datasets:

  • THP-1 Cells: Volumetric Raman scans of human leukemia monocytic cells used for morphological analysis.
  • Bacterial Isolates: A dataset of 30 isolates used to benchmark 28 different ML classification models.
  • Breast Cancer Cells: Spectra from MDA-MB-231 cells used to validate deep-learning-based denoising models like ResUNet.
Application of RamanSPy to THP-1 cell data, showing (a) brightfield imaging, (b) raw spectral data, and (c) a 3D protein distribution map.

Key Insights

The "Universal Translator" Approach

By decoupling analysis tools from specific hardware formats, RamanSPy enables cross-platform research. A pipeline developed for one system (e.g., WITec) can be effortlessly adapted for another (e.g., Renishaw).

Reproducibility and AI Accessibility

The ability to save entire preprocessing pipelines as objects is a significant step toward solving the reproducibility crisis in spectroscopy. Furthermore, RamanSPy lowers the barrier to entry for AI integration, making state-of-the-art deep learning accessible to spectroscopists without extensive coding expertise.

Key Results

  • Deep Learning Denoising: Integrated ResUNet denoisers significantly outperformed traditional Savitzky-Golay filters in low signal-to-noise scenarios.
  • Large-Scale Benchmarking: Benchmarking 28 ML models for bacterial identification revealed that Logistic Regression achieved 79.63% accuracy for species-level classification and 94.63% for antibiotic treatment classification.
  • Morphological Mapping: The package successfully performed spectral unmixing to produce clear 3D reconstructions of cellular organelles (lipids, nucleic acids, cytoplasm) in THP-1 cells without chemical labeling.

Limitations and Future Work

While versatile, RamanSPy currently focuses on Raman spectroscopy; future expansions could include other vibrational techniques like Infrared (IR) spectroscopy. The built-in dataset library is intended as a community-driven repository. Additionally, while array-based representation is efficient, extremely large 4D volumetric datasets may require further memory optimization or cloud integration.

Summary updated

BibTeX
@inproceedings{georgiev2024ramanspy,
  author = {Dimitar Georgiev and Simon Vilms Pedersen and Ruoxiao Xie and A. Fernandez-Galiana and Molly M. Stevens and Mauricio Barahona},
  title = {{RamanSPy: An Open-Source Python Package for Integrative Raman Spectroscopy Data Analysis}},
  booktitle = {Analytical},
  year = {2024},
  doi = {10.1021/acs.analchem.4c00383},
}
Figure