torchcell.metabolism.constraints.CatalyticUnits
- class CatalyticUnits(*, unit_gene_index: Tensor, unit_reaction: Tensor, n_units: int, n_multigene_units: int, n_reactions_with_gpr: int, gene_ids: list[str])[source]
Bases:
BaseModelThe GPR, flattened into AND-terms, as index arrays rather than strings.
A gene-protein-reaction rule is a disjunction of conjunctions:
(a and b) or cmeans reactionjruns if the complex{a,b}is intact OR the isozymecis present. Each conjunction is one catalytic unit. Complexes take a min over their genes (the scarcest subunit limits the complex); isozymes add (their capacities sum).Stored as a flat (unit, gene) edge list plus a (unit -> reaction) map, which is the shape a scatter-based
softmin/index_addconsumes directly. Storing the parsed rule as a string and re-parsing per forward pass would be the same information at 10^4 times the cost.- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].