torchcell.models.dango.Dango

class Dango(gene_num: int, edge_types: list[str], hidden_channels: int = 64, num_heads: int = 4)[source]

Bases: Module

DANGO model for predicting higher-order genetic interactions

Implements: 1. GNN pre-training component 2. Meta-embedding integration 3. Hypergraph self-attention for prediction

forward(cell_graph: HeteroData, batch: HeteroData) → tuple[Tensor, dict[str, Tensor]][source]

Forward pass for the DANGO model

Parameters:
  • cell_graph – The cell graph containing multiple edge types

  • batch – HeteroDataBatch containing perturbation information

Returns:

  • predictions: Predicted interaction scores, one per genotype (batch.num_graphs)

  • outputs: Dictionary containing node embeddings and intermediate values

Return type:

Tuple containing

Raises:

ValueError – if a genotype lists the same gene twice (the HyperSAGNN self mask is positional, so a duplicate would attend to its own copy), or if a genotype has no perturbed gene (see HyperSAGNN.forward).

property num_parameters: dict[str, int]

Count the number of trainable parameters in the model.