torchcell.metabolism.constraints.build_gem_tensors

build_gem_tensors(model: cobra.Model, model_dir: str | None = None, *, with_thermo: bool = True, with_independent_rows: bool = True, biomass_id: str | None = None) → GemTensors[source]

Extract every constraint tensor from a cobra model.

Parameters:
  • model – Any cobra model. Nothing here is organism-specific.

  • model_dir – GEM checkout root, needed only for the thermodynamic CSVs.

  • with_thermo – Load the deltaG tables. Requires model_dir.

  • with_independent_rows – Run the rank-revealing QR. Costs a few seconds on a 2,806 x 4,131 model and is cached by the caller, not here.

  • biomass_id – Reaction id of the growth reaction. When omitted it is detected by objective coefficient, which is how a GEM declares it.

Returns:

A fully populated GemTensors.