Reference

Types

AbstractFBCModels.AbstractFBCModelType
abstract type AbstractFBCModel

A supertype of all Flux-balance-Based Constrained metabolic models that share the common interface defined by AbstractFBCModels.jl.

To use the interface for your type, make it a subtype of AbstractFBCModel and provide methods for various functions used with the model. Use accessors to find the current list of methods, and utilize run_fbcmodel_type_tests and run_fbcmodel_file_tests to test the completeness and compatibility of your implementation with the assumptions of the interface.

source
AbstractFBCModels.AnnotationsType
Annotations = Dict{String,Vector{String}}

Dictionary used to store (possible multiple) standardized annotations of something, such as a metabolite or a reaction (as listed by metabolites and reactions).

Example

Annotations("PubChem" => ["CID12345", "CID54321"])
source
AbstractFBCModels.GeneAssociationDNFType
GeneAssociationDNF = Vector{Vector{String}}

Disjunctive normal form of simple gene associations. For example, [[A, B], [B]] represents two possibilities to run a given reaction, where the first requires both gene products A and B, while the second possibility only requires gene product C.

source

Model content accessors

AbstractFBCModels.balanceMethod
balance(
    a::AbstractFBCModels.AbstractFBCModel
) -> SparseArrays.SparseVector{Float64, Int64}

Get the sparse balance vector of a model, which usually corresponds to the accumulation term associated with stoichiometric matrix.

By default, the balance is assumed to be exactly zero.

source
AbstractFBCModels.couplingMethod
coupling(
    a::AbstractFBCModels.AbstractFBCModel
) -> SparseArrays.SparseMatrixCSC{Float64, Int64}

Sparse matrix that describes the coupling of a given model.

This usually corresponds to all additional constraints in the model, such as the ones used for split-direction reactions and community modeling. The matrix must be of size n_couplings by n_reactions.

source
AbstractFBCModels.coupling_annotationsMethod
coupling_annotations(
    _::AbstractFBCModels.AbstractFBCModel,
    coupling_id::String
) -> Dict{String, Vector{String}}

A dictionary of standardized names that may help to identify the corresponding coupling.

source
AbstractFBCModels.coupling_boundsMethod
coupling_bounds(
    a::AbstractFBCModels.AbstractFBCModel
) -> Tuple{Vector{Float64}, Vector{Float64}}

Lower and upper bounds of all couplings in the model.

source
AbstractFBCModels.coupling_nameMethod
coupling_name(
    _::AbstractFBCModels.AbstractFBCModel,
    coupling_id::String
) -> Union{Nothing, String}

The name of the given coupling in the model, if recorded.

source
AbstractFBCModels.coupling_notesMethod
coupling_notes(
    _::AbstractFBCModels.AbstractFBCModel,
    coupling_id::String
) -> Dict{String, Vector{String}}

Free-text notes organized in a dictionary by topics about the given coupling in the model.

source
AbstractFBCModels.coupling_weightsMethod
coupling_weights(
    a::AbstractFBCModels.AbstractFBCModel,
    coupling_id::String
) -> Dict{String, Float64}

The weights of reactions in the given coupling bound. Returns a dictionary that maps the reaction IDs to their weights.

Using this function may be more efficient in cases than loading the whole coupling.

source
AbstractFBCModels.couplingsMethod
couplings(
    a::AbstractFBCModels.AbstractFBCModel
) -> Vector{String}

Return identifiers of all coupling bounds contained in the model. Empty if none.

Coupling bounds are typically not named in models, but should be.

COMPATIBILITY NOTE: Couplings currently default to empty to prevent breakage. This behavior will change with next major version.

source
AbstractFBCModels.gene_annotationsMethod
gene_annotations(
    _::AbstractFBCModels.AbstractFBCModel,
    gene_id::String
) -> Dict{String, Vector{String}}

A dictionary of standardized names that identify the corresponding gene or product. The dictionary assigns vectors of possible identifiers to identifier system names, such as "PDB" => ["PROT01"].

source
AbstractFBCModels.gene_nameMethod
gene_name(
    _::AbstractFBCModels.AbstractFBCModel,
    gene_id::String
) -> Union{Nothing, String}

The name of the given gene in the model, if recorded.

source
AbstractFBCModels.gene_notesMethod
gene_notes(
    _::AbstractFBCModels.AbstractFBCModel,
    gene_id::String
) -> Dict{String, Vector{String}}

Free-text notes organized in a dictionary by topics about the given gene in the model.

source
AbstractFBCModels.genesFunction

Return identifiers of all genes contained in the model. Empty if none.

Genes are also sometimes called "gene products" but we write genes for simplicity.

