rbatools.rba_session API documentation

rbatools.rba_session module

Classes

class SessionRBA

User interface with high level functions to import model, change model, different solving methods and results export.

Attributes

xml_dir : str
Directory of imported xml model files
model : rba.RbaModel
RBA model (parsed from xml files), from which matrices are built
Problem : ProblemRBA
RBA Problem
Medium : dict
Dictionary with external metabolites and corresponding concentrations
ModelStructure : ModelStructureRBA
Model structure representation
Results : dict
Simulation results, added if record_results method has been called
Parameters : dict
Simulation parameters, added if record_parameters method has been called
SimulationData : SimulationDataRBA
SimulationData object, added if write_results method has been called
SimulationParameters : SimulationParametersRBA
SimulationParameters object, added if write_results method has been called
ExchangeMap :  dict
Map of all metabolites, the corresponding transport-reactions and stoichiometires
ExchangeReactions : bool –> default:False
True if exchange reactions have been added via add_exchange_reactions method

Methods

def __init__(self, xml_dir, lp_solver='cplex')

Creates SessionRBA object from files

Parameters

xml_dir : str
Path to the directory where rba-model files are located.
lp_solver : str
Specifies which LP-solver should be used ('cplex' or 'swiglpk') Default: 'cplex'
def add_exchange_reactions(self)

Adds explicit exchange-reactions of boundary-metabolites to RBA-problem, named R_EX_ followed by metabolite name (without M_ prefix).

def add_parameter_multiplier(self, model_parameter, rebuild_model=True)

Adds a multiplicative coeffiecient for specified model parameter, named after provided model_parameter, followed by '_multiplier'. This coefficient might be changed from 1 (neutral) to any multiplicative term of parameter value.

Parameters

model_parameter : str
Model parameter, for which a constant multiplier should be added
rebuild_model : bool
Wheter the model should be immediately rebuilt Default: True
def add_parameter_multipliers_for_enzyme_efficiencies(self, enzymes_list=[], default_parameter_ids=['default_efficiency', 'default_transporter_efficiency'])

Adds a multiplicative coeffiecient for forward- and backward efficiencies of provided enzymes. This coefficient might be changed from 1 (neutral) to any multiplicative term of parameter value.

Parameters

enzymes_list : list
Model parameter, for which a constant multiplier should be added Default: [] –> then all enzymes are used
default_parameter_ids : list
Specifies the ids of default efficiencies Default: ["default_efficiency","default_transporter_efficiency"]

Returns

List of enzyme IDs, for which the multipliers have been added.

def add_reaction(self, reaction_id, reactants={}, products={}, reversible=False, rebuild_model=True)

Adds reaction to model.

Parameters

reaction_id : str
ID of reaction to add.
reactants : dict
Reactants of reaction (Metabolite-IDs as keys and their stoichiometries as values) Default: {}
products : dict
Products of reaction (Metabolite-IDs as keys and their stoichiometries as values) Default: {}
reversible : bool
Whether reaction is reversible Default: True
rebuild_model : bool
Wheter the model should be immediately rebuilt Default: True
def add_specific_kapps_for_default_kapp_enzyme(self, enzyme='', default_parameter_ids=['default_efficiency', 'default_transporter_efficiency'], rebuild_model=True)

Adds a specific efficiency parameter for enzymes, which are parameterised with the default efficiency. Specific parameter is named 'ENZYME_ID_forward_efficiency'/'ENZYME_ID_backward_efficiency' and initially defined exactly like the default parameter. Parameters


enzyme : str
ID of model enzyme
default_parameter_ids : list
Specifies the ids of default efficiencies Default: ["default_efficiency","default_transporter_efficiency"]
rebuild_model : bool
Wheter the model should be immediately rebuilt Default: True
def add_specific_kapps_for_default_kapp_enzymes(self, enzymes_list=[], default_parameter_ids=['default_efficiency', 'default_transporter_efficiency'], rebuild_model=True)

Adds a specific efficiency parameter for all enzymes provided as input list of IDs, which have the default efficiency assigned as efficiency parameter. Parameters


enzymes_list : list
Model parameter, for which a constant multiplier should be added Default: [] –> then all enzymes are used
default_parameter_ids : list
Specifies the ids of default efficiencies Default: ["default_efficiency","default_transporter_efficiency"]
rebuild_model : bool
Wheter the model should be immediately rebuilt Default: True

