Skip to main content

Deep learning model for MS2 data annotation

Project description

Spec2Function

Spec2Function 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 spec2function

Or for local development:

pip install -e .

Assets (Hugging Face Hub)

Default asset repo: cgxjdzz/spec2function-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 Spec2Function 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\Spec2Function"))
print(result)

Quickstart (metabolite set)

from pathlib import Path
from Spec2Function import run_set

result = run_set(
    r"d:\path\to\your.csv",
    project_root=Path(r"d:\NTU\Spec2Function"),
)
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

spec2function-0.1.2.tar.gz (80.8 kB view details)

Uploaded Source

Built Distribution

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

spec2function-0.1.2-py3-none-any.whl (85.8 kB view details)

Uploaded Python 3

File details

Details for the file spec2function-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for spec2function-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f15c1502283bdbe34d9d312bb8abb3021a0e4eadede355f866c33b27d59b30ed
MD5 47734e90af693939a4249538f265b015
BLAKE2b-256 990be0f6634632169799e28350be943f16ecad885ec0cf1968d70e697435ed9a

See more details on using hashes here.

File details

Details for the file spec2function-0.1.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for spec2function-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f64decce79272225798841fd387b72b18250a290c8a91e61558a4ecc494ad6e8
MD5 28d144f2cbbdb41a80ae48744838b1fe
BLAKE2b-256 4f47f9ad2ff3e5b5f8be7d25e1db665456b6b755e24ff75e8f26efa523cd0a66

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