Skip to content

jaspershen-lab/Spec2Function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages