torchcell.paper

Code behind the manuscript’s generated artifacts. tables holds primitives that emit one table as both markdown and LaTeX; ontology_graph introspects the pydantic schema into a typed graph and ontology_svg lays it out as the zoomable SVG published at /ontology/; signal is a command-line tool that computes a built dataset’s gzip signal and its derived shape and graph role.

ontology_graph

Introspect the torchcell pydantic schema into a typed, renderable graph.

Classes

ontology_graph.OntologyField

One pydantic field on a class, as it should appear in a diagram row.

ontology_graph.OntologyClass

A pydantic model or enum in the schema, plus its place in the ontology.

ontology_graph.CompositionEdge

A has-a edge: source.field holds one or more target.

ontology_graph.OntologyGraph

The whole schema as classes plus inheritance and composition edges.

Functions

ontology_graph.build_ontology_graph

Introspect the live schema modules into an OntologyGraph.

ontology_svg

Lay out and render torchcell.paper.ontology_graph as a zoomable SVG map.

Classes

ontology_svg.Card

A placed class box.

ontology_svg.Lane

A titled domain block containing one or more laid-out trees.

ontology_svg.Layout

A fully placed diagram, ready to serialise.

Functions

ontology_svg.build_layout

Place every class into its lane, then pack lanes into the grid.

ontology_svg.render_schematic_svg

Render the legible, Nature-compliant structural panel.

ontology_svg.render_svg

Serialise a placed layout to one self-contained SVG document.

signal

CLI to compute a dataset’s gzip ‘signal’ + derived shape/graph-role from its built LMDB. Use as new datasets are added, without touching the paper table.

Functions

signal.resolve_lmdb

Resolve a CLI path to a processed/lmdb dir.

tables

Reusable primitives for generating paper tables in BOTH markdown and LaTeX from a single in-code source of truth, plus data-derived columns such as a streaming-gzip “signal” (a Kolmogorov-complexity proxy) computed directly from a built LMDB.

Classes

tables.Cell

A table cell that renders differently in markdown vs LaTeX.

tables.DatasetSignalRecord

One dataset's computed row -- the raw-data artifact the DB report emits.

tables.SignalCache

JSON-backed memo of (n, bytes) per id, keyed by LMDB fingerprint.

tables.Column

A table column.

tables.Row

One table row.

tables.PaperTable

Columns + rows rendered identically to markdown and LaTeX.

Functions

tables.human_bytes

Format a byte count the way a paper table reads: 0.6 KB, 101 KB, 1.9 MB.

tables.tex_escape

Escape the LaTeX specials that show up in dataset table cells.

tables.scientific

Format a number in scientific notation (unit-free) for a table cell.

tables.default_phenotype_bytes

Extract the serialized phenotype from a torchcell LMDB record.

tables.instance_bytes

Serialize the full stored INSTANCE (perturbation + environment + phenotype).

tables.stream_gzip_signal

Return (n_records, gzip_bytes) for an LMDB in a single streaming pass.

tables.read_first_record

Return the first record of an LMDB (for schema-derived table columns).

tables.phenotype_descriptor

Derive (shape, graph_role) for one record from its stored instance.

tables.lmdb_fingerprint

Fingerprint an LMDB's data.mdb (mtime+size) so a rebuild invalidates any cached signal.

tables.read_frontmatter

Return the leading dendron ---...--- block of a note (verbatim), or a minimal one if absent -- so a regenerated note keeps its dendron identity.