Returns

List of enzyme IDs, for specific efficiencies have been added.

def apply_gene_knock_out(self, gene)

Simulates a gene knock out. Constrains all variables in the LP-problem (enzymes, other machineries), which require this gene(s), to zero.

Parameters

gene : str or list of strings
ID(s) of model-proteins to be knocked out. Can either be gene-identifier, represented as ID or ProtoID of proteins in rbatools.protein_bloc.ProteinBlock.Elements class (depends on whether protein-isoforms are considered).
def build_fba_model(self, rba_derived_biomass_function=True, from_rba_solution=True)

Derives and constructs FBA-problem from the RBA-problem and stores the rbatools.fba_problem.ProblemFBA object as attribute 'FBA'. (By default non-parsimonious FBA-problem)

Parameters

rba_derived_biomass_function : bool
If True: A biomass function (named 'R_BIOMASS_targetsRBA'), specific to the current growth rate, is added to the problem. If False: It is assumed that there exists a biomass function, in the model.
from_rba_solution : bool
If True: The biomass-composition, specific to the current solution (growth-rate and decision-variable values) is determined. If False: The biomass-composition, specific to the current growth-rate and the corresponding target-values is defined.
def build_model_structure(self)

Builds model structure object from model xml-files, adds it as ModelStructure attribute and stores as json file.

def clear_results_and_parameters(self)

Removes all previosly recorded results and deletes own 'Results'-attribute.

def derive_current_biomass_function(self, from_rba_solution=False)

Returns a biomass-function, corresponding to the currently imposed biomass composition in the RBA-model. (Since biomass composition is growth-rate dependent, it changes when other growth-rates are set.)

Parameters

from_rba_solution : bool
If True: The biomass-composition, specific to the current solution (growth-rate and decision-variable values) is determined. If False: The biomass-composition, specific to the current growth-rate and the corresponding target-values is defined.

Returns

pandas.core.frame.DataFrame with columns "Metabolite" and "Coefficient", indicating metabolic species and their respective 'stoichiometric' coefficients in generated biomass function.

def find_max_growth_rate(self, precision=0.001, max=4.0, start_value=nan, recording=False, omit_objective=False, feasible_stati=['optimal', 'feasible'], try_unscaling_if_sol_status_is_feasible_only_before_unscaling=True)

Applies dichotomy-search to find the maximal feasible growth-rate.

Parameters

precision : float
Numberic precision with which maximum is approximated. Default: 0.00001
max : float
Defines the highest growth rate to be screened for. Default: 4.0
start_value : float
Defines the first growth-rate to test during the dichotomy search. Default: numpy.nan –> then the middle between 0 and max is used.
recording : bool
Records intermediate feasible solutions while approaching the maximum growth-rate. Default: False
feasible_stati : list of str
List with acceptable solution statuses. Default: ["optimal","feasible"]
try_unscaling_if_sol_status_is_feasible_only_before_unscaling : bool
If true; the problem will be attempted to be solved without scaling, if the scaled problem is feasible but the solution is not feasible after unscaling (CPLEX solution-status 5). Default: True

Returns

maximum feasible growth rate as float.

def find_min_substrate_concentration(self, metabolite, precision=1e-05, max=100.0, recording=False, feasible_stati=['optimal', 'feasible'], try_unscaling_if_sol_status_is_feasible_only_before_unscaling=True)

Applies dichotomy-search to find the minimal feasible concentration of growth-substrate in medium, at a previously set growth-rate.

Parameters

metabolite : str
ID of metabolite in medium.
precision : float
Numberic precision with which minimum is approximated. Default: 0.00001
max : float
Defines the highest concentration rate to be screened for. Default: 100
recording : bool
Records intermediate feasible solutions while approaching the minimum concentration. Default: False
feasible_stati : list of str
List with acceptable solution statuses. Default: ["optimal","feasible"]
try_unscaling_if_sol_status_is_feasible_only_before_unscaling : bool
If true; the problem will be attempted to be solved without scaling, if the scaled problem is feasible but the solution is not feasible after unscaling (CPLEX solution-status 5). Default: True

