FBCModelTests.jl functions

FROG

FBCModelTests.FROGModule
module FROG

A collection of reproducibility checks for constraint-based metabolic models together with a report generator and tester.

See https://www.ebi.ac.uk/biomodels/curation/fbc for details.

source
FBCModelTests.FROG.FROGObjectiveReportType
struct FROGObjectiveReport

Fields

  • optimum::Union{Nothing, Float64}

  • reactions::Dict{String, FBCModelTests.FROG.FROGReactionReport}

  • gene_deletions::Dict{String, Union{Nothing, Float64}}

source
FBCModelTests.FROG.FROGReactionReportType
struct FROGReactionReport

Fields

  • objective_flux::Union{Nothing, Float64}

  • fraction_optimum::Float64

  • variability_min::Union{Nothing, Float64}

  • variability_max::Union{Nothing, Float64}

  • deletion::Union{Nothing, Float64}

source

Reading and writing reports

FBCModelTests.FROG.ReportIO.save_reportMethod
save_report(
    r::Dict{String, FBCModelTests.FROG.FROGObjectiveReport},
    metadata::Dict{String, Any};
    report_dir,
    basefilename
)

Write the contents of FROGReportData to the 4 TSV files as specified by FROG standard, and additionally write the metadata into the JSON file.

source

Generating and testing the reports

MEMOTE

FBCModelTests.MemoteModule
module Memote

This package contains a collection of tests based on Memote. See Lieven, C., Beber, M.E., Olivier, B.G. et al. MEMOTE for standardized genome-scale metabolic model testing. Nat Biotechnol 38, 272–276 (2020). https://doi.org/10.1038/s41587-020-0446-y for details.

source
FBCModelTests.Memote.run_testsMethod
run_tests(
    model::COBREXA.MetabolicModel,
    optimizer;
    config,
    filename,
    workers
) -> Any

Run a MEMOTE-like test suite on model using optimizer to solve optimization problems; some basic parameters and thresholds are taken from config.

Some of the tests internally convert the input model to StandardModel of COBREXA; supplying a StandardModel may thus increase efficiency of the whole process.

source
FBCModelTests.Memote.run_tests_toplevelMethod
run_tests_toplevel(
    model::COBREXA.MetabolicModel,
    optimizer;
    config,
    filename,
    workers
) -> Test.DefaultTestSet

Run a MEMOTE-like test suite on model using optimizer to solve optimization problems. Forwards arguments to run_tests, but wraps all of the test sets in a FBCModelTests.QuietTestSet to generate more concise user facing results.

source

MEMOTE utilities

FBCModelTests.Memote.Utils.median_boundsMethod
median_bounds(
    model::COBREXA.MetabolicModel
) -> Tuple{Any, Any}

A helper function that returns the median upper and lower bounds in a tuple. If none can be calculated, constants from COBREXA are used as the default values.

source
FBCModelTests.Memote.Utils.parse_annotationsMethod
parse_annotations(annos) -> Dict{String, Vector{String}}

Ensure annotations are in a standardized format. Some models represent annotations like:

Dict{String, Vector{String}} with 2 entries:
  "sbo"          => ["SBO:0000176"]
  "RESOURCE_URI" => ["https://identifiers.org/ec-code/4.1.99.12", "https://identifiers.org/bigg.reaction/DB4PS", ...]

but the key used to map to URI annotations is not standarized. This helper function constructs a new annotation dictionary to ensure that all annotations looks like:

Dict{String, Vector{String}} with 7 entries:
  "bigg.reaction"     => ["DB4PS"]
  "pubmed"            => ["12595523"]
  "sbo"               => ["SBO:0000176"]
  "kegg.pathway"      => ["sce00740", "sce01110"]
  "metanetx.reaction" => ["MNXR97178"]
  "kegg.reaction"     => ["R07281"]
  "ec-code"           => ["4.1.99.12"]
source
FBCModelTests.Memote.Config.AnnotationConfigType
mutable struct AnnotationConfig

Fields

  • gene_annotation_keywords::Vector{String}

  • gene_annotation_regexes::Dict{String, Regex}

  • metabolite_annotation_keywords::Vector{String}

  • metabolite_annotation_regexes::Dict{String, Regex}

  • reaction_annotation_keywords::Vector{String}

  • reaction_annotation_regexes::Dict{String, Regex}

  • minimum_conformal_crossreferences::Int64

  • minimum_crossreferences::Int64

