Skip to main content

A package for predicting chemical formulas from tandem mass spectra

Project description

msfiddle

Source code for the FIDDLE PyPI package featuring:

  • Chemical formula prediction from MS/MS spectra
  • Formula refinement with confidence score estimation
  • Seamless integration with BUDDY and SIRIUS tools

Preprint: https://doi.org/10.1101/2024.11.25.625316

For the complete experimenal codes, please visit the GitHub repository: https://github.com/JosieHong/FIDDLE

Installation

# Install msfiddle (without PyTorch)
pip install msfiddle

To use msfiddle, you need to install torch>=1.13.0,<2.0.0 separately with the appropriate version for your system. Please refer to the official PyTorch installation guide: 🔗 PyTorch Installation Guide.

Usage

Step 1: Download pre-trained models

# Download models to the default location (inside the package directory)
msfiddle-download-models

# Or specify a custom location and models
msfiddle-download-models --destination /path/to/models \
                          --models fiddle_tcn_qtof fiddle_fdr_qtof

Step 2: Run predictions

Using demo data (simplest option)

# Run prediction with the built-in demo data
msfiddle --demo --result_path ./output_demo.csv --device 0

Using your own data:

# Run prediction with your data - automatically selects appropriate model
msfiddle --test_data /path/to/data.mgf \
         --instrument_type orbitrap \
         --result_path /path/to/results.csv \
         --device 0

The --instrument_type parameter can be either orbitrap (default) or qtof.

Below is an example of input MS/MS data formatted in .mgf. The fields TITLE, PRECURSOR_MZ, PRECURSOR_TYPE, and COLLISION_ENERGY are required for msfiddle processing:

BEGIN IONS
TITLE=EMBL_MCF_2_0_HRMS_Library000529
PEPMASS=111.02016
CHARGE=1-
PRECURSOR_TYPE=[M-H]-
PRECURSOR_MZ=111.02016
COLLISION_ENERGY=50.0
SMILES=[H]c1c([H])n([H])c(=O)n([H])c1=O
FORMULA=C4H4N2O2
THEORETICAL_PRECURSOR_MZ=111.019453
PPM=6.368253318682487
SIMULATED_PRECURSOR_MZ=111.01946768634916
41.0148 0.329893 
41.9986 89.226766 
55.8055 0.200544 
56.2625 0.194617 
67.0304 0.330612 
68.0258 0.402906 
111.0203 100.0 
112.0515 1.2809 
END IONS

Additional Options

Show all model paths:

msfiddle-checkpoint-paths

Advanced usage with custom paths:

msfiddle --test_data /path/to/data.mgf \
         --config_path /path/to/config.yml \
         --resume_path /path/to/tcn_model.pt \
         --fdr_resume_path /path/to/fdr_model.pt \
         --result_path /path/to/results.csv \
         --device 0

Citation

@article{hong2024fiddle,
  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={bioRxiv},
  pages={2024--11},
  year={2024},
  publisher={Cold Spring Harbor Laboratory}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msfiddle-0.1.0.tar.gz (49.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

msfiddle-0.1.0-py3-none-any.whl (58.8 kB view details)

Uploaded Python 3

File details

Details for the file msfiddle-0.1.0.tar.gz.

File metadata

  • Download URL: msfiddle-0.1.0.tar.gz
  • Upload date:
  • Size: 49.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for msfiddle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f0070fc77a6adaa4bcfae2c4851fa49f15b88724b0dcd9fdd87f41b308079e3
MD5 613eda4cdbf9d60f9789806c8906fbab
BLAKE2b-256 75b846d62c28492bad9c2f2fe6aab2f63657a5daa4706218d36f263d59a2f8c9

See more details on using hashes here.

File details

Details for the file msfiddle-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: msfiddle-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 58.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for msfiddle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea6f8d549e8973688da471b590de2a4945829f60bf8e3f1aad36a8f990f098cd
MD5 f4b02ea7ef0359db33b8707df85f9b07
BLAKE2b-256 04a77af43671345648e6d72f1aac00c1195010f55df38fc451d27d944502520b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page