Returns

minimum feasible growth-substrate concentration as float.

def get_compartment_information(self, compartment)

Get information on model compartment from ModelStructure

Parameters

compartment : str
ID of compartment.

Returns

Dictionary with information: 'ID' : compartment ID in model (type str) 'associatedProteins' : proteins localised to compartment (type list) 'associatedEnzymes' : enzyme located in compartment (type list) 'associatedReactions' : metabolic reactions located in compartment (type list) 'associatedMacromolecules' : other macromolecules than proteins (DNA,RNA), located in compartment (type list) 'Capacity_Constraint' : id of corresponding density constraint.

def get_compartments(self)

Get all model compartment-IDs

Returns

List of IDs

def get_constant_enzyme_efficiencies(self, enzymes_list=[], exclude_default=False, default_parameter_ids=['default_efficiency', 'default_transporter_efficiency'])

Returns pandas DataFrame with efficiency values of enzymes, which are of parameter type constant.

Parameters

enzymes_list : list
Model parameter, for which a constant multiplier should be added Default: [] –> then all enzymes are used
exclude_default : bool
If True enzymes without a specific enzyme capacity are ignored. Default: False
default_parameter_ids : list
Specifies the ids of default efficiencies Default: ["default_efficiency","default_transporter_efficiency"]

Returns

pandas.DataFrame with columns: 'Enzyme','Forward_efficiency','Backward_efficiency'

def get_constraint_saturation(self, constraints=[])

Determines the saturation of model constraints at current solution.

Parameters

constraints : str or list of str
Specifies constraints(s) for which the saturation is to be determined. Optional input: If not provided all model-constraints are taken

Returns

Pandas DataFrame with constraint-names as indices and the columns 'LHS', 'RHS', and 'Saturation'. 'LHS': The sum over the respoctive constraint-row multiplied elementwise with the solution vector. 'RHS': The value of the problem's righthand side, correesponding to the respective constraint. 'Saturation': The saturation of the respective constraint ('LHS'/'RHS').

def get_current_parameter_value(self, parameter)

Return current value of model parameter (depending on currently set growth-rate and medium-composition).

Parameters

parameter : str
ID of model parameter

Returns

Float : Parameter value
 
def get_density_constraint_information(self, density_constraint)

Get information on model density-constraint from ModelStructure

Parameters

density_constraint : str
ID of constraint.

Returns

Dictionary with information: 'ID' : density constraint ID in model (type str) 'AssociatedCompartment' : ID of compartment this constraint defines the capacity for (type str) 'Type' : Equality or inequality (type str) 'CapacityParameterID' : ID of density parameter (type str) 'CapacityParameter' : Definition of capacity parameter (type dict) See doc string of rbatools.rba_session.SessionRBA.get_parameter_definition method

def get_density_constraints(self)

Get all model density constraint-IDs

Returns

List of IDs

def get_enzyme_constraint_information(self, enzyme_constraint)

Get information on model enzyme-capacity constraint from ModelStructure

Parameters

enzyme_constraint : str
ID of constraint.

Returns

Dictionary with information: 'ID' : enzyme-constraint ID in model (type str) 'AssociatedEnzyme' : ID of enzyme this constraint relates to (type str) 'AssociatedReaction' : ID of reaction this constraint relates to (type str) 'Direction': forward or backward efficiency (type str) 'Type' : Equality or inequality (type str) 'CapacityParameterID' : ID of capacity parameter (type str) 'CapacityParameter' : Definition of capacity parameter (type dict) See doc string of rbatools.rba_session.SessionRBA.get_parameter_definition method

def get_enzyme_constraints(self)

Get all model enzyme-capacity constraint-IDs

Returns

List of IDs

def get_enzyme_information(self, enzyme)

Get information on model enzyme from ModelStructure

Parameters

enzyme : str
ID of enzyme.

Returns

