torchcell.datamodels.schema.EnvironmentResponsePhenotype

class EnvironmentResponsePhenotype(*, provenance_gaps: list[~torchcell.verification.sourced.ProvenanceGap] = <factory>, graph_level: str = 'global', label_name: str = 'environment_response', label_statistic_name: str | None = 'environment_response_se', measurement_type: ~torchcell.datamodels.schema.MeasurementType, assay_type: ~torchcell.datamodels.schema.AssayType | None = None, environment_response: float | None = None, category: ~torchcell.datamodels.schema.ResponseCategory | None = None, category_label: str | None = None, environment_response_se: float | None = None, environment_response_uncertainty: float | None = None, environment_response_uncertainty_type: ~torchcell.datamodels.schema.UncertaintyType | None = None, n_samples: int | None = None, sample_unit: ~torchcell.datamodels.schema.SampleUnit | None = None, units: str | None = None, screen_id: str | None = None, environment_response_lower: float | None = None, environment_response_upper: float | None = None, confidence_level: float | None = None, replicate_id: str | None = None, environment_response_p_value: float | None = None, environment_response_p_value_adjusted: float | None = None, p_value_adjustment_method: str | None = None, environment_response_t_statistic: float | None = None, environment_response_z_score: float | None = None)[source]

Bases: Phenotype, ModelStrict

A strain’s fitness/growth RESPONSE to an environmental perturbation.

For chemical-genomic / stress screens where a (usually deletion) strain’s fitness in a perturbed environment is scored relative to a control. Distinct from FitnessPhenotype – a strictly positive ko/wt growth-rate RATIO that clamps non-positive values to 0 – because this readout is a SIGNED score (log2 ratio, z-score, sensitivity score) that is routinely NEGATIVE, or a qualitative category. measurement_type records WHAT the number is, assay_type records HOW it was measured (the experimental design), and units gives its human-readable definition – units is NOT a substitute for the typed assay_type axis. The uncertainty ontology mirrors FitnessPhenotype: environment_response_se is the DERIVED, ML-facing SE (auto-filled from the source-reported uncertainty + its type via derive_se).

A qualitative call is TYPED: category is a ResponseCategory on the shared cross-screen axis and category_label holds the source’s own word for it, so a screen’s private vocabulary stays readable without becoming the join key. screen_id names the screening run a measurement came from, which is what keeps two independent screens of the same compound at the same dose from collapsing into one record.

classmethod validate_response(v: float | None) → float | None[source]

Reject NaN numeric responses (None is allowed for categorical readouts).

classmethod validate_n_samples(v: int | None) → int | None[source]

n_samples is a positive integer or None.

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

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