source
FBCModelTests.Memote.Config.EnergyConfigType
mutable struct EnergyConfig

Fields

  • energy_dissipating_metabolites::Vector{String}

  • additional_energy_generating_reactions::Vector{COBREXA.Reaction}

  • ignored_energy_reactions::Vector{String}

  • optimizer_modifications::Vector{Function}

source
FBCModelTests.Memote.Config.MemoteConfigType
mutable struct MemoteConfig

A grouping of parameters used by the metabolic testing infrastructure.

Fields

  • annotation::FBCModelTests.Memote.Config.AnnotationConfig

  • basic::FBCModelTests.Memote.Config.BasicConfig

  • biomass::FBCModelTests.Memote.Config.BiomassConfig

  • consistency::FBCModelTests.Memote.Config.ConsistencyConfig

  • energy::FBCModelTests.Memote.Config.EnergyConfig

  • metabolite::FBCModelTests.Memote.Config.MetaboliteConfig

  • network::FBCModelTests.Memote.Config.NetworkConfig

  • reaction::FBCModelTests.Memote.Config.ReactionConfig

source

MEMOTE checks

Basic checks

FBCModelTests.Memote.Basic.model_solves_in_default_mediumMethod
model_solves_in_default_medium(
    model::COBREXA.MetabolicModel,
    optimizer;
    config
) -> Any

Check if the model can be solved under default conditions and yield a reasonable growth rate. Here reasonable is set via config.basic.minimum_growth_rate and config.basic.maximum_growth_rate. Optionally, pass optimization modifications to the solver through config.basic.optimizer_modifications.

source

Consistency checks

FBCModelTests.Memote.Consistency.model_is_consistentMethod
model_is_consistent(
    model::COBREXA.MetabolicModel,
    optimizer;
    config
) -> Bool

Determines if the model is stoichiometrically consistent. Note, stoichiometric consistency does not guarantee that mass balances must hold in the model. A more robust check is to ensure that each reaction is mass balanced, but this only works if all metabolites have masses assigned to them. Test based on Gevorgyan, Albert, Mark G. Poolman, and David A. Fell. "Detection of stoichiometric inconsistencies in biomolecular models." Bioinformatics (2008). Optionally ignore some reactions in this analysis by adding reaction IDs to config.consistency.consistency_ignored_reactions.

source

Metabolite checks

FBCModelTests.Memote.Metabolites.metabolites_are_duplicatedMethod
metabolites_are_duplicated(
    model::COBREXA.MetabolicModel,
    m1,
    m2,
    test_annotation
) -> Bool

Test if metabolites m1 and m2 are different by comparing their config.metabolite.test_annotation field in the annotations of each metabolite. Note, if no annotations are present for one or both of the metabolites, then return false.

source
FBCModelTests.Memote.Metabolites.metabolites_duplicated_in_compartmentMethod
metabolites_duplicated_in_compartment(
    model::COBREXA.MetabolicModel;
    config
) -> Set{String}

Return a dictionary of metabolites that are duplicated in their compartment. If any of the test annotations, stored in config.metabolite.test_annotations, are repeated, then the metabolite is counted as duplicated. Missing annotations are ignored.

source

Reaction checks

FBCModelTests.Memote.Reactions.model_has_atpm_reactionMethod
model_has_atpm_reaction(
    model::COBREXA.MetabolicModel
) -> Union{Missing, Bool}

Check if model has an ATP maintenance reaction built in (also called a non-growth associated maintenance cost). Looks for reaction annotations corresponding to the sbo maintenance term.

source

GPRAssociation checks

Biomass checks

FBCModelTests.Memote.Biomass.atp_present_in_biomass_reactionMethod
atp_present_in_biomass_reaction(
    model::COBREXA.MetabolicModel,
    rid::String
) -> Bool

Check if the biomass reaction consumes ATP and H₂O, and produces ADP, HO₄P, and H⁺. Annotations are parsed, and the BiGG namespace is used to identify these metabolites in the underlying model.

source
FBCModelTests.Memote.Biomass.biomass_missing_essential_precursorsMethod
biomass_missing_essential_precursors(
    model::COBREXA.MetabolicModel,
    rid::String;
    config
) -> Bool

Tests if the biomass reaction contains a set of essential precursors, listed in config.biomass.essential_precursors. Uses the BiGG namespace as a reference and the metabolite annotations.

source
FBCModelTests.Memote.Biomass.biomass_reaction_molar_massMethod
biomass_reaction_molar_mass(
    model::COBREXA.MetabolicModel,
    rid::String
) -> Any

