SpectriPy
SpectriPy: Enhancing Cross-Language Mass Spectrometry Data Analysis with R and Python - Published in JOSS (2025)
Science Score: 98.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 7 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
○Academic email domains
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Repository
Interfacing R's Spectra package with the Python world.
Basic Info
- Host: GitHub
- Owner: rformassspectrometry
- License: artistic-2.0
- Language: R
- Default Branch: main
- Homepage: https://rformassspectrometry.github.io/SpectriPy/
- Size: 6.08 MB
Statistics
- Stars: 12
- Watchers: 4
- Forks: 7
- Open Issues: 8
- Releases: 1
Topics
Metadata Files
README.md
Enhancing Cross-Language Mass Spectrometry Data Analysis with R and Python

The SpectriPy package allows integration of Python MS packages into a
Spectra-based MS analysis
in R. By wrapping Python functionality into R functions, SpectriPy allows a
seamless integration of Python libraries into R. For example, SpectriPy can
leverage the spectral similarity, filtering, normalization etc. calculations
from the Python matchms library and contains
functions to convert between R's Spectra::Spectra objects and
matchms.Spectrum and spectrum_utils.spectrum.MsmsSpectrum objects from the
Python matchms and
spectrum_utils libraries,
respectively. R and Python spectral objects are easily translated and available
in one workflow (i.e., a quarto document), enabling the advanced user or
developer to create custom functions or workflows on Spectra objects in Python
and executing them in R using the reticulate R package, and vice versa.
If you use SpectriPy in your research, please cite:
Installation
SpectriPy needs Python (version >= 3.12) to be installed on the system. All
necessary Python libraries (listed below) are automatically installed by the
reticulate R package. SpectriPy's
Python library management uses the
py_require()
function introduced in reticulate version 1.41 and should hence work on most
system without problems. To install SpectriPy:
r
install.packages("BiocManager")
BiocManager("SpectriPy")
In addition it is possible to install the Python libraries manually (e.g., for
the system Python version) and specify the version of Python (or of the local
virtualenv or conda environment) using the RETICULATE_PYTHON or
RETICULATE_PYTHON_ENV environment variables. If any of these environment
variables are defined, all Python libraries listed below must be installed,
since SpectriPy (respectively reticulate) will not try to install them
automatically. The required Python libraries with the suggested and tested
versions are:
- matchms 0.30.0
- spectrum_utils 0.3.2
- numpy 2.2.0
See also sections Startup and Python configuration for more details or Fixing package installation or loading problems if installation or loading fails.
Documentation for users
See the extensive documentation for the use of SpectriPy:
- The rendered SpectriPy package’s vignette,
- The function reference,
- A tutorial for the annotation of LC-MS/MS spectra using an MGF library and the ModifiedCosine algorithm from matchms.
TLDR:
```r
' R session:
library(Spectra) library(SpectriPy) ```
Example: Spectra similarity calculations using matchms
The SpectriPy package provides the compareSpectriPy() function that allows
to perform spectra similarity calculations using the scoring functions from MS
Python packages. For example, the CosineGreedy parameter CosineGreedyParam from the
matchms Python package.
1) We create some simple example spectra.
```r
' R session:
library(Spectra) library(SpectriPy)
' Create a Spectra object with two MS2 spectra for Caffeine.
caf <- DataFrame( msLevel = c(2L, 2L), name = "Caffeine", precursorMz = c(195.0877, 195.0877) ) caf$intensity <- list( c(340.0, 416, 2580, 412), c(388.0, 3270, 85, 54, 10111)) caf$mz <- list( c(135.0432, 138.0632, 163.0375, 195.0880), c(110.0710, 138.0655, 138.1057, 138.1742, 195.0864)) caf <- Spectra(caf)
' Create a Spectra object with two MS2 spectra for 1-Methylhistidine
mhd <- DataFrame( msLevel = c(2L, 2L), precursorMz = c(170.0924, 170.0924), id = c("HMDB0000001", "HMDB0000001"), name = c("1-Methylhistidine", "1-Methylhistidine")) mhd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16)) mhd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643)) mhd <- Spectra(mhd) ```
2) We calculate pairwise similarities between all spectra defined above and
those of caffeine using Spectra's built-in compareSpectra() function.
```r
' R session:
all <- c(caf, mhd) resr <- compareSpectra(all, caf) resr ```
3) We calculate the similarity using the CosineGreedy function from matchms,
changing the tolerance to a value of 0.05 (instead of the default 0.1).
```r
' R session:
res <- compareSpectriPy(all, caf, param = CosineGreedy(tolerance = 0.05)) res ```
As a result compareSpectriPy() returns also a numeric matrix of similarities.
Note also that the first compareSpectriPy() call takes usually a little longer
because the Python setup has to be initialized.
Documentation for developers
See the developer notes.
Contributions
Contributions are highly welcome and should follow the contribution guidelines. General information on the package structure and some helpful pointers are given in the developer notes document. Also, please check the coding style guidelines and importantly, follow our code of conduct.
License
See the DESCRIPTION and LICENSE file.
Owner
- Name: RforMassSpectrometry
- Login: rformassspectrometry
- Kind: organization
- Email: maintainer@rformassspectrometry.org
- Website: https://www.rformassspectrometry.org/
- Repositories: 33
- Profile: https://github.com/rformassspectrometry
R packages for mass spectrometry
JOSS Publication
SpectriPy: Enhancing Cross-Language Mass Spectrometry Data Analysis with R and Python
Authors
Department of Exposure Science, Helmholtz Centre for Environmental Research - UFZ, Leipzig, Germany
Novo Nordisk Foundation Center for Basic Metabolic Research, University of Copenhagen, Copenhagen, Denmark
Institute for Bio- and Geosciences (IBG-5), Forschungszentrum Jülich GmbH, Jülich, Germany
Tags
Mass Spectrometry Cross-Language Integration Python Computational Efficiency Reproducible Workflows Proteomics MetabolomicsCitation (CITATION.cff)
cff-version: "1.2.0"
authors:
- family-names: Graeve
given-names: Marilyn De
orcid: "https://orcid.org/0000-0001-6916-401X"
- family-names: Bittremieux
given-names: Wout
orcid: "https://orcid.org/0000-0002-3105-1359"
- family-names: Naake
given-names: Thomas
orcid: "https://orcid.org/0000-0001-7917-5580"
- family-names: Huber
given-names: Carolin
orcid: "https://orcid.org/0000-0002-9355-8948"
- family-names: Anagho-Mattanovich
given-names: Matthias
orcid: "https://orcid.org/0000-0001-7561-7898"
- family-names: Hoffmann
given-names: Nils
orcid: "https://orcid.org/0000-0002-6540-6875"
- family-names: Marchal
given-names: Pierre
orcid: "https://orcid.org/0009-0006-6567-6257"
- family-names: Chrone
given-names: Victor
orcid: "https://orcid.org/0009-0007-2121-4066"
- family-names: Louail
given-names: Philippine
orcid: "https://orcid.org/0009-0007-5429-6846"
- family-names: Hecht
given-names: Helge
orcid: "https://orcid.org/0000-0001-6744-996X"
- family-names: Witting
given-names: Michael
orcid: "https://orcid.org/0000-0002-1462-4426"
- family-names: Rainer
given-names: Johannes
orcid: "https://orcid.org/0000-0002-6977-7147"
contact:
- family-names: Rainer
given-names: Johannes
orcid: "https://orcid.org/0000-0002-6977-7147"
doi: 10.5281/zenodo.15461604
message: If you use this software, please cite our article in the
Journal of Open Source Software.
preferred-citation:
authors:
- family-names: Graeve
given-names: Marilyn De
orcid: "https://orcid.org/0000-0001-6916-401X"
- family-names: Bittremieux
given-names: Wout
orcid: "https://orcid.org/0000-0002-3105-1359"
- family-names: Naake
given-names: Thomas
orcid: "https://orcid.org/0000-0001-7917-5580"
- family-names: Huber
given-names: Carolin
orcid: "https://orcid.org/0000-0002-9355-8948"
- family-names: Anagho-Mattanovich
given-names: Matthias
orcid: "https://orcid.org/0000-0001-7561-7898"
- family-names: Hoffmann
given-names: Nils
orcid: "https://orcid.org/0000-0002-6540-6875"
- family-names: Marchal
given-names: Pierre
orcid: "https://orcid.org/0009-0006-6567-6257"
- family-names: Chrone
given-names: Victor
orcid: "https://orcid.org/0009-0007-2121-4066"
- family-names: Louail
given-names: Philippine
orcid: "https://orcid.org/0009-0007-5429-6846"
- family-names: Hecht
given-names: Helge
orcid: "https://orcid.org/0000-0001-6744-996X"
- family-names: Witting
given-names: Michael
orcid: "https://orcid.org/0000-0002-1462-4426"
- family-names: Rainer
given-names: Johannes
orcid: "https://orcid.org/0000-0002-6977-7147"
date-published: 2025-05-19
doi: 10.21105/joss.08070
issn: 2475-9066
issue: 109
journal: Journal of Open Source Software
publisher:
name: Open Journals
start: 8070
title: "SpectriPy: Enhancing Cross-Language Mass Spectrometry Data
Analysis with R and Python"
type: article
url: "https://joss.theoj.org/papers/10.21105/joss.08070"
volume: 10
title: "SpectriPy: Enhancing Cross-Language Mass Spectrometry Data
Analysis with R and Python"
GitHub Events
Total
- Issues event: 38
- Watch event: 4
- Issue comment event: 85
- Member event: 2
- Push event: 211
- Pull request review comment event: 76
- Pull request review event: 100
- Pull request event: 71
- Fork event: 6
- Create event: 13
Last Year
- Issues event: 38
- Watch event: 4
- Issue comment event: 85
- Member event: 2
- Push event: 211
- Pull request review comment event: 76
- Pull request review event: 100
- Pull request event: 71
- Fork event: 6
- Create event: 13
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 31
- Total pull requests: 73
- Average time to close issues: 7 months
- Average time to close pull requests: 2 days
- Total issue authors: 7
- Total pull request authors: 12
- Average comments per issue: 2.55
- Average comments per pull request: 0.82
- Merged pull requests: 58
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 25
- Pull requests: 64
- Average time to close issues: 25 days
- Average time to close pull requests: 2 days
- Issue authors: 5
- Pull request authors: 9
- Average comments per issue: 1.0
- Average comments per pull request: 0.5
- Merged pull requests: 51
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- jorainer (17)
- Adafede (8)
- AnthonyOfSeattle (2)
- tnaake (1)
- hechth (1)
- chufz (1)
Pull Request Authors
- jorainer (32)
- mdgrv (14)
- tnaake (6)
- PiMarchal (4)
- guldchrone (4)
- chufz (3)
- michaelwitting (3)
- bittremieux (2)
- nilshoffmann (2)
- mmattano (2)
- hechth (1)
- danielskatz (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- R >= 4.1.0 depends
- BiocParallel * imports
- IRanges * imports
- ProtGenerics * imports
- S4Vectors * imports
- Spectra >= 1.5.8 imports
- basilisk * imports
- methods * imports
- reticulate * imports
- BiocStyle * suggests
- knitr * suggests
- patrick * suggests
- rmarkdown * suggests
- testthat * suggests
- actions/cache v2 composite
- actions/checkout v2 composite
- actions/upload-artifact master composite
- r-lib/actions/setup-pandoc master composite
- r-lib/actions/setup-r master composite