source
AbstractFBCModels.metabolite_annotationsMethod
metabolite_annotations(
    _::AbstractFBCModels.AbstractFBCModel,
    metabolite_id::String
) -> Dict{String, Vector{String}}

A dictionary of standardized names that may help to identify the metabolite. The dictionary should assigns vectors of possible identifiers to identifier system names, such as "ChEMBL" => ["123"] or "PubChem" => ["CID123", "CID654645645"].

source
AbstractFBCModels.metabolite_chargeMethod
metabolite_charge(
    _::AbstractFBCModels.AbstractFBCModel,
    metabolite_id::String
) -> Union{Nothing, Int64}

The charge of the given metabolite in the model, or nothing in case the charge is not recorded.

source
AbstractFBCModels.metabolite_compartmentMethod
metabolite_compartment(
    _::AbstractFBCModels.AbstractFBCModel,
    metabolite_id::String
) -> Union{Nothing, String}

The compartment of the given metabolite in the model. nothing if no compartment is assigned.

source
AbstractFBCModels.metabolite_formulaMethod
metabolite_formula(
    _::AbstractFBCModels.AbstractFBCModel,
    metabolite_id::String
) -> Union{Nothing, Dict{String, Int64}}

The formula of the given metabolite in the model, or nothing in case the formula is not recorded.

source
AbstractFBCModels.metabolite_nameMethod
metabolite_name(
    _::AbstractFBCModels.AbstractFBCModel,
    metabolite_id::String
) -> Union{Nothing, String}

The name of the given metabolite, if assigned.

source
AbstractFBCModels.metabolite_notesMethod
metabolite_notes(
    _::AbstractFBCModels.AbstractFBCModel,
    metabolite_id::String
) -> Dict{String, Vector{String}}

Free-text notes organized in a dictionary by topics about the given metabolite in the model.

source
AbstractFBCModels.n_couplingsMethod
n_couplings(a::AbstractFBCModels.AbstractFBCModel) -> Int64

The number of coupling bounds in the model (must be equal to the length of vector given by couplings).

This may be more efficient than calling couplings and measuring the array.

source
AbstractFBCModels.reaction_annotationsMethod
reaction_annotations(
    _::AbstractFBCModels.AbstractFBCModel,
    reaction_id::String
) -> Dict{String, Vector{String}}

A dictionary of standardized names that may help identifying the reaction. The dictionary assigns vectors of possible identifiers to identifier system names, e.g. "Reactome" => ["reactomeID123"].

source
AbstractFBCModels.reaction_gene_association_dnfMethod
reaction_gene_association_dnf(
    _::AbstractFBCModels.AbstractFBCModel,
    reaction_id::String
) -> Union{Nothing, Vector{Vector{String}}}

Returns the sets of genes that need to be present for the reaction to work in a DNF formula. This helps for constructively using the reaction-gene-association information.

If a model overloads this function, it must also properly overload reaction_gene_products_available. You can use reaction_gene_products_available_from_dnf as a helper for computing the availability from an existing overload of reaction_gene_association_dnf.

source
AbstractFBCModels.reaction_gene_products_availableMethod
reaction_gene_products_available(
    _::AbstractFBCModels.AbstractFBCModel,
    reaction_id::String,
    gene_product_available::Function
) -> Union{Nothing, Bool}

Evaluate whether the reaction can work given in a conditions given by the current availability of gene products, or nothing if the information is not recorded. The availability us queried via gene_products_available, which must be a function of a single String argument that returns Bool.

Generally it may be simpler to use reaction_gene_association_dnf, but in many models the complexity of the conversion to DNF is prohibitive.

For generality reasons, this must be properly overloaded for all models that overload reaction_gene_association_dnf. Implementations may define reaction_gene_products_available_from_dnf to derive a valid implementation from an existing overload of reaction_gene_association_dnf.

source
AbstractFBCModels.reaction_notesMethod
reaction_notes(
    _::AbstractFBCModels.AbstractFBCModel,
    reaction_id::String
) -> Dict{String, Vector{String}}

Free-text notes organized in a dictionary by topics about the given reaction in the model.

source
AbstractFBCModels.reaction_subsystemMethod
reaction_subsystem(
    _::AbstractFBCModels.AbstractFBCModel,
    reaction_id::String
) -> Vector{String}

Optional string labels that may be used to categorize the reaction.

source
AbstractFBCModels.reactionsFunction

Return a vector of reaction identifiers in a model.

For technical reasons, the "reactions" may sometimes not be true reactions but various virtual and helper pseudo-reactions that are used in the metabolic modeling, such as metabolite exchanges, separated forward and reverse reaction directions, supplies of enzymatic and genetic material and virtual cell volume, etc.

source

IO functions

AbstractFBCModels.filename_extensionsMethod
filename_extensions(
    _::Type{A<:AbstractFBCModels.AbstractFBCModel}
) -> Vector{String}

