torchcell.datamodels.schema.MicroarrayExpressionPhenotype
- class MicroarrayExpressionPhenotype(*, provenance_gaps: list[~torchcell.verification.sourced.ProvenanceGap] = <factory>, graph_level: str = 'node', label_name: str = 'expression_log2_ratio', label_statistic_name: str = 'expression_log2_ratio_se', expression_log2_ratio: dict[str, float], expression_log2_ratio_se: dict[str, float] | None = None, expression: dict[str, float], expression_log2_ratio_variance: dict[str, float] | None = None, n_replicates: dict[str, int])[source]
Bases:
TwoChannelMicroarrayExpressionPhenotype,ModelStrictMicroarray expression phenotype with canonical log2 ratio convention.
- CONVENTION: All expression_log2_ratio values follow the torchcell standard:
expression_log2_ratio = log2(sample_of_interest / reference)
- Where:
sample_of_interest = mutant/deletion strain being studied
reference = wildtype or common reference pool
- This means:
Positive values: gene is MORE expressed in sample vs reference (upregulated)
Negative values: gene is LESS expressed in sample vs reference (downregulated)
NOTE: Source data (GEO) may use different conventions (e.g., log2(reference/sample)). Dataset loaders MUST transform to this canonical representation for consistency.
- PRIMARY FIELDS (for BioCypher/ML):
expression_log2_ratio: log2 fold change relative to reference
expression_log2_ratio_se: Standard error of log2 ratios
- SECONDARY FIELDS (for QC/reproducibility):
expression: Absolute expression measurements on linear scale (reference only)
expression_log2_ratio_variance: Variance of log2 ratios
n_replicates: Number of independent biological/technical replicates
- classmethod convert_and_validate_expression(v: Any) Any[source]
Coerce expression to a SortedDict and reject empty or infinite values.
- classmethod convert_and_validate_log2_ratio(v: Any) Any[source]
Coerce log2 ratios to a SortedDict and reject empty input.
- classmethod convert_and_validate_log2_se(v: Any) Any[source]
Coerce log2 ratio SE to a SortedDict and reject negative finite values.
- classmethod convert_and_validate_variance(v: Any) Any[source]
Coerce variance to a SortedDict and reject negative non-NaN values.
- classmethod convert_and_validate_n_replicates(v: Any) Any[source]
Coerce n_replicates to a SortedDict and require positive-integer counts.
- validate_matching_keys() MicroarrayExpressionPhenotype[source]
Ensure all secondary fields have same keys as expression.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].