Metadata-Version: 2.3
Name: dcat-ap-plus-microbiology
Version: 0.1.0
Summary: Knowledge graphs of bacterial reactions in DCAT-AP-PLUS, completed by computation rather than by a reasoner, for organisms, colonies and federations of colonies.
Author: Kundai Farai Sachikonye
Author-email: Kundai Farai Sachikonye <kundai.sachikonye@uni-greifswald.de>
License: MIT
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: cobra>=0.32.1
Requires-Dist: networkx>=3.7
Requires-Dist: pyshacl>=0.40.2
Requires-Dist: rdflib>=7.6.0
Requires-Dist: scipy>=1.18.1
Requires-Dist: sympy>=1.14.0
Requires-Dist: dcat-ap-plus==0.1.0rc5 ; extra == 'tables'
Requires-Dist: scidats==0.0.20 ; python_full_version == '3.13.*' and extra == 'tables'
Maintainer: Kundai Farai Sachikonye
Requires-Python: >=3.12
Project-URL: Bug Tracker, https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-microbiology/issues
Project-URL: Changelog, https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-microbiology/src/branch/main/CHANGELOG.md
Project-URL: documentation, https://dcat-ap-plus-microbiology.readthedocs.io
Project-URL: repository, https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-microbiology
Provides-Extra: tables
Description-Content-Type: text/markdown

# dcat-ap-plus-microbiology

Knowledge graphs of bacterial reactions in DCAT-AP-PLUS, completed by computation rather than
by a reasoner, for organisms, colonies and federations of colonies.

Status: specified in [docs/specification](docs/specification/README.md). Producibility, emergence in colonies and federations, minimal supplements and essential reactions are implemented, and so is the circuit of a network (part 8): species, junctions, genes and grounds, with energies, cycle tests, directions over the membrane and completions. The outcomes of the predictions are in [docs/outcomes.md](docs/outcomes.md). Nothing here is endorsed by
DCAT-AP-PLUS or NFDI4Cat, and the interface is not stable.

## Install

```console
pip install dcat-ap-plus-microbiology
```

This needs Python 3.12 or later and brings cobrapy, rdflib, pySHACL, SciPy, SymPy and NetworkX.
It reads the models cobrapy ships (`cobra.io.load_model("textbook")`, `"iJO1366"`) and any SBML or
cobrapy JSON file, and answers producibility, emergence, supplements, essential reactions and the
circuit, written as named graphs with a plain DCAT catalogue.

The `tables` extra writes each run as SciDatS tables (Parquet with DCAT-AP+ metadata, specification
part 10). It needs Python 3.13 and pandas 3, and cobrapy 0.32.1 caps pandas below 3, so it installs
only with an override:

```console
echo "pandas>=3.0.6" > overrides.txt
uv pip install "dcat-ap-plus-microbiology[tables]" --override overrides.txt
```

[showcase/08_from_pypi.ipynb](https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-microbiology/src/branch/main/showcase/08_from_pypi.ipynb) installs the extension, the query service
[svar-query](https://pypi.org/project/svar-query/) and the charts of
[spectacular-charts](https://pypi.org/project/spectacular-charts/) from PyPI and uses nothing else,
so it runs wherever it is copied. The measured energies of the circuit come from a table that is not
distributed with the package (see [data/raw/SOURCES.md](https://git.uni-greifswald.de/sachikonyk/dcat-ap-plus-microbiology/src/branch/main/data/raw/SOURCES.md)), so a plain install
declines every chemical energy with its remedy.

## The idea

Someone who holds an ontology knowledge graph of bacterial reactions usually completes it with
a reasoner, which classifies and chains what is asserted. The questions microbiology asks of
such a graph are calculations rather than entailments. Can this organism make X from this
medium? Which way does this reaction run here? Does the colony make X when no member does
alone? What is the smallest supplement that closes the gap?

This extension answers them by computing. The graph a user brings is the *stated* basis, and
the situation (medium, environment, colony membership, measurements) is the *supplied* basis.
Every completion is *derived*: the output of a declared rule, carrying its inputs, a
certificate and a status, or declined with the reason. It follows the conventions of the
sibling extensions `health-dcat-ap-plus-circuit`, `dcat-ap-plus-genomics`,
`dcat-ap-plus-proteomics` and `dcat-ap-plus-artefacts`. The specification is in
[docs/specification/](docs/specification/README.md).

## Layout

The three languages are kept apart, each with its own build tool. They share one version
(`tests/test_versions.py` checks it).

| Path | Language | What | Tool |
|---|---|---|---|
| `src/dcat_ap_plus_microbiology/`, `tests/` | Python 3.13 | ingestion, the two determinations, the rules, the circuit (`circuit/`), catalogue emission | uv |
| `data/raw/` | CSV (gzip) | the TECRDB table of the circuit's energies, with its [source](data/raw/SOURCES.md) | |
| `crates/microbiology-core/` | Rust | determination A (the scope) and its certificate checks, without I/O | cargo |
| `crates/microbiology-wasm/` | Rust | WebAssembly bindings of the core | wasm-pack |
| `packages/microbiology/` | TypeScript | `@dcat-ap-plus/microbiology`, the core for browsers and Node | npm |
| `exercises/ontologies_with_python/` | Jupyter (Python 3.13) | chapters 3–11 of *Ontologies with Python* (Lamy) as notebooks on the ontology of bacteria; see its [README](exercises/ontologies_with_python/README.md) | uv |
| `exercises/reaction_computing/` | Jupyter (Python 3.13) | the bacteria ontology with reactions, completed by a reasoner and by computation; see its [README](exercises/reaction_computing/README.md) | uv |
| `experiments/` | Jupyter (Python 3.13) | the experiments of specification parts 6 and 9 on the *E. coli* models bundled with cobrapy (`EXPERIMENTS=1 uv run pytest experiments`) | uv |
| `docs/` | Markdown | Sphinx documentation and the specification | sphinx |
| `.gitea/workflows/ci.yml` | | CI on git.uni-greifswald.de, one job per language | Gitea Actions |

The Python 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). The Rust and TypeScript parts are added beside it,
so `uvx copier update --trust` can still apply later template releases.

## Development

Requirements: [uv](https://docs.astral.sh/uv/), the Rust toolchain pinned in
`rust-toolchain.toml` (installed by rustup on first use),
[wasm-pack](https://rustwasm.github.io/wasm-pack/) and Node 20 or later.

```console
# Python
uv sync
uv run ruff check . && uv run ruff format --check .
uv run zuban check
uv run pytest

# Rust
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

# WebAssembly and TypeScript (the build runs wasm-pack first)
npm ci
npm run build
npm run typecheck
npm test
```

Install the git hooks once with `uv run pre-commit install --install-hooks`. Commit messages
follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/); see
[CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).

## Licence

MIT. See [LICENSE](LICENSE).
