Check simulations

This module implements functions that do some quality check on the model simulation results.

check_for_negative_concentrations(data_df: DataFrame, quant_type: str, threshold: float = -1e-08)

Checks if all concentrations are higher than the given threshold. The idea is to make sure that there are no negative concentrations.

Parameters
  • data_df – a pandas dataframe with a concentrations or concentrations_unscaled column.

  • quant_type – which quantity to extract: “flux_rel”, “flux_abs”, “conc_rel”, “conc_abs”.

  • threshold – value to use to check if the concentrations are higher than that.

Returns

None

get_non_converging_models(conc_df_interp: DataFrame, n_models: int, met_names: list, quant_type: str, rel_tol: float = 0.005) list

Goes through every model and every metabolite time course, gets the last three time points in the simulation and checks if the difference between each pair of concentration values is greater than last_concentration_value*rel_tol, where the relative tolerance is defined by the user. If this is false, the model is considered to not converge.

Parameters
  • conc_df_interp – dataframe with the interpolated concentrations.

  • n_models – number of models in the dataframe.

  • met_names – name of all metabolites.

  • quant_type – which quantity to extract: “flux_rel”, “flux_abs”, “conc_rel”, “conc_abs”.

  • rel_tol – relative tolerance to use when checking if the model is converging.

Returns

A list with all model numbers that are considered to not converge.

remove_models(conc_df: DataFrame, flux_df: DataFrame, model_list: list) tuple

Removes all models in model_list from concentration and flux dataframes.

Parameters
  • conc_df – dataframe with metabolite concentrations.

  • flux_df – dataframe with reactions flux values.

  • model_list – list of models to be removed from dataframes.

Returns

The concentration and flux dataframes with models in model_list removed.