Skip to main content

FIDDLE

License DOI Release

FIDDLE predicts molecular formulas from MS/MS spectra with deep learning.

Paper · Documentation · Try the demo on Hugging Face

Quick start

Install the msfiddle package, download the pre-trained models once, then predict formulas:

pip install "msfiddle[inference]"
msfiddle download
msfiddle predict --demo --result_path demo.csv        # 21 bundled example spectra

# your own spectra
msfiddle predict --test_data spectra.mgf --instrument_type orbitrap --result_path results.csv

Use --instrument_type qtof for Q-TOF data and --instrument_type timstof for timsTOF data. Each spectrum needs TITLE, PRECURSOR_MZ, PRECURSOR_TYPE and COLLISION_ENERGY. The results list ranked candidates per spectrum in Refined Formula (0), Refined Formula (1), … with their scores in Rescore (k).

When the true formulas are known (a SMILES or FORMULA field in each spectrum), add --eval to also report top-k accuracy, saved as results_eval.csv.

The documentation covers the Python API, BUDDY and SIRIUS integration, custom checkpoints, all output columns, and benchmark results.

Reproduce the paper

This repository also holds the research code for training and evaluation. Run everything from the repository root (FIDDLE/).

  1. Create the environment with Anaconda (use environment_mac.yml on Apple Silicon):
conda env create -f environment.yml
  1. (optional) Install BUDDY and SIRIUS for the comparison experiments. SIRIUS needs a free account; log in once as install_sirius.sh prints at the end.
bash running_scripts/install_buddy.sh
bash running_scripts/install_sirius.sh
  1. Download the models into ./check_point/, where the scripts expect them:
msfiddle download -d ./check_point
Script Description
running_scripts/train_release_v2.3.sh Build the data, train the release models (TCN and rescore) for Q-TOF, Orbitrap and timsTOF in parallel and evaluate them; INSTRUMENTS=timstof runs one of them. timsTOF trains on the Enveda CASMI 2026 library at data/origin/casmi2026/train.parquet
running_scripts/experiments_test_benchmark.sh Evaluate on external benchmarks (CASMI 2016, CASMI 2017, EMBL-MCF 2.0)
running_scripts/experiments_test_nist23.sh Train and evaluate with compounds new in NIST23 held out
running_scripts/experiments_test_chimeric.sh Evaluate on chimeric spectra
running_scripts/experiments_test_noised.sh Evaluate on spectra with added noise peaks

The benchmark, chimeric and noise experiments use the released models; the chimeric and noise ones also need the data those models were trained on.

To train from scratch, see scripts/train_tcn_gpus_cl.py and scripts/train_rescore.py with the configs in msfiddle/config/.

Citation

If you use FIDDLE, please cite:

@article{hong2025fiddle,
  title={FIDDLE: a deep learning method for chemical formulas prediction from tandem mass spectra},
  author={Hong, Yuhui and Li, Sujun and Ye, Yuzhen and Tang, Haixu},
  journal={Nature Communications},
  volume={16},
  number={1},
  pages={11102},
  year={2025},
  publisher={Nature Publishing Group UK London}
}

Metadata

Release files for msfiddle 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for msfiddle 2.3.0
File Size Uploaded Provenance
msfiddle-2.3.0.tar.gz 92.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for msfiddle 2.3.0
File Interpreter ABI Platform
msfiddle-2.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 184.6 kB

Release files / msfiddle-2.3.0.tar.gz

Download URL msfiddle-2.3.0.tar.gz
Size 92.0 kB
Tags Source
SHA-256 checksum
How to use checksums
023aa6339b2ddebf47d9f6aacc9c810663763dae79d68c9781918c5b4022650d
BLAKE2b-256 checksum
How to use checksums
a3f9a1b2d55fbed879f2cfa77b78d6067bdc844475fda0d7bc15d20bd6f75cc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / msfiddle-2.3.0-py3-none-any.whl

Download URL msfiddle-2.3.0-py3-none-any.whl
Size 92.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7687fed58984b0b93bcfb831d71debdaec485cdc12823ce159ff998e9f7a72fd
BLAKE2b-256 checksum
How to use checksums
d29527c2029a410dc100936a54a6140e52b8dc221a621510c9d6f29a5725d218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for msfiddle 2.3.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page