Skip to main content

Deep learning model for MS2 data annotation

Project description

MS2Function

MS2Function provides MS2 spectrum annotation and metabolite set analysis powered by MS2BioText models. Large model/data assets are hosted on Hugging Face Hub and are downloaded automatically on first use.

Install

pip install ms2function

Or for local development:

pip install -e .

Assets (Hugging Face Hub)

Default asset repo: cgxjdzz/ms2function-assets

The package looks for the following files:

  • models/best_model.pth
  • models/config.json
  • data/hmdb_subsections_WITH_NAME.jsonl
  • data/all_jsonl_embeddings.pt

Environment overrides:

  • MS2FUNCTION_ASSET_DIR (use local assets directory)
  • MS2FUNCTION_ASSET_REPO (override HF repo id)
  • HUGGINGFACE_HUB_TOKEN or HF_TOKEN (for private repos)

Quickstart (single spectrum)

from pathlib import Path
from MS2Function import run_single

json_input = {
    "peaks": [[100.1, 200.0], [150.2, 300.0]],
    "precursor_mz": 250.3,
}

result = run_single(json_input, project_root=Path(r"d:\NTU\MS2Function"))
print(result)

Quickstart (metabolite set)

from pathlib import Path
from MS2Function import run_set

result = run_set(
    r"d:\path\to\your.csv",
    project_root=Path(r"d:\NTU\MS2Function"),
)
print(result)

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

ms2function-0.1.1.tar.gz (80.0 kB view details)

Uploaded Source

Built Distribution

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

ms2function-0.1.1-py3-none-any.whl (85.4 kB view details)

Uploaded Python 3

File details

Details for the file ms2function-0.1.1.tar.gz.

File metadata

  • Download URL: ms2function-0.1.1.tar.gz
  • Upload date:
  • Size: 80.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ms2function-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1f00c3808a33b083f8737d478bfc986a1445e280efde6764eb872a30a7279dc5
MD5 b6bd121adb87e82945e4067fb55a5f64
BLAKE2b-256 4db1ee2442c1255f5bc48871f1dafd64f565a2db42b67b84da3850a45eec9cb8

See more details on using hashes here.

File details

Details for the file ms2function-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ms2function-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 85.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ms2function-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3082fcafed57a57a331bd432a96d9417b95637392aee92ec11c1099d9749bf95
MD5 58d92de645b83dbc8fa58d57799647b7
BLAKE2b-256 0d929a2acafdea307c896368b2cb35960e51ba64776ad3ca4f2a31c5bf45a1f9

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