torchcell.datamodels.schema.StrainBackground
- class StrainBackground(*, provenance_gaps: list[~torchcell.verification.sourced.ProvenanceGap] = <factory>, name: str, reference_strain: ~typing.Literal['S288C', 'CENPK113-7D', 'MG1655', 'BW25113', 'KT2440', 'REL606', 'W3110'], assembly_set: ~typing.Literal['ecoli_K12_MG1655_ASM584v2', 'ecoli_K12_BW25113_ASM75055v1', 'pputida_KT2440_ASM756v2', 'ecoli_B_REL606_ASM1798v1', 'ecoli_K12_W3110_ASM1024v1', 'sgd_S288C_R64-4-1_20230830', 'scerevisiae_CENPK113-7D_ASM257140v2'], parents: list[str] | None = None, construction: str | None = None, genotype_statement: str | None = None, alleles: list[~torchcell.datamodels.schema.BackgroundAllele] = <factory>, provenance: list[~torchcell.verification.sourced.SourcedValue] | None = None)[source]
Bases:
ProvenanceGapMixinThe genome content a strain carries beyond its reference genome.
ONE class for every host (P5, ontology-unify 2026-10-15), holding what both families state: the strain label, the sequenced strain the alleles are edits against, the deposited bytes that strain means, the parents, the construction, the source’s verbatim genotype string and the typed alleles. The retired
BacterialStrainBackgrounddiffered from this by exactly the three eukaryote facts, whichEukaryoticStrainBackgroundcarries, and the schema.py comment that chose the duplication chose it on cost.nameis the strain or lineage label the records join on (BY4741,BW25113, or a descriptive name for an SGA progeny pool); it must equalStrainReferenceGenome.strain.parentsare the strains it was made from, verbatim (["BY4741", "BY4742"]for BY4743; the SGA query and array for a progeny pool).constructionis a one-line method statement (how the background was made, e.g. an SGA cross and its selections).genotype_statementis the genotype exactly as the source writes it, kept beside the typed alleles so nothing the source said is lost: BW25113’s lesions come from its own deposited GenBanksourcefeature rather than from a paper, and a yeast strain table states the same kind of string.reference_strainis the sequenced strain every allele is an edit against andassembly_setis the deposited set that strain means; the two must agree (REFERENCE_STRAIN_ASSEMBLY_SETS). The pin is REQUIRED with no default and no typed gap, which is the one place this field’s contract differs fromReferenceGenome.assembly_set: that carrier’s companion field is the free stringstrainand may name a strain the tier has not deposited, so it needs the gap, whilereference_strainhere is a closed vocabulary with one member per deposited set, so a background that can name its reference has already named a deposited set and a gap branch would be unreachable. A background whose reference is not deposited is not representable, deliberately: its edit list against another reference would be thousands of variants.provenanceis set or gapped (a typed absence, never a silent None). A single-copy genome carries one allele entry per locus and states no copy count, so every allele’szygosityisNonehere;EukaryoticStrainBackgroundis where a copy count is a fact and is required.- alleles_at(systematic_gene_name: str) list[BackgroundAllele][source]
The background’s allele entries at one locus (empty = the reference allele).
- functional_copies(systematic_gene_name: str) int[source]
Functional copies of a gene in the UNPERTURBED background: 1 or 0.
One copy, so the answer is 1 unless the background carries a non-functional allele at the locus.
EukaryoticStrainBackgroundoverrides this with the ploidy-aware count.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].