Core Tests

Basic

Perform basic tests on an instance of cobra.Model.

test_basic.test_compartments_presence(read_only_model)[source]

Expect that more than two compartments are defined in the model.

While simplified metabolic models may be perfectly viable, generally across the tree of life organisms contain at least one distinct compartment: the cytosol or cytoplasm. In the case of prokaryotes there is usually a periplasm, and eurkaryotes are more complex. In addition to the internal compartment, a metabolic model also reflects the extracellular environment i.e. the medium/ metabolic context in which the modelled cells grow. Hence, in total, at least two compartments can be expected from a metabolic model.

test_basic.test_find_pure_metabolic_reactions(read_only_model)[source]

Expect at least one pure metabolic reaction to be defined in the model.

If a reaction is neither a transport reaction, a biomass reaction nor a boundary reaction, it is counted as a purely metabolic reaction. This test requires the presence of metabolite formula to be able to identify transport reactions. This test is passed when the model contains at least one purely metabolic reaction i.e. a conversion of one metabolite into another.

test_basic.test_find_transport_reactions(read_only_model)[source]

Expect >= 1 transport reactions are present in the read_only_model.

test_basic.test_find_unique_metabolites(read_only_model)[source]

Expect there to be less metabolites when removing compartment tag.

Metabolites may be transported into different compartments, which means that in a compartimentalized model the number of metabolites may be much higher than in a model with no compartments. This test counts only one occurrence of each metabolite and returns this as the number of unique metabolites. The test expects that the model is compartimentalized, and thus, that the number of unique metabolites is generally lower than the total number of metabolites.

test_basic.test_gene_protein_reaction_rule_presence(read_only_model)[source]

Expect all non-exchange reactions to have a GPR rule.

Gene-Protein-Reaction rules express which gene has what function. The presence of this annotation is important to justify the existence of reactions in the model, and is required to conduct in silico gene deletion studies. However, reactions without GPR may also be valid: Spontaneous reactions, or known reactions with yet undiscovered genes likely lack GPR.

test_basic.test_genes_presence(read_only_model)[source]

Expect that more than one gene is defined in the model.

A metabolic model can still be a useful tool without any genes, however there are certain methods which rely on the presence of genes and, more importantly, the corresponding gene-protein-reaction rules. This test requires that there is at least one gene defined.

test_basic.test_metabolic_coverage(read_only_model)[source]

Expect a model to have a metabolic coverage >= 1.

The degree of metabolic coverage indicates the modeling detail of a given reconstruction calculated by dividing the total amount of reactions by the amount of genes. Models with a ‘high level of modeling detail have ratios >1, and models with a low level of detail have ratios <1. This difference arises as models with basic or intermediate levels of detail are assumed to include many reactions in which several gene products and their enzymatic transformations are ‘lumped’.

test_basic.test_metabolites_charge_presence(read_only_model)[source]

Expect all metabolites to have charge information.

To be able to ensure that reactions are charge-balanced, all model metabolites ought to be provided with a charge.

test_basic.test_metabolites_formula_presence(read_only_model)[source]

Expect all metabolites to have a formula.

To be able to ensure that reactions are mass-balanced, all model metabolites ought to be provided with a chemical formula.

test_basic.test_metabolites_presence(read_only_model)[source]

Expect that more than one metabolite is defined in the model.

To be useful a metabolic model should consist at least of a few metabolites that are converted by reactions. This test simply checks if there are more than one metabolites defined.

test_basic.test_model_id_presence(read_only_model)[source]

Expect that the model has an identifier.

The MIRIAM guidelines require a model to be named. While it is not required, the ID will be displayed on the memote reports, which helps to distinguish the output clearly.

test_basic.test_ngam_presence(read_only_model)[source]

Expect a single non growth-associated maintenance reaction.

The Non-Growth Associated Maintenance reaction (NGAM) is an ATP-hydrolysis reaction added to metabolic models to represent energy expenses that the cell invests in continuous processes independent of the growth rate.

test_basic.test_protein_complex_presence(read_only_model)[source]

Expect that more than one enzyme complex is present in the model.

