Metadata-Version: 2.4
Name: create_model
Version: 0.1.1
Summary: Build one SBML model from SPARCED input tables, with optional stochastic/deterministic partition.
Author-email: Jonah Huggins <JonahRileyHuggins@gmail.com>, Marc Birtwistle <marc.birtwistle@gmail.com>
License-Expression: GPL-2.0-only
Project-URL: Homepage, https://github.com/jonahrileyhuggins/CreateModel
Project-URL: Repository, https://github.com/jonahrileyhuggins/CreateModel
Project-URL: Issues, https://github.com/jonahrileyhuggins/CreateModel/issues
Keywords: sbml,antimony,sparced,systems-biology
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: python-libsbml>=5.20
Requires-Dist: antimony>=2.14
Requires-Dist: pandas>=2.0
Requires-Dist: numpy>=1.24
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0; extra == "docs"
Requires-Dist: myst-parser>=2.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2.0; extra == "docs"

# create_model

Build one SBML model from SPARCED input tables. Optionally split it afterwards into stochastic and deterministic SBML files.

Requires Python 3.11 or later.

## Install

```bash
pip install create_model
```

From a clone of this repository:

```bash
pip install -e ".[dev]"
```

After either install, the `create_model` command is available on your PATH. If your environment does not put Scripts on PATH, `python -m create_model` is equivalent.

## Build

```bash
create_model --config tests/data/config.yaml
```

Writes `SPARCED_I.xml` (One4All) to `tests/data/output/` by default.

## Partition

After a successful build:

```bash
create_model --config tests/data/config.yaml --partition-sbml
```

Writes:

- `stochastic-gene-expression.xml`
- `deterministic-interactions.xml`

Reactions are split by the species table `solver` column: any reaction with a Stochastic species as a reactant or product goes to the stochastic model; modifier-only links do not. The rest go to the deterministic model (disjoint). Each partition is then reduced to the species and parameters that participate in its reactions. Species that appear in no reaction are still kept, assigned by their `solver` label (stochastic-labeled unused species go to the stochastic model; remaining unused species go deterministic), so the union of partition species covers the One4All model. Model `@id` attributes are sanitized to valid SBML SIds (hyphens → underscores); output filenames keep the configured names.

Verifies reaction/species/global coverage against the One4All model by default (`--no-verify` to skip).

## Useful flags

| Flag | Meaning |
|------|---------|
| `-c`, `--config PATH` | YAML configuration file (required) |
| `-o DIR` | Override output directory |
| `--sbml PATH` | One4All SBML to partition (default: `<output>/<model>.xml`) |
| `--no-verify` | Skip checks after `--partition-sbml` |
| `-v` | Debug logging |

## Config

`tests/data/config.yaml` is an example. Paths are relative to the config file unless absolute.

```yaml
name: "SPARCED-I"
version: "1.4"
description: "Configuration for loading model input tables and writing SBML"

compilation:
  directory: "."
  files:
    compartments: "SPARCED-Compartments.tsv"
    ratelaws: "SPARCED-Ratelaws.tsv"
    species: "SPARCED-Species.tsv"
    parameters: "SPARCED-Parameters.tsv"
    annotations: "SPARCED-Annotations.tsv"

output:
  directory: "output"
  keep_antimony: true

partition:
  stochastic_model_id: "stochastic-gene-expression"
  deterministic_model_id: "deterministic-interactions"
```

`compilation.files` lists the TSV tables, `output` controls where the One4All SBML (and optional Antimony) is written, and `partition` sets the split model IDs.

## Releasing

Publishing runs on GitHub Release publish (`publish.yml`). It builds an sdist and wheel and uploads them to PyPI with trusted publishing. Before the first release, create a `pypi` GitHub Environment and register this repository as a trusted publisher on PyPI for the `create_model` project.
