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.0.tar.gz (63.8 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.0-py3-none-any.whl (69.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ms2function-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3db979e97982316f7cb7cb8e9789e4c89fd49550cfbd2ba9ca6497ca7c2ce887
MD5 c9b7e076b632f6c0d1b6b5951cf418d2
BLAKE2b-256 eaa5d3d15bdd20c009413ff59b368843f71eae1123b611660912a3d637d31cf9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ms2function-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f16d16e2787dba17cc733e4a76faf456707eb330286836aba17b1a3a2390193
MD5 9d4fb96985a69d8812396c38bfba609c
BLAKE2b-256 c2fd4a9063505a69e5d17fb02dc21936e4ece3d9e5c72f1d42de3d5308d65233

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