torchcell.datamodels
The pydantic schema of a torchcell experiment. A record is a typed genotype x environment -> phenotype experiment: Genotype holds a list of gene perturbations (for example SgaKanMxDeletionPerturbation), Environment holds the medium, an optional temperature and any environment perturbations, and each phenotype family (fitness, gene interaction, CalMorph morphology, microarray, RNA-seq and pseudobulk expression, metabolite, protein abundance, visual score, environment response and others) has its own phenotype, experiment and experiment-reference classes in schema. The classes derive from the strict bases in pydant (ModelStrict and ModelStrictArbitrary). Dataset loaders emit these objects, and the converter modules map one experiment type onto another (for example gene essentiality onto fitness). The package namespace re-exports a subset (torchcell.datamodels.__all__); every class below is listed under the module that defines it.
compound_identity
Shared, pure, offline compound-identity resolver (UI-2).
Classes
Typed outcome of a resolution attempt, ordered from usable to terminal. |
|
One row of the pinned name->structure table (JSON round-trips this natively). |
|
What a caller splats into |
Functions
Lowercase + strip + conservative synonym canonicalization (documented). |
|
Resolve a compound identity from the pinned table -- pure, offline. |
|
Derive a standard InChIKey from a SMILES with RDKit, or |
|
Resolve by name, falling back to the caller's SMILES ONLY when no row exists. |
|
Build a |
compound_identity_curate
Reproducible curator for the pinned compound-identity table (UI-2, serve-50).
Classes
One parsed input line: a loader label plus how to resolve it. |
|
One row of a PUG REST |
|
Rate-limited PUG REST client with an on-disk response cache. |
|
One assembled table row, before it is serialized to JSON. |
Functions
Parse |
|
Parse an input list of labels (comments and blank lines skipped). |
|
Parse an input list of bare PubChem CIDs (one per line). |
|
The canonical single-name GET endpoint (also the row's recorded |
|
The canonical single-CID GET endpoint that reproduces one batched row. |
|
The canonical single-CID synonyms endpoint (the ChEBI source). |
|
Collapse directives + PubChem answers into deduplicated, canonical rows. |
|
Deterministic table bytes (sorted keys, stable indent, trailing newline). |
|
Read the input lists, query PubChem, and assemble the rows. |
conversion
Convert raw Neo4j experiment records into typed experiments stored in LMDB.
Classes
One input/output type pair plus its conversion functions. |
|
Collection of conversion entries defining how to map experiment types. |
|
Abstract base that converts queried records and caches them in LMDB. |
fitness_composite_conversion
Converter that maps gene essentiality and synthetic lethality data into fitness.
Classes
Converter combining gene essentiality and synthetic lethality to fitness. |
gene_essentiality_to_fitness_conversion
Convert gene-essentiality experiments into equivalent fitness experiments.
Classes
|
Converter turning gene-essentiality records into fitness records. |
Functions
|
Map an essential gene to a zero-fitness experiment, else drop it. |
|
Build the wild-type (fitness 1.0) reference for the fitness dataset. |
identity
Composition-based identity for the environment-side entities of the graph.
Functions
The join key for a compound, as |
|
Project a medium onto its composition: state, synthetic flag, base, contents. |
|
Project a temperature onto its value and typed unit (no unit conversion). |
|
Project an environment perturbation onto its typed slots. |
|
Project an environment onto medium, temperature, edits, oxygen, duration and rate. |
|
Project a strain background onto its genome content, dropping who stated it. |
|
Hash an identity projection: sha256 over its canonical JSON encoding. |
interned_constant
Content-addressed sub-objects of an Experiment record in the knowledge graph.
Functions
The node id of an interned constant: sha256 over label, kind and exact payload. |
|
Return |
|
Add every |
|
Splice constants back: a dict carrying |
|
Parse a fetched payload after checking that (kind, payload) hashes to its id. |
media
Reusable, provenance-first definitions of the common growth media.
Functions
|
|
|
ontology_checks
Programmatic coherence checks over the torchcell ontology.
Classes
One |
|
A node class whose emitted properties differ from its declared properties. |
|
An adapter attribute chain that walks THROUGH a field the schema may null. |
|
Bijection between concrete phenotype classes and phenotype node classes. |
|
A |
|
A |
|
A derived medium that dropped a base component without declaring a dropout. |
|
One compound encoded twice in an environment: as a component AND as an edit. |
|
How many records of a built dataset are joinable on each identity key. |
Functions
Every pydantic model DEFINED in |
|
Every enum DEFINED in |
|
Schema models this model COMPOSES (holds in one of its fields). |
|
Models reachable from |
|
Schema models no experiment record can ever reach, sorted by name. |
|
The three record lanes, each closed under inheritance AND composition. |
|
Composition edges pointing UP from a lane into the experiment lane. |
|
|
|
Schema enums whose members share a value (a silent Python alias). |
|
The committed BioCypher graph schema, parsed into per-class entries. |
|
The |
|
Node classes no edge class connects (invisible to any traversal query). |
|
Match each phenotype node class to its concrete pydantic phenotype class. |
|
Every |
|
Node classes where emitted properties != declared properties, either way. |
|
Adapter chains that dereference THROUGH a schema field that may be None. |
|
True when the compound carries at least one structure identifier. |
|
True when an identifier's absence is declared as a typed |
|
Shared-library compounds that are neither identified nor honestly gapped. |
|
Library media whose |
|
Derived media that silently lost a base component. |
|
Compounds encoded twice in one environment: as a component AND as an edit. |
|
Census of the identity keys a built dataset actually carries. |
pydant
Strict Pydantic base models used across torchcell data schemas.
Classes
Base model that forbids extra fields and is immutable. |
|
Strict immutable model that also permits arbitrary field types. |
schema
Pydantic data models for torchcell genotypes, environments, and phenotypes.
Classes
Mixin giving a model a |
|
|
|
Mating-type locus state. |
|
How many of a background's chromosome copies carry an allele. |
|
How a background allele's sequence differs from the R64 locus. |
|
A 1-based, end-inclusive interval on one replicon of a deposited assembly set. |
|
One allele a strain background carries, as an edit against its reference genome. |
|
The genome content a strain carries beyond its reference genome. |
|
The deposited reference a record's identifiers and background edits are written against. |
|
A |
|
A Sequence Ontology term: a |
|
Base perturbation of a single gene by systematic and common name. |
|
AXIS 1 -- a gene is PRESENT or ABSENT relative to the reference. |
|
AXIS 3 -- a sequence-level allelic change (SNP/indel/substitution allele). |
|
Min/max multiplier bounds on a gene's expression level. |
|
The engineered CRISPR machinery introduced to perturb a gene -- a first-class MATERIAL ENTITY (the guide RNA + Cas effector we actually put in the cell). |
|
Where one physical deletion strain came from in its collection. |
|
How the ORF a strain was built against relates to the current R64 gene. |
|
The ORF annotation a deletion strain was BUILT against, when not the current gene. |
|
Gene deletion via KanMX or NatMX gene replacement (engineered absence). |
|
Gene deletion via KanMX gene replacement. |
|
A KanMX deletion strain that carries the molecular barcode it was screened by. |
|
One allele of a diploid replaced by a deletion cassette (HIP / het collection). |
|
Gene deletion via NatMX gene replacement. |
|
KanMX deletion perturbation specific to SGA experiments. |
|
NatMX deletion perturbation specific to SGA experiments. |
|
Decreased-abundance-by-mRNA-perturbation (DAmP) allele perturbation. |
|
DAmP perturbation specific to SGA experiments. |
|
Temperature-sensitive allele perturbation via amino acid substitution. |
|
Generic allele perturbation via amino acid substitution. |
|
Suppressor allele that raises fitness in the presence of a perturbation. |
|
Suppressor allele perturbation specific to SGA experiments. |
|
Temperature-sensitive allele perturbation specific to SGA experiments. |
|
Generic allele perturbation specific to SGA experiments. |
|
How a conditional allele of an essential gene reduces its function. |
|
A conditional (hypomorphic) allele of an essential gene, class possibly unknown. |
|
Deletion perturbation aggregating duplicate experiments by their mean. |
|
Gene deletion via a selectable/auxotrophic marker other than KanMX or NatMX. |
|
Gene deletion via an ACTIVE Cas nuclease cut repaired from a homology donor. |
|
Gain-of-function: a gene ADDED to the strain (heterologous expression or an extra native copy), carried on a plasmid or integrated at a chromosomal locus. |
|
A reference (core) gene ABSENT in a natural isolate (Caudal core-loss). |
|
A non-reference (accessory) gene PRESENT in a natural isolate (Caudal accessory). |
|
SNP/indel-level allelic variation: a native gene whose sequence in this strain differs from the S288C reference, captured via an off-graph pointer. |
|
Copy-number variation (CNV) of a PRESENT pangenome ORF relative to S288C. |
|
An ENGINEERED copy-number/dosage change of a PRESENT native gene. |
|
AXIS 4 (ABC) -- engineered expression modulation of a present gene. |
|
CRISPRa -- guide-directed dead-Cas activator INCREASES a present gene's expression. |
|
CRISPRi -- guide-directed dead-Cas repressor DECREASES a present gene's expression. |
|
Collection of gene perturbations defining a strain's genotype. |
|
UO-aligned temperature units (typed, not a free string) -- G2 unit typing. |
|
Temperature value with a typed unit (defaults to Celsius). |
|
UO-aligned units for a dose / physical-factor magnitude (G2 unit typing). |
|
How a dose was SET when the molar value is not released (dose PROVENANCE, not a phenotypic consequence): a target-inhibition endpoint or an explicit fixed dose. |
|
A neutral, scalar physical/physiological environment variable. |
|
Chemical identity of a small molecule, keyed by a canonical InChIKey. |
|
A dose of an environmental agent: a numeric value+unit and/or a target-basis. |
|
The vehicle a compound was dissolved in and its final fraction in the medium. |
|
Functional role of a medium component (never a phenotypic consequence). |
|
Identity/composition completeness of a component (the 'what is it' axis). |
|
One ingredient of a medium: a (possibly undefined) compound at a dose. |
|
Growth medium resolved to typed COMPONENTS (provenance-first). |
|
Base: a defined change to the growth environment vs the base medium. |
|
An added chemical SPECIES (drug, acid, alcohol, salt, oxidant, ...). |
|
A neutral, scalar physical/physiological environment FACTOR (pH, osmolarity, ...). |
|
Material class of a proteinaceous / biologic agent added to the medium. |
|
An added BIOLOGIC agent (peptide / protein / antibody / toxin). |
|
When a culture was read out (the endpoint is part of what was measured). |
|
The physical culture a measurement was grown in. |
|
What the screened culture was inoculated FROM. |
|
The culture step BEFORE treatment, which sets the cells' state at time zero. |
|
Experimental environment: base medium + temperature + optional perturbations. |
|
An |
|
Base phenotype describing an observed label and its graph level. |
|
What a reported uncertainty number IS, so it converts to an SE correctly. |
|
What one sample in |
|
Fitness phenotype with fitness value and uncertainty statistics. |
|
Phenotype indicating whether a gene knockout is lethal. |
|
Phenotype indicating synthetic lethality between perturbed genes. |
|
Phenotype indicating one perturbation rescues another's deleterious effect. |
|
Phenotype holding a gene interaction score, its p-value and its replicate design. |
|
Phenotype holding CalMorph morphological measurements and CV statistics. |
|
The source document a record's values come from. |
|
Reference (wildtype/control) context for an experiment. |
|
Base experiment pairing a genotype and environment with a phenotype. |
|
Reference context for a fitness experiment. |
|
Experiment measuring a fitness phenotype. |
|
Reference context for a gene interaction experiment. |
|
Experiment measuring a gene interaction phenotype. |
|
Reference context for a gene essentiality experiment. |
|
Experiment measuring a gene essentiality phenotype. |
|
Reference context for a synthetic lethality experiment. |
|
Experiment measuring a synthetic lethality phenotype. |
|
Reference context for a synthetic rescue experiment. |
|
Experiment measuring a synthetic rescue phenotype. |
|
Reference context for a CalMorph experiment. |
|
Experiment measuring a CalMorph phenotype. |
|
Microarray expression phenotype with canonical log2 ratio convention. |
|
Reference context for a microarray expression experiment. |
|
Experiment measuring a microarray expression phenotype. |
|
NGS (RNA-seq) expression phenotype: ABSOLUTE per-gene expression, not a ratio. |
|
Reference context for an RNA-seq expression experiment. |
|
Experiment measuring an RNA-seq (absolute TPM) expression phenotype. |
|
Pseudobulk single-cell RNA-seq expression: per-gene log2 fold-change vs WT, plus the per-genotype single-cell summary scalars that a bulk assay cannot provide. |
|
Reference context for a pseudobulk single-cell expression experiment. |
|
Experiment measuring a pseudobulk single-cell (Perturb-seq) expression phenotype. |
|
Ordinal visual-inspection score as a proxy for a metabolite/product level. |
|
Reference (control colony) context for a visual-score experiment. |
|
Experiment measuring a visual-score phenotype. |
|
Quantitative metabolite/product level(s), keyed by metabolite id. |
|
Reference (control) context for a metabolite experiment. |
|
Experiment measuring a metabolite phenotype. |
|
Quantitative protein-abundance profile keyed by protein (systematic ORF). |
|
Reference (control) context for a protein-abundance experiment. |
|
Experiment measuring a protein-abundance phenotype. |
|
HOW an environment-response readout was physically measured (experimental design). |
|
What an environment-response readout number IS, so heterogeneous chemogenomic scores are never silently compared. |
|
The controlled vocabulary a qualitative environment-response call resolves to. |
|
A strain's fitness/growth RESPONSE to an environmental perturbation. |
|
Reference (control) context for an environment-response experiment. |
|
Experiment measuring a strain's response to an environmental perturbation. |
|
Reference for a strain-resolved environment response (typed background). |
|
A strain's response to an environmental perturbation, with a typed background. |
|
One run of consecutive markers called to the same parent on one chromosome. |
|
One parent of a biparental cross, pinned to a sha256-anchored assembly. |
|
Strain-level haplotype mosaic of one haploid segregant from a two-parent cross. |
|
Reference (control) context for a segregant growth experiment. |
|
Growth of a haploid segregant (haplotype-mosaic genotype) in one environment. |
Functions
Functional copies left at the deleted locus, respecting the background. |
|
Derive the standard error of the mean from a reported uncertainty + its kind. |
strain_background
Shared constructors for typed strain backgrounds (issue #507).
Classes
The locus and edit kind a standard allele designation denotes. |
|
A standard BY strain as mating type, ploidy and allele -> zygosity. |
Functions
A |
|
A |
|
A |
synthetic_lethality_to_fitness_conversion
Convert synthetic-lethality experiments into equivalent fitness experiments.
Classes
|
Converter turning synthetic-lethality records into fitness records. |
Functions
|
Map a synthetic-lethal experiment to a fitness-0 experiment, else drop it. |
|
Map a synthetic-lethality reference to a fitness-1 reference experiment. |