torchcell.datamodels.schema.BackgroundAllele

class BackgroundAllele(*, provenance_gaps: list[~torchcell.verification.sourced.ProvenanceGap] = <factory>, systematic_gene_name: str, gene_namespace: ~typing.Literal['scerevisiae_s288c_sgd_systematic', 'scerevisiae_cenpk113_7d_locus_tag', 'scerevisiae_peter2018_pangenome_orf', 'ecoli_k12_mg1655_bnumber', 'ecoli_k12_bw25113_locus_tag', 'pputida_kt2440_locus_tag', 'ecoli_b_rel606_locus_tag', 'ecoli_k12_w3110_refseq_locus_tag'], gene_name: str, allele_name: str, edit: ~torchcell.datamodels.schema.AlleleEdit, functional: bool, zygosity: ~torchcell.datamodels.schema.Zygosity | None = None, cassette: str | None = None, deleted_span: ~torchcell.datamodels.schema.GenomicSpan | None = None, provenance: list[~torchcell.verification.sourced.SourcedValue] | None = None)[source]

Bases: ProvenanceGapMixin

One allele a strain background carries, as an edit against its reference genome.

ONE class for every host (P5, ontology-unify 2026-10-15). gene_namespace names the identifier space systematic_gene_name is written in, exactly as it does on every GenePerturbation since P1: before this field a background allele could name a gene and not say which space the name was in, while the perturbation beside it could, and the only way to state a bacterial locus tag was to choose the retired BacterialBackgroundAllele class. It is REQUIRED with no default, since class accepts the identifier of any deposited namespace and so the stored name’s form is not by itself the loader’s statement of the host; the two must agree (_namespace_of_identifier), so a KT2440 tag cannot be filed under the MG1655 namespace and a b-number cannot be filed under S288C.

allele_name is the designation verbatim as the source writes it (his3Δ1, can1Δ::STE2pr-Sp_his5, lacZ4787); gene_name is the CURRENT standard name the reference’s annotation carries (MET17 for the met15Δ0 allele, lacZ for lacZ4787); systematic_gene_name is the feature the edit sits in (an R64 ORF name, a locus tag). functional says whether the allele keeps the gene’s function (False for every BY marker allele), which is what per-locus dosage reads. cassette is required for a cassette_replacement and forbidden otherwise.

zygosity is optional HERE and constrained by the background that carries it: a single-copy genome has one possible copy count and so nothing to state, which StrainBackground enforces as None, while EukaryoticStrainBackground requires every allele’s zygosity to be stated or typed-gapped and to fit the ploidy. The guarantee the yeast records had is therefore unchanged; what moved is where it is asserted, which is the only place that can judge it.

Sourcing contract: provenance (quote + sha256) or a typed ProvenanceGap on provenance, never neither. A literature-standard allele whose source is not mirrored (the BY alleles before Brachmann 1998 is mirrored) is ASSERTED with a deferred_pending_source_review gap naming the paper that would close it, so the record carries the allele and says plainly that it is unverified. deleted_span is optional (coordinates are rarely published).

property mechanism_so: tuple[str, str]

(SO id, SO name) of this allele’s edit.

property is_sourced: bool

True when the allele declares no gap (on its quotes or its zygosity).

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

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