grus
A meaning-only pedigree IR (protobuf), a deterministic renderer that draws it as a Bennett/NSGC-standard SVG pedigree, and importers from the pedigree file formats people already have. Python 3.13, MIT.
uv add grus # or: pip install grus
grus import family.fam -o family.pbtxt # PLINK/LINKAGE PED, kinship2 tables, Phenopackets Family, Open Pedigree JSON
grus validate family.pbtxt
grus render family.pbtxt -o family.svg # --png with the `raster` extra (needs libcairo)
from grus import convert, ir, render
ps = convert.import_file("family.fam") # -> PedigreeSet, validated
svg = render.render_set_svg(ps) # one SVG for the figure; render.render_svg for one pedigree
text = ir.dump_set_pbtxt(ps) # canonical, diffable text form
What the IR is
Who is in the pedigree, their gender and clinical status, and how they relate — never coordinates. Identity is
Position{generation, index} (the drawn "II-3"); relationships are Mating{partner_a?, partner_b?, offspring[]} so
single parents, founder sibships, consanguinity, separated couples and childlessness are first-class; clinical status is
a per-condition list (affected / carrier / presymptomatic, with inheritance and onset when stated); twins, adoption,
donor parentage, pregnancy outcomes and collapsed sibships live where the standard draws them. The schema covers the
whole Bennett 2008 + 2022 vocabulary and evolves additively. Contract:
schema/proto/grus/models/pedigree.proto; rationale and the assessment of
Phenopackets / GA4GH Pedigree as alternatives: docs/design/ir.md.
What the renderer does
Ranks generations, orders each row to minimise crossings while keeping couples adjacent and sibships contiguous, solves
x on a constraint model, and draws standard symbols and connectors — deterministically, so the same IR always yields the
same bytes. Consanguineous loops, multiple mates and cross-lineage marriages route as edges rather than failing; the few
shapes it still cannot draw raise DeferredFeatureError instead of drawing something wrong.
docs/design/renderer.md, docs/design/layout-v2.md.
Importers
grus.convert reads PLINK .fam/.ped/.psam and LINKAGE .pre, kinship2/Pedixplorer tables (with the relation
matrix), GA4GH Phenopackets v2 Family JSON, and Open Pedigree / PhenoTips simple JSON. Generation and index are
synthesised (no data format carries them), the source id is kept in external_id, and nothing is inferred that the
source did not state. Per-format mapping tables: docs/design/convert.md.
Where it comes from
grus is built at the Centre for Population Genomics to round-trip pedigree figures in papers: figure → IR (a vision
model) → figure′ (this renderer), judged for semantic equivalence. That programme — the extraction prompt, corpus
mining, evaluation harness and review UI — is not part of this package; the IR and renderer are its stable core.
docs/PRODUCT.md; terms in GLOSSARY.md. Docs and docstrings here occasionally cite
design notes that stay in the private tree (architecture.md, eval.md, corpus.md, docs/plans/); those pointers
are provenance, not links.
Developing
uv sync, then uv run pytest, uv run --group lint pyright, pre-commit install. CI runs the same gates
(.github/workflows/): pre-commit, pytest (with and without the raster extra), stub freshness, and buf breaking
against the base branch. Protos are the source of truth; after editing one, buf lint,
buf breaking --against .git#branch=main, and uv run --group codegen python -m tools.schema.regen (needs buf).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grus-0.1.0.tar.gz.
File metadata
- Download URL: grus-0.1.0.tar.gz
- Upload date:
- Size: 199.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15424f17507f16ccfa9a6504d83280e298976109d89aefefd26c09c084f78659
|
|
| MD5 |
2e005ce01592486c58338cd444124f3a
|
|
| BLAKE2b-256 |
19191b4dda4ce92ec558e8c52a3abfc0ba4297e9f913b44a0514cf4f2b05dda2
|
Provenance
The following attestation bundles were made for grus-0.1.0.tar.gz:
Publisher:
release.yml on populationgenomics/grus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grus-0.1.0.tar.gz -
Subject digest:
15424f17507f16ccfa9a6504d83280e298976109d89aefefd26c09c084f78659 - Sigstore transparency entry: 2817694747
- Sigstore integration time:
-
Permalink:
populationgenomics/grus@753cd558393efe74d774e76eb4c8bde47eb1073b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/populationgenomics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@753cd558393efe74d774e76eb4c8bde47eb1073b -
Trigger Event:
push
-
Statement type:
File details
Details for the file grus-0.1.0-py3-none-any.whl.
File metadata
- Download URL: grus-0.1.0-py3-none-any.whl
- Upload date:
- Size: 103.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7e91ade4d6c250e84bbd9e0235d69b8482383d2f279f4c0c99c2cf8bbef5fd8
|
|
| MD5 |
c16468e717f28604c157960190f2340f
|
|
| BLAKE2b-256 |
d4dc7fd477752b09e28b2217f88f88e1b34f3a77ccff6e736f522d77f426dedc
|
Provenance
The following attestation bundles were made for grus-0.1.0-py3-none-any.whl:
Publisher:
release.yml on populationgenomics/grus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grus-0.1.0-py3-none-any.whl -
Subject digest:
e7e91ade4d6c250e84bbd9e0235d69b8482383d2f279f4c0c99c2cf8bbef5fd8 - Sigstore transparency entry: 2817694794
- Sigstore integration time:
-
Permalink:
populationgenomics/grus@753cd558393efe74d774e76eb4c8bde47eb1073b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/populationgenomics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@753cd558393efe74d774e76eb4c8bde47eb1073b -
Trigger Event:
push
-
Statement type: