torchcell.datamodels.schema.StrainReferenceGenome

class StrainReferenceGenome(*, provenance_gaps: list[~torchcell.verification.sourced.ProvenanceGap] = <factory>, species: str, strain: str, ploidy: ~typing.Literal['haploid', 'diploid'] = 'haploid', 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'] | None, assembly_accession: str | None, background: ~torchcell.datamodels.schema.StrainBackground | ~torchcell.datamodels.schema.EukaryoticStrainBackground)[source]

Bases: ReferenceGenome

A ReferenceGenome that states its typed strain background (#507).

background is REQUIRED and holds the content the strain carries beyond the pinned assembly: a StrainBackground (reference strain, assembly set, genotype statement, alleles) or its EukaryoticStrainBackground subclass, which adds the mating type, the ploidy and the integrated cassettes. Its name equals strain so the free string and the typed object cannot disagree, and it pins the SAME assembly_set as this reference: since P5 that is one rule read on every family rather than a yeast branch pinning S288C by name and a bacterial branch comparing the two fields. A EukaryoticStrainBackground also agrees on ploidy, the one fact this class and the background both carry. The union is the typed home the retired AssemblyReferenceGenome’s optional background had, with the requiredness this class has always had.

An ExperimentReference holds its reference as ReferenceGenome | StrainReferenceGenome, so the background survives serialization in every experiment family without a narrowed clone of the pair: measured on pydantic 2.12.3, a subclass in a base-or-subclass union dumps its own fields and revalidates to the subclass, because the base forbids extras. The record stores it once per reference (the LMDB interns the whole reference; the graph writes it on the genome and experiment reference nodes).

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].