Skip to main content

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)

Metadata

Release files for ms2function 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ms2function 0.1.1
File Size Uploaded Provenance
ms2function-0.1.1.tar.gz 80.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ms2function 0.1.1
File Interpreter ABI Platform
ms2function-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 165.5 kB

Release files / ms2function-0.1.1.tar.gz

Download URL ms2function-0.1.1.tar.gz
Size 80.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1f00c3808a33b083f8737d478bfc986a1445e280efde6764eb872a30a7279dc5
BLAKE2b-256 checksum
How to use checksums
4db1ee2442c1255f5bc48871f1dafd64f565a2db42b67b84da3850a45eec9cb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / ms2function-0.1.1-py3-none-any.whl

Download URL ms2function-0.1.1-py3-none-any.whl
Size 85.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3082fcafed57a57a331bd432a96d9417b95637392aee92ec11c1099d9749bf95
BLAKE2b-256 checksum
How to use checksums
0d929a2acafdea307c896368b2cb35960e51ba64776ad3ca4f2a31c5bf45a1f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for ms2function 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page