Metadata-Version: 2.4
Name: dcat-ap-plus-proteomics
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Typing :: Typed
Requires-Dist: chem-dcat-ap>=0.1.0rc3
Requires-Dist: dcat-ap-plus>=0.1.0rc4
Requires-Dist: linkml-runtime>=1.11
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.2
Requires-Dist: rdflib>=7.1
Requires-Dist: scidats>=0.0.20
Requires-Dist: scikit-image>=0.24
Requires-Dist: scipy>=1.13
Requires-Dist: dcat-ap-plus-proteomics[generators,validation,figures] ; extra == 'all'
Requires-Dist: matplotlib>=3.9 ; extra == 'figures'
Requires-Dist: linkml>=1.11 ; extra == 'generators'
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'
Requires-Dist: pyshacl>=0.30 ; extra == 'validation'
Provides-Extra: all
Provides-Extra: figures
Provides-Extra: generators
Provides-Extra: notebook
Provides-Extra: validation
License-File: LICENSE
Summary: Glycoproteomics datasets in DCAT-AP-PLUS and Chem-DCAT-AP, with refined triples.
Keywords: proteomics,glycoproteomics,DCAT-AP,Chem-DCAT-AP,NFDI4Cat,RDF,provenance,knowledge graph,mass spectrometry
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-proteomics/issues
Project-URL: Changelog, https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-proteomics/src/branch/main/CHANGELOG.md
Project-URL: documentation, https://dcat-ap-plus-proteomics.readthedocs.io
Project-URL: repository, https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-proteomics

# dcat-ap-plus-proteomics

Glycoproteomics datasets in DCAT-AP-PLUS and Chem-DCAT-AP, searched across laboratories and annotated with refined triples.

Status: pre-release. The interface is not stable.

This repository takes the NIST Glycopeptide Abundance Distribution Spectra (GADS) libraries and carries them through five steps. There are 34 libraries from 13 laboratories, measuring viral and human glycoproteins.

1. **Extraction.** A verified reader for the undocumented NIST binary format, and an audit of every stated mass against named conventions.
2. **Database search.** Every peptide is located in a pinned reference database by sequence alone. Every distribution is searched against every other library with two independent determinations, one numerical (composition vectors) and one visual (rendered images and SSIM). An answer is licensed only when they agree; otherwise the search declines and says why.
3. **Schema.** A LinkML extension of Chem-DCAT-AP with its generated OWL, SHACL and JSON-LD context, and a vocabulary for refined triples.
4. **Admission.** Which metadata to save, computed rather than chosen (Sachikonye, *Schema Admission*). Context fields are scored by the pairs of distributions they tell apart. Distributions are linked across laboratories by eliminating contradicted candidates before ranking. Inside groups the context cannot tell apart, the index (compositions, a bar image, a droplet image) proposes new fields, admitted under six conditions beside random controls. Six goals derive what each schema still lacks.
5. **Result files.** JSON-LD documents in the extension's vocabulary. Each holds a named graph per basis (stated, supplied, derived, refined, admitted), conforms to the shapes, and parses back to the same quads. The images, link decisions, field scores and admitted fields are in the file.

```mermaid
flowchart LR
  nist[NIST GADS] --> read[read · audit] --> map[map by sequence] --> search[two determinations<br/>licence or decline] --> emit[named graphs] --> refine[refined triples] --> jsonld[JSON-LD]
  map --> adm[field scores · links ·<br/>admitted slots · goals] --> emit
  read --> img[bar · droplet images] --> adm
  schema[LinkML schema] --> art[OWL · SHACL · context] --> jsonld
```

## Install

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