Dictionary with information: 'ID' : enzyme ID in model (type str) 'OtherIDs' : identifiers of this enzyme in other namespaces (BiGG, KEGG …) (type dict) 'Reaction' : associated metabolic reaction (type str) 'Isozymes' : Other enzymes catalysing the same metabolic reaction (type list) 'IdenticalEnzymes' : Other enzymatic activities of this enzyme, cellular location ignored. (type list) 'EnzymesWithIdenticalSubunitComposition' : Other enzymatic activities of this enzyme IN SAME COMPARTMENT. (type list) 'Subunits' : Which proteins this enzyme is composed of and how many (type dict) 'EnzymeCompartment' : Location of enzyme (type str) 'ForwardCapacity_Constraint' : Id of associated forward capacity constraint. 'BackwardCapacity_Constraint' : Id of associated backward capacity constraint.

def get_enzymes(self)

Get all model enzyme-IDs

Returns

List of IDs

def get_feasible_range(self, variables=[])

Determines the feasible range of model variables or linear combinations of model variables.

Parameters

variables : str or list of str or dict
Specifies variable(s) for which the feasible range is to be determined. If str: Feasible range of the respective variable is determined If list of str: Feasible range for each variable in list is determined (If empty list, all model variables are chosen) If dict: Dictionary with user-specified ID of objective as key and dictionary with variable IDs as values and stoichiometric coefficients in objective as values. {'ID_objective':{'model_variable_1':coeff,'model_variable_2':coeff, …}} Default: [] All model-variables are taken one by one

Returns

Dictionary with variable-names or objective-names as keys and other dictionaries as values. The 'inner' dictionaries hold keys 'Min' and 'Max' with values representing lower and upper bound of feasible range respectively. E.g. : {'variableA':{'Min':42 , 'Max':9000},'variableB':{'Min':-9000 , 'Max':-42}…} or {'ID_objective':{'Min':42 , 'Max':9000}}

def get_general_model_information(self)

Get general model information from ModelStructure

Returns

Dictionary with information on model name, organism , author…

def get_macro_molecule_information(self, macro_molecule)

Get information on model macromolecule from ModelStructure

Parameters

macro_molecule : str
ID of macro molecule.

Returns

Dictionary with information: 'ID' : macromolecule ID in model (type str). 'ProtoID' : location independent macromolecule ID in model (type str). Equals ID without compartment-specific ending. 'Type' : DNA or RNA (type str) 'Compartment' : Location of the macromolecule (type str) 'Composition' : Which building-blocs the macromolecule is composed of and what is the stoichiometry (type dict) 'ProcessRequirements' : Which processes the macromolecule requires for synthesis and maintenance and how much (type dict) 'SupportsProcess' : Process-machineries, this macromolecule is a subunit of (type list) 'AssociatedTarget' : Target associated with macromolecule (type str)

def get_macro_molecules(self)

Get all model macromolecule-IDs

Returns

List of IDs

def get_medium(self)

Returns dictionary of current medium-composition, with external metabolites as keys and their concentrations as values.

Returns

Dict : medium composition
 
def get_metabolite_constraint_information(self, metabolite_constraint)

Get information on model metabolite mass-balance constraint from ModelStructure

Parameters

metabolite_constraint : str
ID of constraint.

Returns

Dictionary with information: 'ID' : metabolite ID in model (type str) 'AssociatedMetabolite' : ID of metabolite this constraint defines the mass-balance for (same as key) (type str) 'Type' : Equality or inequality (type dict)

def get_metabolite_constraints(self)

Get all model metabolite mass-balance constraint-IDs

Returns

List of IDs

def get_metabolite_information(self, metabolite)

Get information on model metabolite from ModelStructure

Parameters

metabolite : str
ID of metabolite.

Returns

Dictionary with information: 'ID' : meatbolite ID in model (type str) 'OtherIDs' : identifiers of this metabolite in other namespaces (BiGG, KEGG …) (type dict) 'Name' : Name according to BiGG (type str) 'ReactionsInvolvedWith' : Reactions which produce or consume this metabolite (type list) 'boundary' : Boundary metabolite (type boolean) 'Type' : Type of metabolite (internal exernal or biomass-precursor) (type str) 'Compartment' : Location of meatbolite (type str) 'AssociatedTarget' : Wheter metabolite represents a target 'MassBalance_Constraint' : Id of associated mass-balance constraint.

def get_metabolites(self)

Get all model metabolite-IDs

Returns

List of IDs

def get_model_statistics_information(self)

Get model statistics from ModelStructure

Returns

Dictionary with information

def get_module_information(self, module)

