torchcell.data.GenotypeAggregator

class GenotypeAggregator(root: str)[source]

Bases: Aggregator

Aggregator keyed by a hash of the experiment’s full perturbation set.

aggregate_check(data: dict[str, Experiment | FitnessExperiment | GeneInteractionExperiment | GeneEssentialityExperiment | SyntheticLethalityExperiment | SyntheticRescueExperiment | CalMorphExperiment | MicroarrayExpressionExperiment | MicroarrayExpressionScoreExperiment | MicroarrayExpressionRatioExperiment | InductionTimecourseExpressionExperiment | RNASeqExpressionExperiment | PseudobulkExpressionExperiment | VisualScoreExperiment | MetaboliteExperiment | ProteinAbundanceExperiment | ProteinFoldChangeExperiment | EnvironmentResponseExperiment | StrainEnvironmentResponseExperiment | SegregantGrowthExperiment | SegregantPerturbationExperiment | ProductTiterExperiment | ProteinTurnoverExperiment | ProteinSynthesisRateExperiment | FluxExperiment | PromoterActivityExperiment | PooledSortSeqExpressionExperiment | BiosensorFluorescenceExperiment | GradedGeneEssentialityExperiment | PhosphositeIntensityExperiment | MorphologyExperiment | MrnaNumberFractionExperiment | FitnessContrastExperiment | SegregantExpressionExperiment | LifeCycleExperiment | PseudobulkUmiCountExperiment | GenomeArchitectureExperiment | ExperimentReference | FitnessExperimentReference | GeneInteractionExperimentReference | GeneEssentialityExperimentReference | SyntheticLethalityExperimentReference | SyntheticRescueExperimentReference | CalMorphExperimentReference | MicroarrayExpressionExperimentReference | MicroarrayExpressionScoreExperimentReference | MicroarrayExpressionRatioExperimentReference | InductionTimecourseExpressionExperimentReference | RNASeqExpressionExperimentReference | PseudobulkExpressionExperimentReference | VisualScoreExperimentReference | MetaboliteExperimentReference | ProteinAbundanceExperimentReference | ProteinFoldChangeExperimentReference | EnvironmentResponseExperimentReference | StrainEnvironmentResponseExperimentReference | SegregantGrowthExperimentReference | SegregantPerturbationExperimentReference | ProductTiterExperimentReference | ProteinTurnoverExperimentReference | ProteinSynthesisRateExperimentReference | FluxExperimentReference | PromoterActivityExperimentReference | PooledSortSeqExpressionExperimentReference | BiosensorFluorescenceExperimentReference | GradedGeneEssentialityExperimentReference | PhosphositeIntensityExperimentReference | MorphologyExperimentReference | MrnaNumberFractionExperimentReference | FitnessContrastExperimentReference | SegregantExpressionExperimentReference | LifeCycleExperimentReference | PseudobulkUmiCountExperimentReference | GenomeArchitectureExperimentReference]) → str[source]

Return a SHA-256 hash of the experiment’s perturbed gene set.

Keyed on the sorted SET of systematic_gene_names ONLY (perturbation_type is intentionally dropped) so this matches how MeanExperimentDeduplicator.duplicate_check groups genotypes. This lets the same genotype expressed across modalities co-locate: a singleton expression record (marker-specific type, e.g. kanmx_deletion) and a replicated fitness record rewritten to mean_deletion by the deduplicator share one bucket because their perturbed gene set is equal. (The deduplicator additionally keys on experiment_type; the aggregator must NOT, since merging across modalities is the whole point here.)

Every perturbation counts toward the key, including heterologous gene_addition cassette genes. That makes a cassette-bearing production strain key-disjoint from an otherwise identical single-deletion strain – see DeletionKeyedGenotypeAggregator for the variant that treats a constant cassette as reference-strain background.

# TODO When non-deletion perturbation axes are introduced (overexpression, # allele swaps, integrations, etc.), this key MUST become # (gene-set, perturbation-axis) so that a deletion and an # overexpression of the SAME gene are not merged into one bucket. Today # every perturbation is a deletion, so the gene set alone is unambiguous.

aggregate_key_raw(record: dict[str, Any]) → str[source]

Return the gene-set grouping key for one raw record dict.

Same hash as aggregate_check(), read off the stored JSON so the streaming process never builds pydantic objects to group.