torchcell.datamodels.schema.RNASeqExpressionPhenotype

class RNASeqExpressionPhenotype(*, provenance_gaps: list[~torchcell.verification.sourced.ProvenanceGap] = <factory>, graph_level: str = 'node', label_name: str = 'expression_tpm', label_statistic_name: str | None = None, expression_tpm: dict[str, float], expression_count: dict[str, int] | None, measurement_type: str = 'rnaseq_tpm', n_mapped_reads: int | None = None)[source]

Bases: Phenotype, ModelStrict

NGS (RNA-seq) expression phenotype: ABSOLUTE per-gene expression, not a ratio.

Distinct from MicroarrayExpressionPhenotype. That family is a perturbation-vs-reference screen and stores log2(sample/reference). This family is a population/whole-transcriptome survey (Caudal 2024 pan-transcriptome of natural isolates) where each isolate’s transcriptome is measured on its OWN genome – there is no common reference to ratio against, so the stored value is the isolate’s ABSOLUTE expression: expression_tpm (transcripts per million) with the raw expression_count. Downstream abundance/dispersion metrics (e.g. mean log2 TPM) are DERIVED, never stored.

Core/accessory handling: a gene ABSENT from an isolate’s genome is encoded by KEY ABSENCE (it is simply not a key), NEVER a 0 TPM – honest to the source, which excludes isolates that do not carry a given accessory gene from that gene’s statistics.

Provenance: Caudal et al. 2024, Nat. Genet. 56:1278; normalization “mean log2 of the normalized read counts (transcripts per million (TPM))”. See [[torchcell.datasets.scerevisiae.caudal2024]].

classmethod convert_and_validate_tpm(v: Any) → Any[source]

Coerce TPM to a SortedDict; reject empty, infinite, or negative values.

classmethod convert_and_validate_count(v: Any) → Any[source]

Coerce counts to a SortedDict; require non-negative integers.

validate_matching_keys() → RNASeqExpressionPhenotype[source]

expression_count must cover exactly the same genes as expression_tpm.

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

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