The wheel carries the Rust core and the 17 pinned reference sequences, 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; its last section asks UniProt through svar. Answers are written as [SciDatS](https://gitlab.com/opensourcelab/scientificdata/scidats) files with DCAT-AP-PLUS metadata (`dcat_ap_plus_proteomics.exchange`).

```python
from dcat_ap_plus_proteomics.engine import Engine

engine = Engine()                                   # the Rust core, in process
engine.peptide("R.FDNPVLPFnDGVYFASTEK.S")["mass"]   # under the GADS conventions
```

## Results

| | |
|---|---|
| records read and verified | 9,948 distributions, 158,058 peaks, 34 libraries |
| stated peptide masses explained | 9,948 of 9,948 (524 by a library writing convention) |
| peptides mapped by sequence | 1,262 of 1,271 exactly or by core |
| licensed cross-laboratory answers | 878, **precision 79.2 %** (chance 3.0 %) |
| declined answers | 9,070, each with its reason |
| cross-laboratory links, eliminate then rank | 4,643; none contradicted by a context field (ranking first: 7,526 at a contradicted site) |
| context cells, admitted slots | 1,874 cells; 14,855 slots individuate 9,910 distributions (context alone: 2,674) |
| producer as a stated field | decides insect-cell production with 0 errors; no context field or index feature does (best 1,064) |
| showcase result file | 44,087 quads, conforms to the shapes, round-trips |
| whole run, one result file per library | 34 files, 4,929,380 quads, every file conforms and round-trips (before the analysis graphs; to re-run) |

The surprises are as useful as the numbers. Laboratories number glycosites differently, by up to 696 residues. A stated peptide mass sometimes leaves out a residue. Confident cross-laboratory matches sometimes pair different proteins made the same way, because a distribution carries its producer's glycosylation as well as its site. Each of these is measured in [docs/specification](docs/specification/README.md) and listed with what can be done about it in [09 Findings](docs/specification/09-findings.md).

| Where | What |
|---|---|
| [`results/showcase/`](results/showcase/) | the result file for two libraries, with its manifest |
| [`results/evaluation/`](results/evaluation/) | `summary.json` and figures of the whole run |
| [`artefacts/`](artefacts/) | generated OWL, SHACL and JSON-LD context |
| [`src/dcat_ap_plus_proteomics/schema/`](src/dcat_ap_plus_proteomics/schema/) | the LinkML schemas (`proteomics.yaml`, `refined.yaml`) |
| [`results/admission/`](results/admission/) | field scores, joins, links, admitted slots, goals |
| [`notebooks/`](notebooks/README.md) | eleven notebooks of charts and workflow diagrams, one per part |
| [`docs/specification/`](docs/specification/README.md) | rules, measurements and checks, one file per part |
| [`docs/software/`](docs/software/README.md) | what each command does, step by step |

## Usage

Requires [uv](https://docs.astral.sh/uv/) and the NIST GADS libraries (`NISTMS-GADS` folder), which are not redistributed here.

```console
uv sync
export GADS_ROOT=/path/to/NISTMS-GADS
uv run dcat-ap-plus-proteomics search       # ~17 min once; cached in build/ by run stage
uv run dcat-ap-plus-proteomics admit        # results/admission/ (~15 min)
uv run dcat-ap-plus-proteomics emit         # results/showcase/
uv run dcat-ap-plus-proteomics evaluate     # results/evaluation/ (~13 min)
uv run dcat-ap-plus-proteomics artefacts    # artefacts/
uv run dcat-ap-plus-proteomics catalogue --validate   # results/full/, one file per library
```

Notebooks: `uv run --group notebooks python notebooks/build.py` (05–10 need only the committed results).

Without `GADS_ROOT` the default is the Lavoisier checkout this repository was developed in (`python/data/nist/nistms-gads/NISTMS-GADS`). The reference sequences are committed in `src/dcat_ap_plus_proteomics/data/reference/`; `scripts/fetch_references.py` re-fetches them.

## Rust engine and TypeScript views

The mass computing is also in Rust, with views in TypeScript, as in the sibling `dcat-ap-plus-metabolomics`:

| Path | What |
|---|---|
| `crates/proteomics-core/` | peptides under the GADS conventions, b/y ladders and the complementary-ion check, glycan compositions and the mass balance, tryptic digestion and sequons, glycosite networks and the GADS reader and audit |
| `crates/proteomics-cli/` | the command `proteomics`: `tool <name>` answers one artefact request on standard input; `proteomics tools` lists them |
| `crates/proteomics-wasm/` | the cores for JavaScript; a library is read from the bytes of its two files |
| `packages/proteomics/` | `@dcat-ap-plus/proteomics`: typed wrapper, SVG views (glycosite network, annotated spectrum, coverage map, class shares) and `demo/` |
| `src/dcat_ap_plus_proteomics/engine.py`, `protocol.py`, `views.py` | the Python client of the command and of the views |

The shared core `ms-core` is a git dependency on `dcat-ap-plus-metabolomics`, pinned in `Cargo.lock`. To build against a sibling checkout instead, write `paths = ["../dcat-ap-plus-metabolomics/crates/ms-core"]` into `.cargo/config.toml`, which is gitignored. A `paths` override leaves `Cargo.lock` unchanged. Notebooks 11 and 12 use the engine. The Rust audit agrees with the Python one record by record.

## Development

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. 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 proteomics-cli --release    # the engine the Python client finds
npm ci && npm run build && npm run typecheck && npm test
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
```

The tests need no NIST data: `tests/synthetic.py` writes libraries in the NIST binary layout from real spike peptides, and the whole pipeline (reading, mapping, search, emission, refinement, JSON-LD, SHACL) runs on them. Tests marked `gads` run against the real libraries when `GADS_ROOT` is set, and reproduce the committed showcase.

CI runs on git.uni-greifswald.de from `.gitea/workflows/ci.yml`. Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and carry no AI co-author trailers. See [CONTRIBUTING](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).

## Related

- `dcat-ap-plus-chromatography` (same author) uses the same conventions (own IRIs, own predicates, named graphs per basis) for chromatography. Two generic modules (`identifiers`, `census`) and the generator calls in `artefacts` are vendored from it at commit 98f0c47, and are candidates for a shared core package.
- Sachikonye, *Asserted and Refined Triples*: the construction implemented in `refinement`.
- Sachikonye, *Schema Admission*: field scores, joins, linking, slot admission and goals (`context`, `pairs`, `scores`, `joins`, `linking`, `admission`, `goals`).
- Lavoisier: the droplet image follows `lavoisier/visual/IonToDropletConverter.py`, with the corrections listed in `droplet.py`.

## Licence

MIT. See [LICENSE](LICENSE). The NIST GADS libraries are subject to NIST's terms and are not part of this repository.

