MSMetaEnhancer
MSMetaEnhancer is a tool used for .msp files annotation.
It adds metadata like SMILES, InChI, and CAS number fetched from the following services: CIR, CTS, PubChem, IDSM, BridgeDb, Wikidata, and ChEBI.
The app uses asynchronous implementation of annotation process allowing for optimal fetching speed.
If you use MSMetaEnhancer in your work, please cite the following publication:
Troják et al., (2022). MSMetaEnhancer: A Python package for mass spectra metadata annotation. Journal of Open Source Software, 7(79), 4494, https://doi.org/10.21105/joss.04494
Usage
import asyncio
from MSMetaEnhancer import Application
from MSMetaEnhancer.libs.converters.web import (
CTS,
CIR,
IDSM,
PubChem,
BridgeDb,
Wikidata,
ChEBI,
)
from MSMetaEnhancer.libs.converters.compute import RDKit
from MSMetaEnhancer.libs.utils.ConverterBuilder import ConverterBuilder
ConverterBuilder.register([CTS, CIR, IDSM, PubChem, BridgeDb, Wikidata, ChEBI, RDKit])
app = Application()
# import your .msp file
app.load_data('sample.msp', file_format='msp')
# curate given metadata (e.g. fix CAS numbers)
app.curate_metadata()
# specify requested services (these are supported)
services = ['CTS', 'CIR', 'IDSM', 'PubChem', 'BridgeDb', 'Wikidata', 'ChEBI', 'RDKit']
# specify requested jobs
jobs = [('name', 'inchi', 'IDSM'), ('inchi', 'formula', 'IDSM'), ('inchi', 'inchikey', 'IDSM'),
('inchi', 'iupac_name', 'IDSM'), ('inchi', 'canonical_smiles', 'IDSM')]
# run asynchronous annotations of spectra data
asyncio.run(app.annotate_spectra(services, jobs))
# export .msp file
app.save_data('sample_out.msp', file_format='msp')
Installation
Prerequisites:
- Python 3.10 - 3.13
Install MSMetaEnhancer from Bioconda with:
# install MSMetaEnhancer in a new virtual environment to avoid dependency clashes
conda create --name MSMetaEnhancer python=3.12
conda activate MSMetaEnhancer
conda install --channel bioconda --channel conda-forge MSMetaEnhancer
Alternatively, install it from PyPI into any environment of your choice:
pip install msmetaenhancer
Developer Documentation
Setup
Development dependencies, the virtual environment and the package itself are all managed
by uv. Install uv once (e.g. pip install uv, or
conda install --channel conda-forge uv), clone the repository and run:
uv sync
This creates .venv in the repository root, installs the locked dependencies together with
the dev group, and installs MSMetaEnhancer in editable mode. A conda environment can
still be created from the provided script if you prefer conda;
it provides uv and Python, and uv sync then fills in the rest.
Run everything through uv run so that it uses this environment:
uv run pytest # tests
uv run ruff check . # lint
uv run pre-commit install # git hooks
uv run --group docs sphinx-build -b html docs/source docs/build/html # documentation
Dependencies are pinned in the committed uv.lock. After changing the dependencies in
pyproject.toml, refresh the lock with uv lock and reinstall with uv sync — CI installs
with uv sync --frozen and therefore fails if the two are out of sync.
Contributing
We appreciate contributions - feel free to open an issue on our repository, create your own fork, work on the problem and post a PR. Please add your contributions to the changelog and to adhere to the versioning. For more information see here.
Testing
All functionality is tested with the pytest framework.
Run the test suite with uv run pytest.
Metadata
Release files for msmetaenhancer 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msmetaenhancer-0.7.0.tar.gz | 28.7 kB | Without provenance | Details for msmetaenhancer-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msmetaenhancer-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for msmetaenhancer-0.7.0-py3-none-any.whl |
Total release size: 67.1 kB
Release files / msmetaenhancer-0.7.0.tar.gz
| Download URL | msmetaenhancer-0.7.0.tar.gz |
|---|---|
| Size | 28.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd90875139f31b39dbcc078cebae2412aa114d7a51956227187148414335468d
|
|
BLAKE2b-256 checksum How to use checksums |
5af45eb2cbf2d29a44590656eebb52822db2bd48e86cea41f8b8be5c65d3b2da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / msmetaenhancer-0.7.0-py3-none-any.whl
| Download URL | msmetaenhancer-0.7.0-py3-none-any.whl |
|---|---|
| Size | 38.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
929b673fc93faf8ad373eb04910f2ca966eb73b9d40abb3a44f0691bc3b4f926
|
|
BLAKE2b-256 checksum How to use checksums |
8e432d01cea263933aff0f8f4b8d17e241d8a72c62ad17a10464b30e0b23d28e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for msmetaenhancer 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.