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.3.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.3-py3-none-any.whl (85.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spec2function-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 0f29365124af467f7e67d372cf219f8c19f924d1cbc4ef7bdfbbe9e9562bbf90
MD5 e38b3192604e459c4cf0c8a0433d9075
BLAKE2b-256 fbe3f035869004145a0b01116250f660ebb5e6b4ee153f828dcc7be3736f1d19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spec2function-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c73a6e74532415fe92c86e45463bc7c7c0e68558018e3ef014f3c343be85dec5
MD5 17c63f144d530a82b0085cd5b910dff8
BLAKE2b-256 27f168d40013dfa3239e94c6d6d4ed2186391f942c286814b7266bcfcc1e285a

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