straindesign.strainDesignSolutions
Container for strain design solutions (SDSolutions)
Module Contents
- class straindesign.strainDesignSolutions.SDSolutions(model, sd, status, sd_setup, *, _lazy_init=None)[source]
Bases:
objectContainer for strain design solutions
Objects of this class are returned by strain design computations. This class contains the metabolic interventions on the gene, reaction or regulation level alongside with information about the strain design setup, including the model used and the strain design modules. Strain design solutions can be accessed either through the fields or through specific functions that preprocess or reformat strain designs for different purposes.
Instances of this class are not meant to be created by StrainDesign users.
- Parameters:
model (cobra.Model) – A metabolic model that is an instance of the cobra.Model class.
sd (list of dict) – A list of dicts every dict represents an intervention set. Keys in each dict are reaction/gene identifiers and the associated value determines if it is added (1), not added (0) or knocked out (-1). For regulatory interventions, (1) means active regulation and (0) means regulatory intervention not added. These will be translated to True and False.
status (str) – Status string of the computation (e.g.: ‘optimal’)
sd_setup (dict) –
A dictionary containing information about the problem setup. This dict can/should contain the keys MODEL_ID, MODULES, MAX_SOLUTIONS, MAX_COST, TIME_LIMIT, SOLVER, KOCOST, KICOST, REGCOST, GKICOST, GKOCOST
These entries can be set like this: sd_setup[straindesign.MODEL_ID] = model.id
- Returns
(SDSolutions): Strain design solutions
- __iadd__(other)[source]
In-place merge of two SDSolutions objects (deduplicates at compressed level).
- expand_all(n_per_group=None)[source]
Expand all compressed groups.
- Parameters:
n_per_group – None means all, int means keep up to n per group.
- expand_group(grp_idx)[source]
Expand one compressed group on demand.
Returns list of expanded solution dicts. Also updates reaction_sd, sd_cost, itv_bounds, and group_map in place.
- get_gene_reac_sd_assoc(i=None)[source]
Get reaction and gene-based strain design solutions, and show which reaction-based solution corresponds to which gene-based.
Often the association is not 1:1 but n:1.
- get_gene_reac_sd_assoc_mark_no_ki(i=None)[source]
Get reaction and gene-based strain design solutions, but also tag knock-ins that were not made with a 0
Often the association is not 1:1 but n:1.
- get_gene_sd_mark_no_ki(i=None)[source]
Get gene-based strain design solutions, but also tag knock-ins that were not made with a 0
- get_group(i)[source]
Get all expanded solution indices that belong to the same compressed group as solution i.
Returns a list of indices into reaction_sd that share the same compressed solution origin. Requires that compute_strain_designs was called with compression enabled.
- get_reaction_sd(i=None)[source]
Get reaction-based strain design solutions
Gene-based intervention sets are translated to the reaction level. This can be helpful to understand the impact of gene interventions. GPR-rules are accounted for automatically.
- get_reaction_sd_bnds(i=None)[source]
Get reaction-based strain design solutions represented by upper and lower bounds
Knocked-out reactions will show as upper and lower bounds of zero.
- get_reaction_sd_mark_no_ki(i=None)[source]
Get reaction-based strain design solutions, but also tag knock-ins that were not made with a 0
This can be helpful to analyze gene intervention sets in original metabolic models. GPR-rules are accounted for automatically.
- get_representative_sd()[source]
Get one representative expanded solution per compressed group.
Returns a list of dicts, one per unique compressed solution.
- straindesign.strainDesignSolutions.get_subset(sd, i)[source]
SDSolutions internal function: getting a subset of solutions