Get information on model module from ModelStructure

Parameters

module : str
ID of module.

Returns

Dictionary with information

def get_modules(self)

Get all model module-IDs

Returns

List of IDs

def get_parameter_definition(self, parameter)

Returns definition of model parameter.

Parameters

parameter : str
ID of model parameter

Returns

Dictionary with parameter definition information: {parameter:info} The info value is a dictionary itself, which depends on the whether the parameter is among aggrgates or functions. info={'Type' : str, –> type of parameter "Aggrgate" if aggregate and function type (michaelisMenten, linear, constant…) if function 'Equation' : str, –> mathematical equation of parameter definition 'Variables' : list, –> list of independent variables of paramter definition (growth-rate or medium components) 'Function_parameters' : list, –> list of function parameters in function definition. 'Multiplicative Terms' : list, –> list of multiplicative terms (function IDs) composing the parameter (several function ids if aggregate, only own id if function) 'Generic_latex' : str, –> equation in LaTex format (with variable ids for function parameters) 'Specific_latex' : str, –> equation in LaTex format (with actual values for function parameters) }

def get_parameter_evolution(self, model_parameter, x_values={'growth_rate': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]})

Returns the evolution of model parameter value over range of provided independent variable values.

Parameters

model_parameter : str
ID of model parameter, whos values should be determined over x_values.
x_values : dict
Dictionary with possible independent variables ('growth_rate' or medium components) as keys and list of respective values as values Default: {"growth_rate":[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]}

Returns

pandas.core.frame.DataFrame with columns for independent variable (growth-rate or medium component concentration) and respective parameter values.

def get_pareto_front(self, variable_X, variable_Y, N=10, sign_VY='max')

Determine Pareto front of two model variables or linear combinations of model variables. Initially the feasible range of the X variable is determined and the Y variable is optimised at different values of the X variable.

Parameters

variable_X : str or dictionary
If str : ID of variable, representing the X-coordinate of the Pareto-front If dict: Dictionary with user-specified ID of objective as key and dictionary with variable IDs as values and stoichiometric coefficients in objective as values. {'ID_objective_X':{'model_variable_1':coeff,'model_variable_2':coeff, …}} IMPORTANT: ID_objective_X must not equal any model variable ID.
variable_Y : str
If str : ID of variable, representing the Y-coordinate of the Pareto-front If dict: Dictionary with user-specified ID of objective as key and dictionary with variable IDs as values and stoichiometric coefficients in objective as values. {'ID_objective_Y':{'model_variable_1':coeff,'model_variable_2':coeff, …}} IMPORTANT: ID_objective_Y must not equal any model variable ID.
N : int
Number of intervals within the feasible range of X variable. Default: 10.
sign_VY : str
'max': Y variable is maximised 'min': Y variable is minimised Default: 'max'.

Returns

Pandas DataFrame with columns named after the two input variables and 'N' rows. Each row represents an interval on the Pareto front. Entries on each row are the X and Y coordinate on the Pareto front, representing the values of the two variables.

def get_process_constraint_information(self, process_constraint)

Get information on model process-capacity constraint from ModelStructure

Parameters

process_constraint : str
ID of constraint.

Returns

Dictionary with information: 'ID' : process-constraint ID in model (type str) 'AssociatedProcess' : Name of process this constraint relates to (type str) 'AssociatedProcessID' : ID of process this constraint relates to (type str) 'Type' : Equality or inequality (type str) 'CapacityParameterID' : ID of capacity parameter (type str) 'CapacityParameter' : Definition of capacity parameter (type dict) See doc string of rbatools.rba_session.SessionRBA.get_parameter_definition method

def get_process_constraints(self)

Get all model process-capacity constraint-IDs

Returns

List of IDs

def get_process_information(self, process)

Get information on model process from ModelStructure

Parameters

process : str
Name of process.

Returns

Dictionary with information: 'ID' : process ID in model (type str) 'Name' : name of process (same as key) (type str) 'Initiation' : reaction-string of initiation (type list) 'Composition' : Which proteins the process-machinery is composed of and how many (type dict) 'Components' : Substrates to process (type dict) 'Capacity_Constraint' : ID of associated capacity constraint

def get_processes(self)

Get all model process-names

Returns

