Abstract
Mass spectrometry (MS) is a key technology used across multiple fields, including biomedical research and life sciences. Technological advancements result in increasingly large and complex data sets and analyses must be tailored to the experimental and instrumental setups. Excellent software libraries for such data analysis are available in both R and Python, including R packages from the RforMassSpectrometry initiative and Python libraries like matchms, spectrum_utils, Pyteomics and pyOpenMS. Having partially complimentary functionality, these software cover different aspects of MS-based proteomics or metabolomics data analysis.
The reticulate R package provides an R interface to Python enabling interoperability between the two programming languages. Here we present the SpectriPy R package that builds upon reticulate and provides functionality to efficiently translate between R and Python MS data structures. It can convert between R’s Spectra::Spectra and Python’s matchms.Spectrum and spectrum_utils.spectrum.MsmsSpectrum objects and includes functionality to directly apply spectral similarity, filtering, normalization, etc. routines from the Python matchms library on MS data in R. SpectriPy hence enables and simplifies the integration of R and Python for MS data analysis, empowering data analysts to benefit from the full power of algorithms in both programming languages. Furthermore, software developers can reuse algorithms across languages rather than re-implementing them, enhancing efficiency and collaboration.