Based on the gene-protein-reaction (GPR) rules, it is possible to infer whether a reaction is catalyzed by a single gene product, isozymes or by a heteromeric protein complex. This test checks that at least one such protein complex is defined in the GPR of the model. For S. cerevisiae it could be shown that “essential proteins tend to [cluster] together in essential complexes” (https://doi.org/10.1074%2Fmcp.M800490-MCP200).

This might also be a relevant metric for other organisms.

test_basic.test_reactions_presence(read_only_model)[source]

Expect that more than one reaction is defined in the model.

To be useful a metabolic model should consist at least of a few reactions. This test simply checks if there are more than one.

test_basic.test_transport_reaction_gpr_presence(read_only_model)[source]

Expect a small fraction of transport reactions not to have a GPR rule.

As it is hard to identify the exact transport processes within a cell, transport reactions are often added purely for modeling purposes. Highlighting where assumptions have been made vs where there is proof may help direct the efforts to improve transport and transport energetics of the tested metabolic model. However, transport reactions without GPR may also be valid: Diffusion, or known reactions with yet undiscovered genes likely lack GPR.

test_basic.test_transport_reaction_presence(read_only_model)[source]

Expect more than one transport reaction to be defined in the model.

Cellular metabolism in any organism usually involves the transport of metabolites across a lipid bi-layer. Hence, this test checks that there is at least one reaction, which transports metabolites from one compartment to another.

A transport reaction is defined as follows: 1. It contains metabolites from at least two compartments and 2. at least one metabolite undergoes no chemical conversion, i.e., the formula stays the same on both sides of the equation.

This test will not be able to identify transport via the PTS System.

Consistency

Stoichiometric consistency tests for an instance of cobra.Model.

test_consistency.test_blocked_reactions(read_only_model)[source]

Expect all reactions to be able to carry flux in complete medium.

Universally blocked reactions are reactions that during Flux Variability Analysis cannot carry any flux while all model boundaries are open. Generally blocked reactions are caused by network gaps, which can be attributed to scope or knowledge gaps.

test_consistency.test_detect_energy_generating_cycles(read_only_model, met)[source]

Expect that no energy metabolite can be produced out of nothing.

When a model is not sufficiently constrained to account for the thermodynamics of reactions, flux cycles may form which provide reduced metabolites to the model without requiring nutrient uptake. These cycles are referred to as erroneous energy-generating cycles. Their effect on the predicted growth rate in FBA may account for an increase of up to 25%, which makes studies involving the growth rates predicted from such models unreliable.

This test uses an implementation of the algorithm presented by: Fritzemeier, C. J., Hartleb, D., Szappanos, B., Papp, B., & Lercher, M. J. (2017). Erroneous energy-generating cycles in published genome scale metabolic networks: Identification and removal. PLoS Computational Biology, 13(4), 1–14. http://doi.org/10.1371/journal.pcbi.1005494

test_consistency.test_find_deadends(read_only_model)[source]

Expect no dead-ends to be present.

Dead-ends are metabolites that can only be produced but not consumed by reactions in the model. They may indicate the presence of network gaps.

test_consistency.test_find_disconnected(read_only_model)[source]

Expect no disconnected metabolites to be present.

Disconnected metabolites are not part of any reaction in the model. They are most likely left-over from the reconstruction process, but may also point to network gaps.

test_consistency.test_find_metabolites_consumed_with_closed_bounds(read_only_model)[source]

Expect no metabolites to be consumed without product removal.

Just like metabolites should not be produced from nothing, mass should not simply be removed from the model. This test disables all the boundary reactions and checks if each metabolite can be consumed individually using flux balance analysis. To pass this test no metabolite outside of specific boundary reactions should be consumed without product leaving the system.

test_consistency.test_find_metabolites_produced_with_closed_bounds(read_only_model)[source]

Expect no metabolites to be produced without substrate consumption.

It should not be possible for the model to produce metabolites without consuming substrate from the medium. This test disables all the boundary reactions and checks if each metabolite can be produced individually using flux balance analysis. To pass this test no metabolite outside of specific boundary reactions should be produced without the consumption of substrate.

test_consistency.test_find_orphans(read_only_model)[source]

Expect no orphans to be present.

Orphans are metabolites that are only consumed but not produced by reactions in the model. They may indicate the presence of network gaps.

test_consistency.test_find_reactions_unbounded_flux_default_condition(read_only_model)[source]

Expect the fraction of unbounded reactions to be low.

A large fraction of model reactions able to carry unlimited flux under default conditions indicates problems with reaction directionality, missing cofactors, incorrectly defined transport reactions and more.

test_consistency.test_find_stoichiometrically_balanced_cycles(read_only_model)[source]

Expect no stoichiometrically balanced loops to be present.

Stoichiometrically Balanced Cycles are artifacts of insufficiently constrained networks resulting in reactions that can carry flux when all the boundaries have been closed.

test_consistency.test_reaction_charge_balance(read_only_model)[source]

Expect all reactions to be charge balanced.

In steady state, for each metabolite the sum of influx equals the sum of outflux. Hence the net charges of both sides of any model reaction have to be equal.

test_consistency.test_reaction_mass_balance(read_only_model)[source]

Expect all reactions to be mass balanced.

In steady state, for each metabolite the sum of influx equals the sum of outflux. Hence the net masses of both sides of any model reaction have to be equal.

test_consistency.test_stoichiometric_consistency(read_only_model)[source]

Expect that the stoichiometry is consistent.

Stoichiometric inconsistency violates universal constraints: 1. Molecular masses are always positive, and 2. On each side of a reaction the mass is conserved. A single incorrectly defined reaction can lead to stoichiometric inconsistency in the model, and consequently to unconserved metabolites. Similar to insufficient constraints, this may give rise to cycles which either produce mass from nothing or consume mass from the model.

This test uses an implementation of the algorithm presented by Gevorgyan, A., M. G Poolman, and D. A Fell. “Detection of Stoichiometric Inconsistencies in Biomolecular Models.” Bioinformatics 24, no. 19 (2008): 2245. doi: 10.1093/bioinformatics/btn425

Biomass

Annotation

Annotation tests performed on an instance of cobra.Model.

test_annotation.test_metabolite_annotation_overview(read_only_model, db)[source]

Expect all metabolites to have annotations from common databases.

Specific database cross-references are paramount to mapping information. To provide references to as many databases as possible helps to make the metabolic model more accessible to other researchers. This does not only facilitate the use of a model in a broad array of computational pipelines, it also promotes the metabolic model itself to become an organism-specific knowledge base.

For this test to pass, each metabolite annotation should contain cross-references to a number of databases (listed in annotation.py). For each database this test checks for the presence of its corresponding namespace ID to comply with the MIRIAM guidelines i.e. they have to match those defined on https://identifiers.org/.

Since each database is quite different and some potentially incomplete, it may not be feasible to achieve 100% coverage for each of them. Generally it should be possible, however, to obtain cross-references to at least one of the databases for all metabolites consistently.

test_annotation.test_metabolite_annotation_presence(read_only_model)[source]

Expect all metabolites to have a non-empty annotation attribute.

This test checks if any annotations at all are present in the SBML annotations field for each metabolite, irrespective of the type of annotation i.e. specific database cross-references, ontology terms, additional information. For this test to pass the model is expected to have metabolites and each of them should have some form of annotation.

test_annotation.test_metabolite_annotation_wrong_ids(read_only_model, db)[source]

Expect all annotations of metabolites to be in the correct format.

To identify databases and the identifiers belonging to them, computational tools rely on the presence of specific patterns. Only when these patterns can be identified consistently is an ID truly machine-readable. This test checks if the database cross-references in metabolite annotations conform to patterns defined according to the MIRIAM guidelines, i.e. matching those that are defined at https://identifiers.org/.

The required formats, i.e., regex patterns are further outlined in annotation.py. This test does not carry out a web query for the composed URI, it merely controls that the regex patterns match the identifiers.

test_annotation.test_metabolite_id_namespace_consistency(read_only_model)[source]

Expect metabolite identifiers to be from the same namespace.

In well-annotated models it is no problem if the pool of main identifiers for metabolites consists of identifiers from several databases. However, in models that lack appropriate annotations, it may hamper the ability of other researchers to use it. Running the model through a computational pipeline may be difficult without first consolidating the namespace.

Hence, this test checks if the main metabolite identifiers can be attributed to one single namespace based on the regex patterns defined at https://identifiers.org/

test_annotation.test_reaction_annotation_overview(read_only_model, db)[source]

Expect all reactions to have annotations from common databases.

Specific database cross-references are paramount to mapping information. To provide references to as many databases as possible helps to make the metabolic model more accessible to other researchers. This does not only facilitate the use of a model in a broad array of computational pipelines, it also promotes the metabolic model itself to become an organism-specific knowledge base.

For this test to pass, each reaction annotation should contain cross-references to a number of databases (listed in annotation.py). For each database this test checks for the presence of its corresponding namespace ID to comply with the MIRIAM guidelines i.e. they have to match those defined on https://identifiers.org/.

Since each database is quite different and some potentially incomplete, it may not be feasible to achieve 100% coverage for each of them. Generally it should be possible, however, to obtain cross-references to at least one of the databases for all reactions consistently.

test_annotation.test_reaction_annotation_presence(read_only_model)[source]

Expect all reactions to have a non-empty annotation attribute.

This test checks if any annotations at all are present in the SBML annotations field for each reaction, irrespective of the type of annotation i.e. specific database cross-references, ontology terms, additional information. For this test to pass the model is expected to have reactions and each of them should have some form of annotation.

test_annotation.test_reaction_annotation_wrong_ids(read_only_model, db)[source]

Expect all annotations of reactions to be in the correct format.

To identify databases and the identifiers belonging to them, computational tools rely on the presence of specific patterns. Only when these patterns can be identified consistently is an ID truly machine-readable. This test checks if the database cross-references in reaction annotations conform to patterns defined according to the MIRIAM guidelines, i.e. matching those that are defined at https://identifiers.org/.

The required formats, i.e., regex patterns are further outlined in annotation.py. This test does not carry out a web query for the composed URI, it merely controls that the regex patterns match the identifiers.

test_annotation.test_reaction_id_namespace_consistency(read_only_model)[source]

Expect reaction identifiers to be from the same namespace.

In well-annotated models it is no problem if the pool of main identifiers for reactions consists of identifiers from several databases. However, in models that lack appropriate annotations, it may hamper the ability of other researchers to use it. Running the model through a computational pipeline may be difficult without first consolidating the namespace.

Hence, this test checks if the main reaction identifiers can be attributed to one single namespace based on the regex patterns defined at https://identifiers.org/

Syntax