List of names

def get_protein_information(self, protein)

Get information on model protein from ModelStructure

Parameters

protein : str
ID of protein.

Returns

Dictionary with information: 'ID' : protein ID in model (type str). May be compartment_isoform. 'ProtoID' : protein ID in model (type str). Equals ID without compartment-specific ending. 'ExternalIDs' : identifiers of this protein in other namespaces (Locus-tag, Gene-symbol, …) (type dict) 'Function' : associated function, according to Uniprot (type str) 'Name' : name, according to Uniprot (type list) 'associatedReactions' : Reactions, this protein is a subunit of (type list) 'associatedEnzymes' : Enzymes, this protein is a subunit of (type list) 'Compartment' : Location of the protein (type str) 'AAcomposition' : Which amino-acids the protein is composed of and what is the stoichiometry(type dict) 'AAnumber' : Length of protein (type int) 'Weight' : Weight of protein (type float) 'ProcessRequirements' : Which processes the protein requires for synthesis and maintenance and how much (type dict) 'SupportsProcess' : Process-machineries, this protein is a subunit of (type list) 'AssociatedTarget' : Wheter protein represents a (translation) target.

def get_proteins(self)

Get all model protein-IDs

Returns

List of IDs

def get_reaction_information(self, reaction)

Get information on model reaction from ModelStructure

Parameters

reaction : str
ID of reaction.

Returns

Dictionary with information 'ID' : reaction ID in model (type str) 'Compartment_Machinery' : Localisation of enzyme-subunit, catalysing this reaction. (type list) 'Name' : name according to BiGG (type str) 'OtherIDs' : Other reaction names (eg. BiGG, KEGG) (type list) 'Formula' : Reaction formula as string (type str) 'Reactants' : Which metabolites does this reaction consume of and many (type dict) 'Products' : Which metabolites does this reaction produce of and many (type dict) 'Reversible' : Wheter reaction is reversible (type bool) 'Type' : Type of reaction ('normal' or 'transport') (type str) 'Compartment_Species' : Location of the metabolites involved with this reaction (type list) 'Enzyme' : Enzyme catalysing this reaction (type str) 'Twins' : Isoreactions of this reactions (catalysed by iso-enzymes) (type list) 'AssociatedTarget' : Wheter reaction has a flux target.

def get_reactions(self)

Get all model reaction-IDs

Returns

List of IDs

def get_target_information(self, target)

Get information on model target from ModelStructure

Parameters

target : str
ID of target.

Returns

Dictionary with information: 'ID' : Target ID in model (type str) 'Group' : Class of targets (type str): Eg: 'macrocomponent_production','maintenance_atp_target', 'metabolite_production','replication_targets', 'rna_degradation' or 'translation_targets' 'Type' : Type of targets (type str): Eg: 'metabolite_production', 'degradation_fluxes', 'concentrations' or 'reaction_fluxes' 'TargetEntity' : For which entity the target is defined (type str) 'TargetParameterID' : Model-parameter ID which defines target value (type str) 'TargetParameter' : Model-parameter definition of target value (type dict) 'TargetConstraint' : 'Value' if target is defined as explicit value or 'upper/lower Bound'.

def get_targets(self)

Get all model target-IDs

Returns

List of IDs

def local_sensitivity(self, parameters=[], relative_parameter_difference=0.01, muapprox_precision=1e-07, musearch_max=1.0)

Determines local sensitivity of (max) growth-rate towards small parameter changes. Parameter value is increased and reduced by small relative values and the respective maximum growth-rate is determined. From the resulting differences in parameter value and growth-rate, the local sensitivity is inferred. In theory the local sensitivity represents the partial derivative of growth-rate vs parameter, at the wild-type. Beware that numerical precision is an issue with this method and can influence results.

Parameters

parameters : list or string
Parameters to apply local sensitivity ananlysis to. If list with model parameter IDs is provided, those are used. If str 'Enzymes' all enzyme capacities are used. If str 'Processes' all process capacities are used. If str 'Targets' all cellular targets are used. If str 'Densities' all compartment capacities are used. If empty list, all model cellular targets, enzyme- process- and compartment capacities are used. Default: []
relative_parameter_difference : float
Parameter is multplied once with factor (1+relative_parameter_difference) and once with factor (1-relative_parameter_difference). The resulting maximum growth rates are determined. Default: e-2
muapprox_precision : float
Numeric precision to which the maximum growth rate is determined. (See parameter 'precision' in method find_max_growth_rate) Default: e-8
muapprox_precision : float
Upper bound of search space for maximum growth rate. (See parameter 'max' in method find_max_growth_rate) Default: 1.0

