mass.util.qcqa

Module containing functions to assess the quality of a model.

Module Contents

Functions

qcqa_model(model, **kwargs)

Check the model quality and print a summary of the results.

get_missing_reaction_parameters(model[, ...])

Identify the missing parameters for reactions in a model.

get_missing_custom_parameters(model[, reaction_list, ...])

Identify the missing custom parameters in a model.

get_missing_steady_state_fluxes(model[, reaction_list])

Identify the missing steady state flux values for reactions in a model.

get_missing_initial_conditions(model[, ...])

Identify the missing initial conditions for metabolites in a model.

get_missing_boundary_conditions(model[, ...])

Identify the missing boundary conditions for metabolites in a model.

check_superfluous_consistency(model[, reaction_list])

Check parameters of model reactions to ensure numerical consistentency.

check_elemental_consistency(model[, reaction_list])

Check the reactions in the model to ensure elemental consistentency.

check_reaction_parameters(model[, reaction_list, ...])

Check the model reactions for missing and superfluous parameters.

is_simulatable(model)

Determine whether a model can be simulated.

mass.util.qcqa.qcqa_model(model, **kwargs)[source]

Check the model quality and print a summary of the results.

Notes

Checking the model quality involves running a series of quality control and assessment tests to determine consistency (e.g. elemental) in the model, missing values, and whether the model can be simulated.

Parameters
  • model (MassModel) – The model to inspect.

  • **kwargs

    parameters :

    bool indicating whether to check for undefined parameters in the model.

    Default is False.

    concentrations :

    bool indicating whether to check for undefined initial and boundary conditions in the model.

    Default is False.

    fluxes :

    bool indicating whether to check for undefined steady state fluxes in the model.

    Default is False.

    superfluous :

    bool indicating whether to check for superfluous parameters in the model and ensure existing parameters are consistent with one another if superfluous parameters are present.

    Default is False.

    elemental :

    bool indicating whether to check for elemental consistency in the model. Boundary reactions are ignored.

    Default is False.

    simulation_only :

    Only check for undefined values necessary for simulating the model.

    Default is True.

mass.util.qcqa.get_missing_reaction_parameters(model, reaction_list=None, simulation_only=True)[source]

Identify the missing parameters for reactions in a model.

Notes

Will include the default reaction parameters in custom rate laws. To get missing custom parameters for reactions with custom rate expressions, use get_missing_custom_parameters() instead.

Parameters
  • model (MassModel) – The model to inspect.

  • reaction_list (iterable) – An iterable of MassReactions in the model to be checked. If None then all reactions in the model will be utilized.

  • simulation_only – Only check for undefined values necessary for simulating the model.

Returns

missing – A dict with MassReactions as keys and a string identifying the missing parameters as values. Will return as an empty dict if there are no missing values.

Return type

dict

See also

MassReaction.all_parameter_ids

List of default reaction parameters.

mass.util.qcqa.get_missing_custom_parameters(model, reaction_list=None, simulation_only=True)[source]

Identify the missing custom parameters in a model.

Notes

Will not include default reaction parameters. To get missing standard reaction parameters for reactions with custom rate laws, use get_missing_reaction_parameters() instead.

Parameters
  • model (MassModel) – The model to inspect.

  • reaction_list (iterable) – An iterable of MassReactions in the model to be checked. If None then all reactions in the model will be utilized.

  • simulation_only – Only check for undefined values necessary for simulating the model.

Returns

missing – A dict with MassReactions as keys and a string identifying the missing custom parameters as values. Will return as an empty dict if there are no missing values.

Return type

dict

See also

MassReaction.all_parameter_ids

List of default reaction parameters.

mass.util.qcqa.get_missing_steady_state_fluxes(model, reaction_list=None)[source]

Identify the missing steady state flux values for reactions in a model.

Parameters
  • model (MassModel) – The model to inspect.

  • reaction_list (iterable) – An iterable of MassReactions in the model to be checked. If None then all reactions in the model will be utilized.

