Metadata-Version: 2.5
Name: odezoo
Version: 0.2.0
Summary: A curated registry of ODE models (CellML and gotranx .ode), fetched and verified by sha256
Project-URL: Homepage, https://github.com/ComputationalPhysiology/odezoo
Project-URL: Source, https://github.com/ComputationalPhysiology/odezoo
Author-email: Henrik Finsberg <henriknf@simula.no>
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: rich>=13
Provides-Extra: dev
Requires-Dist: crossbridge>=0.6; extra == 'dev'
Requires-Dist: gotranx>=2.9; extra == 'dev'
Requires-Dist: griffe>=2; extra == 'dev'
Requires-Dist: hatchling; extra == 'dev'
Requires-Dist: matplotlib; extra == 'dev'
Requires-Dist: mystmd<2,>=1.13; extra == 'dev'
Requires-Dist: numpy; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-socket; extra == 'dev'
Requires-Dist: scipy; extra == 'dev'
Provides-Extra: docs
Requires-Dist: crossbridge>=0.6; extra == 'docs'
Requires-Dist: gotranx>=2.9; extra == 'docs'
Requires-Dist: griffe>=2; extra == 'docs'
Requires-Dist: matplotlib; extra == 'docs'
Requires-Dist: mystmd<2,>=1.13; extra == 'docs'
Requires-Dist: numpy; extra == 'docs'
Requires-Dist: scipy; extra == 'docs'
Provides-Extra: test
Requires-Dist: griffe>=2; extra == 'test'
Requires-Dist: hatchling; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest-socket; extra == 'test'
Description-Content-Type: text/markdown

# odezoo

odezoo is a curated registry of ODE model files, mostly cell models but also others such as
Windkessel models, stored as markup: CellML or [gotranx](https://github.com/finsberg/gotranx)
`.ode`. It is a Python package with a command line interface that searches the registry and
downloads a model's file exactly as it was recorded, verified by its sha256. The registry holds
only the models chosen for it, and each model has one `model.toml` that says where its files come
from, which paper it belongs to, and how to find it.

## Install

odezoo needs Python 3.11 or later.

```
python3 -m pip install odezoo
```

Each release bundles the registry as it was then. For models added since the last release,
install from GitHub:

```
python3 -m pip install git+https://github.com/ComputationalPhysiology/odezoo
```

The documentation, with a page for every model and a search, is at
<https://computationalphysiology.github.io/odezoo>.

## Quick start

```
odezoo list                                    # every model; takes the same filters as search
odezoo search --category electrophysiology     # find models; also by text, --keyword, --species
odezoo values species                          # each species and its number of models
odezoo info beeler_reuter_1977                 # paper, DOI, versions, licences, sources
odezoo fetch beeler_reuter_1977 -o models/     # writes models/beeler_reuter_1977.cellml
```

`odezoo fetch` takes several ids, so `odezoo fetch $(odezoo search --format cellml --ids)`
fetches every CellML model. `--format` picks the newest version in a format, `--version` a given
version, and `--force` overwrites a different file that is already there. A table of models
taller than the terminal opens in your pager (`$PAGER`, else `less`); `--no-pager` turns that off.
`odezoo values` also counts categories, keywords, families, formats and cell types, and takes the
same filters, so `odezoo values family --species human` lists the families of human models.

Every file is checked against the sha256 in the registry. It is taken from the cache if it is
there, otherwise from this repository's copy on GitHub, otherwise from where its authors keep it
(the Physiome Model Repository, GitHub or Zenodo). Whichever it comes from, it is the same bytes.

## From Python

```python
import odezoo

odezoo.search("ten tusscher", category="electrophysiology", format="cellml")
odezoo.values("species")  # {"human": 14, "guinea pig": 8, ...}
model = odezoo.model("beeler_reuter_1977")  # paper, keywords, versions, ...
path = odezoo.get("beeler_reuter_1977")  # the file in the cache
path = odezoo.get("beeler_reuter_1977", dest=".")  # copied to ./beeler_reuter_1977.cellml
```

With gotranx, a model's `.ode` version, where it has one, loads directly:

```python
import gotranx

ode = gotranx.load_ode(odezoo.get(model_id, format="ode"))
```

## Settings

| Option | Environment variable | What it does |
|---|---|---|
| `--cache-dir PATH` | `ODEZOO_CACHE_DIR` | Where downloads are kept. `odezoo cache dir` shows it, `odezoo cache clear` empties it, and `fetch --no-cache` skips it. |
| `--registry PATH` | `ODEZOO_REGISTRY` | Use a checkout of this repository instead of the registry bundled with odezoo, e.g. to try models not yet released. |

A flag beats its environment variable.

## Adding models

Each model is a folder under `models/` with a `model.toml` and the files it keeps a copy of.
`odezoo registry check` checks a checkout, and `odezoo registry add version ID FILE
--derived-from V` adds an edited file as a new version.

`odezoo registry add url URL --id ID [--license SPDX]` downloads a file and adds it, as a new model
or a new version of one. GitHub and PMR URLs are pinned to a commit (for PMR, use the file's
`rawfile` URL with the full commit id). A new model gets only its id; fill in its name, paper and
categories, then run `odezoo registry check`. The documentation has the full guide to adding
models, and [CONTRIBUTING.md](CONTRIBUTING.md) the steps for a pull request, including building
the documentation.

## Licence

The code is MIT licensed. Each model file keeps its own licence, recorded in its `model.toml`; the
texts are in `LICENSES/`.
