Abstract
Mass spectrometry (MS) is a key technology used across multiple fields, including biomedical research and life sciences. The data is often times large and complex, 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 such as Spectra, MsCoreUtils, MetaboAnnotation, and CompoundDb (Rainer et al., 2022), as well as Python libraries like matchms (Huber et al., 2020), spectrum_utils (Bittremieux, 2020), Pyteomics (Goloborodko et al., 2013), and pyOpenMS (Röst et al., 2014). The reticulate R package (Ushey et al., 2025) provides an R interface to Python enabling interoperability between the two programming languages. The open-source SpectriPy R package 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.