Returns

missing – List of MassReactions with missing steady state fluxes. Will return as an empty list if there are no missing values.

Return type

list

mass.util.qcqa.get_missing_initial_conditions(model, metabolite_list=None, simulation_only=True)[source]

Identify the missing initial conditions for metabolites in a model.

Notes

Does not include boundary conditions.

Parameters
  • model (MassModel) – The model to inspect.

  • metabolite_list (iterable) – An iterable of MassMetabolites in the model to be checked. If None then all metabolites in the model will be utilized.

  • simulation_only – Only check for undefined values necessary for simulating the model.

Returns

missing – List of MassMetabolites with missing initial conditions. Will return as an empty list if there are no missing values.

Return type

list

mass.util.qcqa.get_missing_boundary_conditions(model, metabolite_list=None, simulation_only=True)[source]

Identify the missing boundary conditions for metabolites in a model.

Parameters
  • model (MassModel) – The model to inspect.

  • metabolite_list (iterable) – An iterable of ‘boundary metabolites’ or MassMetabolites in the model to be checked. If None then all ‘boundary metabolites’ in the model will be utilized.

  • simulation_only – Only check for undefined values necessary for simulating the model.

Returns

missing – List of metabolites with missing boundary conditions. Will return as an empty list if there are no missing values.

Return type

list

See also

MassModel.boundary_metabolites

List of boundary metabolites found in the model.

mass.util.qcqa.check_superfluous_consistency(model, reaction_list=None)[source]

Check parameters of model reactions to ensure numerical consistentency.

Parameter numerical consistency includes checking reaction rate and equilibrium constants to ensure they are mathematically consistent with one another. If there are no superfluous parameters, the existing parameters are considered consistent.

Notes

The MassConfiguration.decimal_precision is used to round the value of abs(rxn.kr - rxn.kf/rxn.Keq) before comparison.

Parameters
  • model (MassModel) – The model to inspect.

  • reaction_list (iterable) – An iterable of MassReactions in the model to be checked. If None then all reactions in the model will be utilized.

Returns

inconsistent – A dict with MassReactions as keys and a string identifying the incosistencies as values. Will return as an empty dict if there are no inconsistencies.

Return type

dict

mass.util.qcqa.check_elemental_consistency(model, reaction_list=None)[source]

Check the reactions in the model to ensure elemental consistentency.

Elemental consistency includes checking reactions to ensure they are mass and charged balanced. Boundary reactions are ignored because they are typically unbalanced.

Parameters
  • model (MassModel) – The model to inspect.

  • reaction_list (iterable) – An iterable of MassReactions in the model to be checked. If None then all reactions in the model will be utilized.

Returns

inconsistent – A dict with MassReactions as keys and a string identifying the incosistencies as values. Will return as an empty dict if there are no inconsistencies.

Return type

dict

mass.util.qcqa.check_reaction_parameters(model, reaction_list=None, simulation_only=True)[source]

Check the model reactions for missing and superfluous parameters.

Parameters
  • model (MassModel) – The model to inspect.

  • reaction_list (iterable) – An iterable of MassReactions in the model to be checked. If None then all reactions in the model will be utilized.

  • simulation_only – Only check for undefined values necessary for simulating the model.

Returns

  • tuple (missing, superfluous)

  • missing (dict) – A dict with MassReactions as keys and a string identifying the missing parameters as values. Will return as an empty dict if there are no missing values.

  • superfluous (dict) – A dict with MassReactions as keys and superfluous parameters as values. Will return as an empty dict if there are no superfluous values.

mass.util.qcqa.is_simulatable(model)[source]

Determine whether a model can be simulated.

Parameters

model (MassModel) – The model to inspect.

Returns

  • tuple (simulate_check, consistency_check)

  • simulate_check (bool) – True if the model can be simulated, False otherwise.

  • consistency_check (bool) – True if the model has no issues with numerical consistency, False otherwise.