Check GRASP models

Format checks

set_up_grasp_models.check_models.format_checks.check_kinetics_met_separators(data_dict)

Given the excel file as argument, in the kinetics sheet for columns where cells can have multiple values, makes sure these values are not separated by a comma, semi-colon, or dot. If everything is fine flag is 0, otherwise it is set to 1.

Parameters

data_dict (dict) – a dictionary that represents the excel file with the GRASP model.

Return type

bool

Returns

Whether or not lists in the kinetics sheet are separated by a space.

set_up_grasp_models.check_models.format_checks.check_kinetics_subs_prod_order(data_dict)

Given a GRASP input excel file, check if the metabolite names in the substrate and product order columns in the kinetics sheet are valid, i.e. if they are indeed substrates and products of the respective reaction. Inactive metabolites are not accounted for.

Parameters

data_dict (dict) – a dictionary that represents the excel file with the GRASP model.

Return type

bool

Returns

Whether or not lists in the kinetics sheet are separated by a space.

set_up_grasp_models.check_models.format_checks.check_met_rxn_order(data_dict)

Given the excel file as argument, checks if the order of reactions and metabolites in all sheets is consistent with the order in the stoichiometry matrix. If everything is fine flag is 0, otherwise it is set to 1.

Parameters

data_dict (dict) – a dictionary that represents the excel file with the GRASP model.

Return type

bool

Returns

Whether or not reactions and metabolites order in the different sheets are consistent.

set_up_grasp_models.check_models.format_checks.check_rxn_mechanism_order(data_dict)

Given the excel file as argument, it goes through the ‘kinetic mechanism’ column in the ‘kinetics1’ sheet and checks if hard coded mechanisms (‘diffusion’, ‘freeExchange’, ‘fixedExchange’, ‘massAction’) come before enzymatic mechanisms. Also checks if ‘fixedExchange’ mechanisms are the very last ones.

Parameters

data_dict (dict) – a dictionary that represents the excel file with the GRASP model.

Return type

bool

Returns

Whether or not lists in the kinetics sheet are separated by a space.

Mass balance checks

set_up_grasp_models.check_models.mass_balance_checks.check_balanced_metabolites(data_dict)

Checks if metabolites that are both consumed and produced in the stoichiometric matrix are marked as balanced and the other way around. Checking for mass balances is more accurate though. If everything is fine flag is 0, otherwise it is set to 1.

Parameters

data_dict (dict) – a dictionary that represents the excel file with the GRASP model.

Return type

bool

Returns

Whether or not metabolites are marked balanced/fixed correctly.

set_up_grasp_models.check_models.mass_balance_checks.check_flux_balance(data_dict)

When all fluxes are specified in the measRates sheet, check if all metabolites are mass balanced (well, the ones that are marked as balanced in the mets sheet). If everything is fine flag is 0, otherwise it is set to 1.

Parameters

data_dict (dict) – a dictionary that represents the excel file with the GRASP model.

Return type

bool

Returns

Whether or not all metabolites mass is balanced.

Thermodynamic feasibility checks

set_up_grasp_models.check_models.thermodynamics_checks.calculate_dG(data_dict, gas_constant, temperature, rxn_order=None)

Given a dictionary representing a GRASP input file, calculates the minimum and maximum reaction dGs based on the standard dGs in thermoRxns and metabolite concentrations in thermoMets. It also calculates the mass-action ratio and the part of the dG based on the mass-action ratio.

Parameters
  • data_dict (dict) – a dictionary that represents the excel file with the GRASP model.

  • gas_constant (float) – the gas constant to calculate the Gibbs energy.

  • temperature (float) – the temperature to calculate the Gibbs energy.

  • rxn_order (Optional[list]) – a list with the reactions order (optional).

Return type

tuple

Returns

Mass action ratio dataframe, dG_Q dataframe, Gibbs energies dataframe.

set_up_grasp_models.check_models.thermodynamics_checks.check_thermodynamic_feasibility(data_dict)

Given a dictionary representing a GRASP input file, it checks if the reaction’s dG are compatible with the respective fluxes. It works both when all fluxes are specified in measRates and when robust fluxes are calculated for a fully determined system. If the fluxes are not fully specified not the system is fully determined, it doesn’t work.

Parameters

data_dict (dict) – a dictionary representing a GRASP input file.

Return type

tuple

Returns

Whether or not the model is thermodynamically feasible plus fluxes and Gibbs energies dataframes.

set_up_grasp_models.check_models.thermodynamics_checks.get_robust_fluxes(data_dict, rxn_order=None)

Given a dictionary representing a GRASP input file, it calculates the robust fluxes (almost) as in GRASP, unless the system is not fully determined.

Parameters
  • data_dict (dict) – path to the GRASP input file

  • rxn_order (Optional[list]) – a list with the reactions order (optional)

Returns

dataframe with flux mean and std values

Return type

fluxes_df