Returns

Pandas DataFrame with results.

Columns

'Mu_WT' : Maximum wild-type growth-rate. 'WT_param_value' : original parameter value at maximum wild-type growth-rate. 'Relative_param_change' : 'relative_parameter_difference' input parameter 'Absolute_param_change' : 'relative_parameter_difference' input parameter times original parameter value at maximum wild-type growth-rate. 'Upper_Mu' : Maximum growth rate at parameter multiplied with factor (1+relative_parameter_difference) 'Lower_Mu' : Maximum growth rate at parameter multiplied with factor (1-relative_parameter_difference) 'Mu_change' : Difference between Upper- and Lower_Mu 'Absolute_Sensitivity' : Absolute difference in maximum growth-rate per absolute change in parameter-value ((d_mu)/(2out.loc[param,"Absolute_param_change"])). 'Scaled_Sensitivity' : Relative change in maximum growth-rate (to wild-type) per relative change in parameter-value ((d_mu/WT_mu)/(2relative_parameter_difference)).

def rebuild_from_model(self)

Rebuilds computational model-representation from own attribute "model" (rba.RbaModel-object).

def record_parameters(self, run_name)

Records Simulation parameters (LP-coefficients etc.) for further use. and stores them in own 'Parameters'-attribute as pandas.DataFrames in a dictionary with the respective run-name being a column in all DataFrames.

Parameters

run_name : str
Name of observation. Serves as ID for all Data, originating from these.
def record_results(self, run_name)

Records Simulation output for further use. and stores them in own 'Results'-attribute as pandas.DataFrames in a dictionary with the respective run-name being a column in all DataFrames.

Parameters

run_name : str
Name of observation. Serves as ID for all Data, originating from these.
def reload_model(self)

Reloads model from xml-files and then rebuild computational model-representation.

def return_exchange_fluxes(self)

Generates a dictonary with the exchang-rates of boundary-metabolites.

Returns

Dictonary with exchange-keys and respective -rates.

def sample_kapp_multipliers(self, n=1, mean=0, stdev=0.561, enzymes=[], Variables_to_record=[], wt_growth_rate=0.0)

Applies n random multiplicative factors to each individual enzymes forward and backward capacity and maximises growth-rate. The multiplicative factors are represented as e^^x, where x is drawn from a normal distribution. Records corresponding maximum groth-rate and specified solution values. Requires previous addition of multipliers to parameters, via add_parameter_multiplier method.

Parameters

n : int
Number of samples Default: 1
mean : float
Mean of normal distribution to draw from Default: 0
stdev : float
Stdev of normal distribution to draw from Default: 0.561
enzymes : list
List of enzymes to sample efficiencies for. Default: [] –> all model enzymes are used.
Variables_to_record : list
List of problem variables' solution values to be exported . Default: []
wt_growth_rate : float
Wild-type growth-rate to use as starting value for mumax-search. Default: 0.0 –> Then not set as starting value.

Returns

Dictionary: With growth-rate ["Mu"] and Variables_to_record as keys and list of sampled solution values as values.

def screen_multipliers(self, parameter, factors=[], precision=0.001, max=4.0, start_value=4.0, Variables_to_record=[])

Applies several multiplicative factors to model parameters. Records corresponding maximum groth-rate and specified solution values. Requires previous addition of multipliers to parameters, via add_parameter_multiplier method.

Parameters

parameter : str or list
parameter ID or list of parameters to screen
factors : list
List of multiplicative factors to screen Default: []
Variables_to_record : list
List of problem variables' solution values to be exported . Default: []

Returns

Dictionary: with factor values as keys and dictionary with growth-rate ["Mu"] and Variables_to_record as values.

def set_constant_enzyme_efficiencies(self, efficiencies)

Sets constant enzyme efficiencies (forward and backward) to specified values

Parameters