A vector of filename extensions that are common for files that contain the given metabolic model type. This is used by load to guess the type of the model that should be loaded.

source
AbstractFBCModels.loadMethod
load(path::String) -> Any

Load a model from path. The type of the model is automatically guessed based on the filename extension. The guessing inspects all subtypes of AbstractFBCModel, thus always requires compilation – if possible, specify the proper type using the 2-parameter version of load to save time.

source

Testing of model implementations

AbstractFBCModels.run_fbcmodel_file_testsMethod
run_fbcmodel_file_tests(
    ::Type{X<:AbstractFBCModels.AbstractFBCModel},
    path::String;
    name,
    test_save
) -> Union{Test.FallbackTestSet, Test.DefaultTestSet}

Test if the given model type loads properly from a file.

The function uses the testing infrastructure from Test to report problems – it is supposed to be a part of larger test-sets, preferably in all model implementation packages.

source
AbstractFBCModels.run_fbcmodel_type_testsMethod
run_fbcmodel_type_tests(
    _::Type{X<:AbstractFBCModels.AbstractFBCModel}
) -> Union{Test.FallbackTestSet, Test.DefaultTestSet}

Test if the given model type works right.

The function uses the testing infrastructure from Test to report problems – it is supposed to be a part of larger test-sets, preferably in all model implementation packages.

source

Miscellaneous utilities

AbstractFBCModels.accessorsMethod
accessors() -> Vector{Method}

Provide a methodswith-style listing of accessors that the model implementors may implement.

source
AbstractFBCModels.required_accessorsMethod
required_accessors() -> Vector{Method}

Provide a methodswith-style listing of functions that the model implementors must implement to have a functional AbstractFBCModel.

The output listing is a subset of the longer list returned by accessors. Some of the accessors may have sensible defaults – e.g., it is safe to assume an empty default coupling if the functions are not defined. The accessors which do not possess a natural default and thus must be defined (and trying to use a model without them will almost certainly cause runtime errors) are exactly the ones listed by this function.

source

Canonical model implementation

AbstractFBCModels.CanonicalModel.CouplingType
mutable struct Coupling

A canonical Julia representation of a row in a coupling matrix of the AbstractFBCModels interface.

Fields

  • name::Union{Nothing, String}

  • reaction_weights::Dict{String, Float64}

  • lower_bound::Float64

  • upper_bound::Float64

  • annotations::Dict{String, Vector{String}}

  • notes::Dict{String, Vector{String}}

source
AbstractFBCModels.CanonicalModel.GeneType
mutable struct Gene

A canonical Julia representation of a gene in the AbstractFBCModels interface.

Fields

  • name::Union{Nothing, String}

  • annotations::Dict{String, Vector{String}}

  • notes::Dict{String, Vector{String}}

source
AbstractFBCModels.CanonicalModel.MetaboliteType
mutable struct Metabolite

A canonical Julia representation of a metabolite in the AbstractFBCModels interface.

Fields

  • name::Union{Nothing, String}

  • compartment::Union{Nothing, String}

  • formula::Union{Nothing, Dict{String, Int64}}

  • charge::Union{Nothing, Int64}

  • balance::Float64

  • annotations::Dict{String, Vector{String}}

  • notes::Dict{String, Vector{String}}

source
AbstractFBCModels.CanonicalModel.ModelType
mutable struct Model <: AbstractFBCModels.AbstractFBCModel

A canonical Julia representation of a metabolic model that sotres exactly the data represented by AbstractFBCModels accessors.

The implementation is useful for manipulating model data manually without writing new model types, or even for constructing models from base data in many simple cases.

Additionally, you can use the implementation of accessors for this model type in the source code of AbstractFBCModels as a starting point for creating an AbstractFBCModel interface for your own models.

Fields

  • reactions::Dict{String, AbstractFBCModels.CanonicalModel.Reaction}

  • metabolites::Dict{String, AbstractFBCModels.CanonicalModel.Metabolite}

  • genes::Dict{String, AbstractFBCModels.CanonicalModel.Gene}

  • couplings::Dict{String, AbstractFBCModels.CanonicalModel.Coupling}

source
AbstractFBCModels.CanonicalModel.ReactionType
mutable struct Reaction

A canonical Julia representation of a reaction in the AbstractFBCModels interface.

Fields

  • name::Union{Nothing, String}

  • lower_bound::Float64

  • upper_bound::Float64

  • stoichiometry::Dict{String, Float64}

  • objective_coefficient::Float64

  • gene_association_dnf::Union{Nothing, Vector{Vector{String}}}

  • annotations::Dict{String, Vector{String}}

  • notes::Dict{String, Vector{String}}

source