FbaOptmization¶
Optimization support for FBA based models (FBA and TFA).
- class f2xba.FbaOptimization(fname, cobra_model=None)[source]¶
Support optimization of SBML encoded FBA based models generated by f2xba.
Using the COBRApy interface for optimization of FBA/TFA models: Use of FbaOptimization is optional, but it can provide access to additional features, e.g. results analysis, and ensures correct configuration of variables and constraints for thermodynamics constraint variants.
import cobrapy cobra_model = cobra.io.read_sbml_model('iML1515.xml') fo = FbaOptimization('iML1515.xml', cobra_model) cobra_model.medium = lb_medium solution = cobra_model.optimize()
Using the gurobipy interface for optimization of FBA/TFA models: Note: GUROBI optimizer with gurobipy (https://www.gurobi.com) needs to be installed on your system.
fo = FbaOptimization('iML1515.xml') fo.medium = lb_medium solution = fo.optimize()
- property medium¶
Mimic medium property of COBRApy to set and retrieve medium.
- Returns:
exchange reaction ids with (positive valued) uptake rates
- Return type:
dict
- single_gene_deletion(genes=None, method='fba', solution=None, **kwargs)[source]¶
Perform a single gene deletion analysis for FBA based models using gurobipy interface.
Interface aligned to COBRApy single_gene_deletion() method. Perform single gene deletion simulations for provided list of gene in genes. If genes is not provided, perform gene deletion for all genes that may be active in the wild type solution. In case a gene is not required in the wild type solution, a knockout simulation is not performed for this gene. Its growth rate value is set to the wild type value and its optimization status is set to wt_solution. With method set to moma, linear moma, room or linear room, respective method is used for the optimization. A wild type solution can be provided with parameter solution, alternatively a wild type solution is determined automatically.
When method is set to room or linear room, following keyword arguments can be added: delta: relative tolerance range (default: 0.03), epsilon: absolute tolerance range (default: 1e-3), time_limit: in seconds for single gene deletion simulation, used for ‘room’ (default: 30.0).
fo = FbaOptimization('iML1515.xml') fo.medium = lb_medium df_sgko = fo.single_gene_deletion()
Example for MOMA based SGKO analysis for selected genes with wild type solution provided:
pfba_solution = fo.pfba() fo.single_gene_deletion(genes=['b0002', 'b0003', 'b0007', 'b0025'], method='moma', solution=pfba_solution)
- Parameters:
genes (list or set) – (optional) gene ids,
method (str) – (optional) alternative methods ‘moma’, ‘linear moma’, ‘room’ or ‘linear room’
solution (
Solution) – (optional) wild type FBA solutionkwargs – keyword arguments passed on to ‘room’ and ‘linear room’ methods
- Returns:
Table with SGKO results, containing growth rate in h-1, optimization status and fitness
- Return type:
pandas.DataFrame