efficiencies : pandas.core.frame.DataFrame
Input DataFrame with columns: 'Enzyme','Forward_efficiency','Backward_efficiency'
def set_enzyme_backward_efficiency_multipliers(self, efficiency_multiplier_values=Empty DataFrame Columns: [] Index: [], rebuild_model=True)

Sets multiplicative factors of backward efficiency parameters of enzymes to specified values. Requires previous addition of multipliers to enzyme backward efficiencies, via add_parameter_multiplier method.

Parameters

efficiency_multiplier_values : pandas.DataFrame
Dataframe with mandatory columns 'Enzyme' and 'Backward_efficiency_multiplier' Default: {}
rebuild_model : bool
Wheter the model should be immediately rebuilt Default: True
def set_enzyme_forward_efficiency_multipliers(self, efficiency_multiplier_values=Empty DataFrame Columns: [] Index: [], rebuild_model=True)

Sets multiplicative factors of forward efficiency parameters of enzymes to specified values. Requires previous addition of multipliers to enzyme forward efficiencies, via add_parameter_multiplier method.

Parameters

efficiency_multiplier_values : pandas.DataFrame
Dataframe with mandatory columns 'Enzyme' and 'Forward_efficiency_multiplier' Default: {}
rebuild_model : bool
Wheter the model should be immediately rebuilt Default: True
def set_growth_rate(self, Mu)

Sets growth-rate to desired value.

Parameters

Mu : float
Growth rate
def set_medium(self, changes)

Sets the concentration of specified growth-substrate(s) in medium.

Parameters

changes : dict
Keys : ID of metabolite(s) in medium. Values : New concention(s)
def set_parameter_multiplier(self, model_parameter, parameter_type='', new_value=nan, rebuild_model=True)

Sets multiplicative factor of model parameter to specified value. Requires previous addition of multiplier to parameter, via add_parameter_multiplier method.

Parameters

model_parameter : str
Model parameter for which a function parameter should be changed
new_value : float
New parameter value to be applied Default: numpy.nan
rebuild_model : bool
Wheter the model should be immediately rebuilt Default: True
def set_parameter_value(self, model_parameter, function_parameter, parameter_type='', change_message='', new_value=nan, rebuild_model=True)

Sets function parameter of model parameter to specified value.

Parameters

model_parameter : str
Model parameter for which a function parameter should be changed
function_parameter : str
Function parameter to be changed
new_value : float
New parameter value to be applied
rebuild_model : bool
Wheter the model should be immediately rebuilt Default: True
def solve(self, run_name='DontSave', feasible_stati=['optimal', 'feasible'], try_unscaling_if_sol_status_is_feasible_only_before_unscaling=True)

Solves problem to find a solution.

Parameters

run_name : str
Name of observation. Serves as ID for all data, originating from this run. Special values : 'DontSave' : Results are not recorded 'Auto' : Results are automatically recorded and appended to existing ones. Named with number. Any other string: Results are recorded under this name. Default: 'DontSave'
feasible_stati : list of str
List with acceptable solution statuses. Default: ["optimal","feasible"]
try_unscaling_if_sol_status_is_feasible_only_before_unscaling : bool
If true; the problem will be attempted to be solved without scaling, if the scaled problem is feasible but the solution is not feasible after unscaling (CPLEX solution-status 5). Default: True

Returns

Bool, indicating if problem could be solved (feasible) or not (infeasible).

def undo_gene_knock_out(self, gene)

Undoes a gene knock out. Removes all constraints, on knocking out the provided genes

Parameters

gene : str or list of strings
ID(s) of model-proteins to be un-knocked out. Can either be gene-identifier, represented as ID or ProtoID of proteins in rbatools.protein_bloc.ProteinBlock.Elements class (depends on whether protein-isoforms are considered).
def write_results(self, session_name, digits=10)

Creates SimulationData and SimulationParameters objects from recordings ('Results'.'Parameters').

Stores them as rbatools.rba_simulation_data.SimulationDataRBA and rbatools.rba_simulation_parameters.SimulationParametersRBA objects as attributes. Access via attributes .SimulationData and SimulationParameters respectively.

Parameters

digits : int
Number of decimal places in the numeric results Default: 10
session_name : str
Name of Simulation session.