Metadata-Version: 2.4
Name: dcat-ap-plus-metabolomics
Version: 0.1.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: dcat-ap-plus>=0.1.0rc5
Requires-Dist: pandas>=2.2
Requires-Dist: scidats>=0.0.20
Requires-Dist: anywidget>=0.9 ; extra == 'notebook'
Requires-Dist: ipykernel>=6.29 ; extra == 'notebook'
Requires-Dist: spectacular-charts[notebook]>=0.2 ; extra == 'notebook'
Requires-Dist: svar-query>=0.1 ; extra == 'notebook'
Provides-Extra: notebook
License-File: LICENSE
Summary: Metabolomics extension of DCAT-AP-PLUS.
Author-email: Kundai Farai Sachikonye <kundai.sachikonye@uni-greifswald.de>
Maintainer: Kundai Farai Sachikonye
License: MIT
Requires-Python: ==3.13.*
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Bug Tracker, https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-metabolomics/issues
Project-URL: Changelog, https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-metabolomics/src/branch/main/CHANGELOG.md
Project-URL: documentation, https://dcat-ap-plus-metabolomics.readthedocs.io
Project-URL: repository, https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-metabolomics

# dcat-ap-plus-metabolomics

Metabolomics extension of the extension of the Data Catalog Vocabulary (DCAT) application profile by NFDI4Chem and NFDI4Cat (DCAT-AP-PLUS).

Status: in development; the interface is not stable. The plan is in [docs/specification](docs/specification/README.md): the tasks the extension hands to Lavoisier, the typed verdicts it records, the exchanges with the sibling graphs, and the predictions to test first. It follows the conventions of the sibling extensions `dcat-ap-plus-proteomics` and `dcat-ap-plus-microbiology`. Nothing here is endorsed by DCAT-AP-PLUS or NFDI4Cat.

The work is split by language, and all heavy computing is in Rust. `ms-core` holds masses, isotopes, similarity, partition coordinates, S-entropy and its ternary trie, contact graphs and their cuts, process ladders and virtual substates. It also reads MSP (the text format of mass-spectral libraries), MGF (Mascot Generic Format), mzML and MassBank record files. `metabolomics-core` holds the library conventions, the isomer harness and the contact method of CASMI (Critical Assessment of Small Molecule Identification). The command `metabolomics` answers the artefact tool protocol. The Python package carries the same commands as an extension module, writes answers as [SciDatS](https://gitlab.com/opensourcelab/scientificdata/scidats) files with DCAT-AP-PLUS metadata, and drives the notebooks. The UI and the views are TypeScript over the same cores compiled to WebAssembly.

## Install

```console
pip install "dcat-ap-plus-metabolomics[notebook]"
```

The wheel carries the Rust core, so nothing needs compiling (wheels for Windows and Linux x86-64, Python 3.13). The `notebook` extra adds the linked charts ([spectacular-charts](https://pypi.org/project/spectacular-charts/)), the query service ([svar-query](https://pypi.org/project/svar-query/)) and the notebook widget the views are drawn with. The notebook [docs/notebooks/00-the-framework-in-one-pass.ipynb](docs/notebooks/00-the-framework-in-one-pass.ipynb) runs from the installed package alone, on 15 MassBank records shipped with it; its last section asks PubChem through svar.

```python
from dcat_ap_plus_metabolomics import datasets
from dcat_ap_plus_metabolomics.engine import Engine

engine = Engine()                          # the Rust core, in process
engine.audit(datasets.massbank())          # {'records': 15, 'written_from_formula': 15, ...}
```

## Layout

The layout, tooling and documentation come from the [opensourcelab copier-python template](https://gitlab.com/opensourcelab/software-dev/copier-python) (`.copier-answers.yml` records the version), so `uvx copier update --trust` can apply later template releases.

| Path | What |
|---|---|
| `crates/ms-core/` | the mass-spectrometry core shared with `dcat-ap-plus-proteomics` (which depends on it by git URL) |
| `crates/metabolomics-core/` | library conventions, the contact method, the isomer harness |
| `crates/metabolomics-cli/` | the command `metabolomics`: `tool <name>` answers one artefact request on stdin; `metabolomics tools` lists them |
| `crates/metabolomics-wasm/` | the cores for JavaScript (wasm-bindgen) |
| `packages/metabolomics/` | `@dcat-ap-plus/metabolomics`: typed wrapper, SVG views, `demo/` |
| `crates/metabolomics-py/` | the extension module `dcat_ap_plus_metabolomics._core` (PyO3, built by maturin) |
| `src/dcat_ap_plus_metabolomics/` | the Python package: `engine` (the commands, in process or as the binary), `protocol` (requests, answers, refusals), `exchange` (answers as SciDatS files), `views` (the TypeScript views), `datasets` (the bundled MassBank records) |
| `docs/notebooks/` | notebooks that run from the installed package ([README](docs/notebooks/README.md)) |
| `jupyter/` | demonstration notebooks, executed on the NIST AC/CAC 2020 library ([README](jupyter/README.md)) |
| `tests/` | pytest tests |
| `docs/` | Sphinx documentation (MyST Markdown) |
| `.gitea/workflows/ci.yml` | CI on git.uni-greifswald.de; `.github/workflows/` is kept for a GitHub mirror |

## Development

Requirements: [uv](https://docs.astral.sh/uv/) and Python 3.13; Rust (the version in `rust-toolchain.toml`); Node 24 and [wasm-pack](https://rustwasm.github.io/wasm-pack/) for the TypeScript package.

```console
cargo fmt --all --check && cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo build -p metabolomics-cli --release    # the engine the Python client finds

npm ci && npm run build --workspaces          # wasm-pack, then tsc
npm run typecheck --workspaces && npm test --workspaces

uv sync
uv run pre-commit install --hook-type commit-msg
uv run ruff check . && uv run ruff format --check .
uv run zuban check
uv run pytest
```

Two checks need the acylcarnitine library AC/CAC 2020 of NIST (National Institute of Standards and Technology), which is not distributed here. They are the library test (`AC_CAC_MSP=… cargo test -p metabolomics-core`) and the notebooks (`NOTEBOOKS=1 uv run --group notebooks pytest tests/test_notebooks.py`).

Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and carry no AI co-author trailers; the commit-msg hooks and CI check both. See [CONTRIBUTING](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).

## Licence

MIT. See [LICENSE](LICENSE).