For a biomass reaction rid, calculate the molar weight of the reaction by summing the products of the associated metabolite coefficients with their molar masses (g/mol).

source

Network checks

FBCModelTests.Memote.Network.find_all_universally_blocked_reactionsMethod
find_all_universally_blocked_reactions(
    model::COBREXA.MetabolicModel,
    optimizer;
    config,
    workers
) -> Vector{String}

Make all boundary reactions reversible and run FVA on the model to find all reactions that are universally blocked. Optimizer modifications can be passed through config.network.optimizer_modifications

source
FBCModelTests.Memote.Network.find_cycle_reactionsMethod
find_cycle_reactions(
    model::COBREXA.MetabolicModel,
    optimizer;
    config,
    workers
) -> Vector

Find all reactions that participate in stoichiometrically balanced cycles by closing all boundary reactions and running fva on the resultant model.

source

Annotation checks

FBCModelTests.Memote.Annotation.findall_conformal_gene_annotationsMethod
findall_conformal_gene_annotations(
    model,
    gid::String;
    config
) -> Vector{String}

Check if the gene annotation entry conforms to commonly recognized formats of annotation database using regex patterns. Uses the database formats listed in config.annotation.gene_annotation_regexes to test the conformity. Returns a string vector of database ids that do conform.

source
FBCModelTests.Memote.Annotation.findall_conformal_metabolite_annotationsMethod
findall_conformal_metabolite_annotations(
    model,
    mid::String;
    config
) -> Vector{String}

Check if the metabolite annotation entry conforms to commonly recognized formats of annotation database using regex patterns. Uses the database formats listed in config.annotation.metabolite_annotation_regexes to test the conformity. Returns a string vector of database ids that do conform.

source
FBCModelTests.Memote.Annotation.findall_conformal_reaction_annotationsMethod
findall_conformal_reaction_annotations(
    model,
    rid::String;
    config
) -> Vector{String}

Check if the reaction annotation entry conforms to commonly recognized formats of annotation database using regex patterns. Uses the database formats listed in config.annotation.reaction_annotation_regexes to test the conformity. Returns a string vector of database ids that do conform.

source

Energy checks

FBCModelTests.Memote.Energy.model_has_no_erroneous_energy_generating_cyclesMethod
model_has_no_erroneous_energy_generating_cycles(
    model::COBREXA.MetabolicModel,
    optimizer;
    config
) -> Bool

NOTE: this test is currently skipped and will appear as broken in the output.

Attempts to detect if the model contains any erroneous energy generating cycles by closing all exchange reactions and using flux balance analysis to maximize the sum of fluxes through a set of energy dissipating reactions. The flux sum should be zero if the model is free of energy generating reactions. This function is based on Fritzemeier, Claus Jonathan, et al. "Erroneous energy-generating cycles in published genome scale metabolic networks: Identification and removal." PLoS computational biology (2017). The energy dissipating reactions are based on the source paper, and include:

ATP + H2O --> ADP + H + Phosphate
CTP + H2O --> CDP + H + Phosphate
GTP + H2O --> GDP + H + Phosphate
UTP + H2O --> UDP + H + Phosphate
ITP + H2O --> IDP + H + Phosphate
NADH --> H + NAD
NADPH --> H + NADP
FADH2 --> 2 H + FAD
FMNH2 --> 2 H + FMN
Ubiquinol-8 --> 2 H + Ubiquinone-8
Menaquinol-8 --> 2 H + Menaquinone-8
2-Demethylmenaquinol-8 --> 2 H + 2-Demethylmenaquinone-8
H2O + ACCOA --> H + Acetate + COA
L-Glutamate + H2O --> 2-Oxoglutarate + Ammonium + 2 H
H[external] --> H

Additional energy dissipating reactions can be directly specified through config.energy.additional_energy_generating_reactions, which should be vector of COBREXA Reactions using the same metabolite name space as the model.If your model uses a different name space, then you have to change the values (NOT the keys) of config.energy.energy_dissipating_metabolites. Each energy dissipating reaction is added to the test only if all its associated metabolites are present. Any config.energy.optimizer_modifications to the solver are passed directly through to COBREXA's flux_balance_analysis function. All config.energy.boundary_reactions and config.energy.ignored_energy_reactions are deleted from an internal copy of model; this internal copy is used for analysis. Returns true if the model has no energy generating cycles.

source

Types and utilities