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. 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, and all output columns.

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.

  2. Download the models into ./check_point/, where the scripts expect them:

msfiddle download -d ./check_point
Script Description
running_scripts/train_release_v2.2.sh Build the data and train the release models (TCN and rescore, Q-TOF and Orbitrap)
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 built by train_release_v2.2.sh.

To train from scratch, see scripts/train_tcn_gpus.py, 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.2.1

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.2.1
File Size Uploaded Provenance
msfiddle-2.2.1.tar.gz 77.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 158.3 kB

Release files / msfiddle-2.2.1.tar.gz

Download URL msfiddle-2.2.1.tar.gz
Size 77.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3bae3e7267fa96831b060af2cf9532cf5e24b309977ba1f484b62b560276da3c
BLAKE2b-256 checksum
How to use checksums
e17760198f0afbd5cc9c1bfb739018ba98a42dbf7c44684140829b25fa42f3a8
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.2.1-py3-none-any.whl

Download URL msfiddle-2.2.1-py3-none-any.whl
Size 80.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec1c3113810d1bea816743a836faf0a8d85b52537f767b6755778b35a83ca2e0
BLAKE2b-256 checksum
How to use checksums
c6a4002996f255bf4a9e0fdd1456fa174ac745a82b280f8f9986a9c0bd40b477
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.2.1

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