Model construction functions
Functions for changing the models
COBREXA.add_reaction!
— Methodadd_reaction!(model::CoreModel, rxn::Reaction)
Add rxn
to model
. The model must already contain the metabolites used by rxn
in the model.
COBREXA.add_reactions!
— Methodadd_reactions!(model::CoreModel, rxns::Vector{Reaction})
Add rxns
to model
efficiently. The model must already contain the metabolites used by rxns
in the model.
COBREXA.add_reactions
— Methodadd_reactions(
m::CoreModel,
Sp::MatType,
b::VecType,
c::VecType,
xl::VecType,
xu::VecType,
rxns::StringVecType,
mets::StringVecType;
check_consistency = false,
)
COBREXA.add_reactions
— Methodadd_reactions(
m::CoreModel,
Sp::MatType,
b::VecType,
c::VecType,
xl::VecType,
xu::VecType;
check_consistency = false,
)
COBREXA.add_reactions
— Methodadd_reactions(
m::CoreModel,
s::VecType,
b::VecType,
c::AbstractFloat,
xl::AbstractFloat,
xu::AbstractFloat,
rxn::String,
mets::K;
check_consistency = false,
)
COBREXA.add_reactions
— Methodadd_reactions(
m::CoreModel,
s::VecType,
b::VecType,
c::AbstractFloat,
xl::AbstractFloat,
xu::AbstractFloat;
check_consistency = false,
)
Add reaction(s) to a CoreModel
model m
.
COBREXA.add_reactions
— Methodadd_reactions(m1::CoreModel, m2::CoreModel; check_consistency = false)
Add all reactions from m2
to m1
.
COBREXA.change_bound!
— Methodchange_bound!(
model::CoreModel,
rxn_idx::Int;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model in-place.
Example
new_model = change_bound!(model, 123, lower=-21.15, upper=42.3)
COBREXA.change_bound!
— Methodchange_bound!(
model::CoreModel,
rxn_id::String;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model in-place.
Example
new_model = change_bound!(model, "ReactionB", lower=-21.15, upper=42.3)
COBREXA.change_bound
— Methodchange_bound(
model::CoreModel,
rxn_idx::Int;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model and return the modified model.
Example
change_bound(model, 123, lower=-21.15, upper=42.3)
COBREXA.change_bound
— Methodchange_bound(
model::CoreModel,
rxn_id::String;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model and return the modified model.
Example
change_bound(model, "ReactionB", lower=-21.15, upper=42.3)
COBREXA.change_bounds!
— Methodchange_bounds!(
model::CoreModel,
rxn_idxs::AbstractVector{Int64};
lower = (nothing for _ = rxn_idxs),
upper = (nothing for _ = rxn_idxs),
)
Change the specified reaction flux bounds in the model in-place.
Example
new_model = change_bounds!(model, [123, 234], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_bounds!
— Methodchange_bounds!(
model::CoreModel,
rxn_ids::AbstractVector{String};
lower = (nothing for _ = rxn_ids),
upper = (nothing for _ = rxn_ids),
)
Change the specified reaction flux bounds in the model in-place.
Example
new_model = change_bounds!(model, ["ReactionA", "ReactionC"], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_bounds
— Methodchange_bounds(
model::CoreModel,
rxn_idxs::AbstractVector{Int64};
lower = (nothing for _ = rxn_idxs),
upper = (nothing for _ = rxn_idxs),
)
Change the specified reaction flux bounds in the model and return the modified model.
Example
change_bounds(model, [123, 234], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_bounds
— Methodchange_bounds(
model::CoreModel,
rxn_ids::AbstractVector{String};
lower = (nothing for _ = rxn_ids),
upper = (nothing for _ = rxn_ids),
)
Change the specified reaction flux bounds in the model and return the modified model.
Example
change_bounds(model, ["ReactionA", "ReactionC"], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_objective!
— Methodchange_objective!(model::CoreModel, rxn_idx::Int)
Change objective function of a CoreModel to a single 1
at reaction index rxn_idx
.
COBREXA.change_objective!
— Methodchange_objective!(model::CoreModel, rxn_id::String)
Change objective function of a CoreModel to a single 1
at the given reaction ID.
COBREXA.change_objective!
— Methodchange_objective!(
model::CoreModel,
rxn_idxs::Vector{Int};
weights = ones(length(rxn_idxs)),
)
Change the objective to reactions at given indexes, optionally specifying their weights
in the same order. By default, all set weights are 1.
COBREXA.change_objective!
— Methodchange_objective!(
model::CoreModel,
rxn_ids::Vector{String};
weights = ones(length(rxn_ids)),
)
Change objective of given reaction IDs, optionally specifying objective weights
in the same order as rxn_ids
. By default, all set weights are 1.
COBREXA.remove_metabolite!
— Methodremove_metabolite!(model::CoreModel, metabolite_idx::Int)
Remove metabolite from the model of type CoreModel
in-place.
COBREXA.remove_metabolite!
— Methodremove_metabolite!(model::CoreModel, metabolite_id::String)
Remove metabolite from the model of type CoreModel
in-place.
COBREXA.remove_metabolite
— Methodremove_metabolite(model::CoreModel, metabolite_idx::Int)
Remove metabolite from the model of type CoreModel
and return the modified model.
COBREXA.remove_metabolite
— Methodremove_metabolite(model::CoreModel, metabolite_id::String)
Remove metabolite from the model of type CoreModel
and return the modified model.
COBREXA.remove_metabolites!
— Methodremove_metabolites!(model::CoreModel, metabolite_idxs::AbstractVector{Int64})
Remove metabolites from the model of type CoreModel
in-place.
COBREXA.remove_metabolites!
— Methodremove_metabolites!(model::CoreModel, metabolite_ids::AbstractVector{String})
Remove metabolites from the model of type CoreModel
in-place.
COBREXA.remove_metabolites
— Methodremove_metabolites(model::CoreModel, metabolite_idxs::AbstractVector{Int64})
Remove metabolites from the model of type CoreModel
and return the modified model.
COBREXA.remove_metabolites
— Methodremove_metabolites(model::CoreModel, metabolite_ids::AbstractVector{String})
Remove metabolites from the model of type CoreModel
and return the modified model.
COBREXA.remove_reaction!
— Methodremove_reaction!(model::CoreModel, reaction_idx::Int)
Remove reaction from the model of type CoreModel
in-place.
COBREXA.remove_reaction!
— Methodremove_reaction!(model::CoreModel, reaction_id::String)
Remove reaction from the model of type CoreModel
in-place.
COBREXA.remove_reaction
— Methodremove_reaction(model::CoreModel, reaction_idx::Int)
Remove reaction from the model of type CoreModel
and return the modified model.
COBREXA.remove_reaction
— Methodremove_reaction(model::CoreModel, reaction_id::String)
Remove reaction from the model of type CoreModel
and return the modified model.
COBREXA.remove_reactions!
— Methodremove_reactions!(model::CoreModel, reaction_idxs::AbstractVector{Int64})
Remove reactions from the model of type CoreModel
in-place.
COBREXA.remove_reactions!
— Methodremove_reactions!(model::CoreModel, reaction_ids::AbstractVector{String})
Remove reactions from the model of type CoreModel
in-place.
COBREXA.remove_reactions
— Methodremove_reactions(model::CoreModel, reaction_idxs::AbstractVector{Int64})
Remove reactions from the model of type CoreModel
and return the modified model.
COBREXA.remove_reactions
— Methodremove_reactions(model::CoreModel, reaction_ids::AbstractVector{String})
Remove reactions from the model of type CoreModel
and return the modified model.
COBREXA.verify_consistency
— Methodverify_consistency(
m::CoreModel,
Sp::M,
b::V,
c::V,
xl::B,
xu::B,
names::K,
mets::K,
new_reactions,
new_metabolites,
) where {M<:MatType,V<:VecType,B<:VecTypeK<:StringVecType}
Check the consistency of given reactions with existing reactions in m
.
TODO: work in progress, doesn't return consistency status.
COBREXA.add_coupling_constraints!
— Methodadd_coupling_constraints!(
m::CoreModelCoupled,
c::VecType,
cl::AbstractFloat,
cu::AbstractFloat,
)
Overload for adding a single coupling constraint.
COBREXA.add_coupling_constraints!
— Methodadd_coupling_constraints!(
m::CoreModelCoupled,
C::MatType,
cl::V,
cu::V,
) where {V<:VecType}
In-place add a single coupling constraint in form
cₗ ≤ C x ≤ cᵤ
COBREXA.add_coupling_constraints
— Methodadd_coupling_constraints(m::CoreModel, args...)
Add coupling constraints to a plain CoreModel
(returns a CoreModelCoupled
).
COBREXA.add_coupling_constraints
— MethodAdd constraints of the following form to a CoreModelCoupled and return a modified one.
Add constraints to a CoreModelCoupled
and return a modified one.
The arguments are same as for in-place add_coupling_constraints!
.
COBREXA.add_reactions
— Methodadd_reactions(m1::CoreModelCoupled, m2::CoreModel; check_consistency = false)
Add all reactions from m2
to m1
.
COBREXA.add_reactions
— Methodadd_reactions(
m::CoreModelCoupled,
s::V1,
b::V2,
c::AbstractFloat,
xl::AbstractFloat,
xu::AbstractFloat,
rxn::String,
mets::K;
check_consistency = false,
) where {V1<:VecType,V2<:VecType,K<:StringVecType}
COBREXA.add_reactions
— Methodadd_reactions(
m::CoreModelCoupled,
Sp::M,
b::V,
c::V,
xl::V,
xu::V,
rxns::K,
mets::K;
check_consistency = false,
) where {M<:MatType,V<:VecType,K<:StringVecType}
COBREXA.add_reactions
— Methodadd_reactions(
m::CoreModelCoupled,
s::V1,
b::V2,
c::AbstractFloat,
xl::AbstractFloat,
xu::AbstractFloat;
check_consistency = false,
) where {V1<:VecType,V2<:VecType}
Add reaction(s) to a CoreModelCoupled
model m
.
COBREXA.add_reactions
— Methodadd_reactions(
m::CoreModelCoupled,
Sp::M,
b::V,
c::V,
xl::V,
xu::V;
check_consistency = false,
) where {M<:MatType,V<:VecType}
COBREXA.change_bound!
— Methodchange_bound!(
model::CoreModelCoupled,
rxn_idx::Int;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model in-place.
Example
new_model = change_bound!(model, 123, lower=-21.15, upper=42.3)
COBREXA.change_bound!
— Methodchange_bound!(
model::CoreModelCoupled,
rxn_id::String;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model in-place.
Example
new_model = change_bound!(model, "ReactionB", lower=-21.15, upper=42.3)
COBREXA.change_bound
— Methodchange_bound(
model::CoreModelCoupled,
rxn_idx::Int;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model and return the modified model.
Example
change_bound(model, 123, lower=-21.15, upper=42.3)
COBREXA.change_bound
— Methodchange_bound(
model::CoreModelCoupled,
rxn_id::String;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model and return the modified model.
Example
change_bound(model, "ReactionB", lower=-21.15, upper=42.3)
COBREXA.change_bounds!
— Methodchange_bounds!(
model::CoreModelCoupled,
rxn_idxs::AbstractVector{Int64};
lower = (nothing for _ = rxn_idxs),
upper = (nothing for _ = rxn_idxs),
)
Change the specified reaction flux bounds in the model in-place.
Example
new_model = change_bounds!(model, [123, 234], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_bounds!
— Methodchange_bounds!(
model::CoreModelCoupled,
rxn_ids::AbstractVector{String};
lower = (nothing for _ = rxn_ids),
upper = (nothing for _ = rxn_ids),
)
Change the specified reaction flux bounds in the model in-place.
Example
new_model = change_bounds!(model, ["ReactionA", "ReactionC"], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_bounds
— Methodchange_bounds(
model::CoreModelCoupled,
rxn_idxs::AbstractVector{Int64};
lower = (nothing for _ = rxn_idxs),
upper = (nothing for _ = rxn_idxs),
)
Change the specified reaction flux bounds in the model and return the modified model.
Example
change_bounds(model, [123, 234], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_bounds
— Methodchange_bounds(
model::CoreModelCoupled,
rxn_ids::AbstractVector{String};
lower = (nothing for _ = rxn_ids),
upper = (nothing for _ = rxn_ids),
)
Change the specified reaction flux bounds in the model and return the modified model.
Example
change_bounds(model, ["ReactionA", "ReactionC"], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_coupling_bounds!
— Methodchange_coupling_bounds!(
model::CoreModelCoupled,
constraints::Vector{Int};
cl::V = Float64[],
cu::V = Float64[],
) where {V<:VecType}
Change the lower and/or upper bounds (cl
and cu
) for the given list of coupling constraints.
COBREXA.change_objective!
— Methodchange_objective!(
model::CoreModelCoupled,
args...;
kwargs...,
)
Forwards arguments to change_objective!
of the internal CoreModel
.
COBREXA.remove_coupling_constraints!
— Methodremove_coupling_constraints!(m::CoreModelCoupled, constraint::Int)
Removes a single coupling constraints from a CoreModelCoupled
in-place.
COBREXA.remove_coupling_constraints!
— Methodremove_coupling_constraints!(m::CoreModelCoupled, constraints::Vector{Int})
Removes a set of coupling constraints from a CoreModelCoupled
in-place.
COBREXA.remove_coupling_constraints
— Methodremove_coupling_constraints(m::CoreModelCoupled, args...)
Remove coupling constraints from the linear model, and return the modified model. Arguments are the same as for in-place version remove_coupling_constraints!
.
COBREXA.remove_metabolite!
— Methodremove_metabolite!(model::CoreModelCoupled, metabolite_idx::Int)
Remove metabolite from the model of type CoreModelCoupled
in-place.
COBREXA.remove_metabolite!
— Methodremove_metabolite!(model::CoreModelCoupled, metabolite_id::String)
Remove metabolite from the model of type CoreModelCoupled
in-place.
COBREXA.remove_metabolite
— Methodremove_metabolite(model::CoreModelCoupled, metabolite_idx::Int)
Remove metabolite from the model of type CoreModelCoupled
and return the modified model.
COBREXA.remove_metabolite
— Methodremove_metabolite(model::CoreModelCoupled, metabolite_id::String)
Remove metabolite from the model of type CoreModelCoupled
and return the modified model.
COBREXA.remove_metabolites!
— Methodremove_metabolites!(model::CoreModelCoupled, metabolite_idxs::AbstractVector{Int64})
Remove metabolites from the model of type CoreModelCoupled
in-place.
COBREXA.remove_metabolites!
— Methodremove_metabolites!(model::CoreModelCoupled, metabolite_ids::AbstractVector{String})
Remove metabolites from the model of type CoreModelCoupled
in-place.
COBREXA.remove_metabolites
— Methodremove_metabolites(model::CoreModelCoupled, metabolite_idxs::AbstractVector{Int64})
Remove metabolites from the model of type CoreModelCoupled
and return the modified model.
COBREXA.remove_metabolites
— Methodremove_metabolites(model::CoreModelCoupled, metabolite_ids::AbstractVector{String})
Remove metabolites from the model of type CoreModelCoupled
and return the modified model.
COBREXA.remove_reaction!
— Methodremove_reaction!(model::CoreModelCoupled, reaction_idx::Int)
Remove reaction from the model of type CoreModelCoupled
in-place.
COBREXA.remove_reaction!
— Methodremove_reaction!(model::CoreModelCoupled, reaction_id::String)
Remove reaction from the model of type CoreModelCoupled
in-place.
COBREXA.remove_reaction
— Methodremove_reaction(model::CoreModelCoupled, reaction_idx::Int)
Remove reaction from the model of type CoreModelCoupled
and return the modified model.
COBREXA.remove_reaction
— Methodremove_reaction(model::CoreModelCoupled, reaction_id::String)
Remove reaction from the model of type CoreModelCoupled
and return the modified model.
COBREXA.remove_reactions!
— Methodremove_reactions!(model::CoreModelCoupled, reaction_idxs::AbstractVector{Int64})
Remove reactions from the model of type CoreModelCoupled
in-place.
COBREXA.remove_reactions!
— Methodremove_reactions!(model::CoreModelCoupled, reaction_ids::AbstractVector{String})
Remove reactions from the model of type CoreModelCoupled
in-place.
COBREXA.remove_reactions
— Methodremove_reactions(model::CoreModelCoupled, reaction_idxs::AbstractVector{Int64})
Remove reactions from the model of type CoreModelCoupled
and return the modified model.
COBREXA.remove_reactions
— Methodremove_reactions(model::CoreModelCoupled, reaction_ids::AbstractVector{String})
Remove reactions from the model of type CoreModelCoupled
and return the modified model.
COBREXA._Stoichiometry
— TypeA small helper type for constructing reactions inline
Base.:+
— Methodmetabolite1 + metabolite2
Add 2 groups of Metabolite
s together to form reactions inline. Use with +
, *
, →
and similar operators.
COBREXA.:←
— Methodsubstrates ← products
Make a reverse-only Reaction
from substrates
and products
.
COBREXA.:→
— Methodsubstrates → products
Make a forward-only Reaction
from substrates
and products
.
COBREXA.:↔
— Methodsubstrates ↔ products
Make a bidirectional (reversible) Reaction
from substrates
and products
.
COBREXA.add_reactions
— Methodadd_reactions(model::Serialized, ...)
Calls add_reactions
of the internal serialized model type. Returns the modified un-serialized model.
COBREXA.change_bound
— Methodchange_bound(model::Serialized, ...)
Calls change_bound
of the internal serialized model type. Returns the modified un-serialized model.
COBREXA.change_bounds
— Methodchange_bounds(model::Serialized, ...)
Calls change_bounds
of the internal serialized model type. Returns the modified un-serialized model.
COBREXA.remove_metabolite
— Methodremove_metabolite(model::Serialized, ...)
Calls remove_metabolite
of the internal serialized model type. Returns the modified un-serialized model.
COBREXA.remove_metabolites
— Methodremove_metabolites(model::Serialized, ...)
Calls remove_metabolites
of the internal serialized model type. Returns the modified un-serialized model.
COBREXA.remove_reaction
— Methodremove_reaction(model::Serialized, ...)
Calls remove_reaction
of the internal serialized model type. Returns the modified un-serialized model.
COBREXA.remove_reactions
— Methodremove_reactions(model::Serialized, ...)
Calls remove_reactions
of the internal serialized model type. Returns the modified un-serialized model.
COBREXA.unwrap_serialized
— Methodunwrap_serialized(model::Serialized)
Returns the model stored in the serialized structure.
COBREXA.add_gene!
— Methodadd_gene!(model::StandardModel, genes::Gene)
Add gene
to model
based on gene id
.
COBREXA.add_genes!
— Methodadd_genes!(model::StandardModel, genes::Vector{Gene})
Add genes
to model
based on gene id
.
COBREXA.add_metabolite!
— Methodadd_metabolite!(model::StandardModel, met::Metabolite)
Add met
to model
based on metabolite id
.
COBREXA.add_metabolites!
— Methodadd_metabolites!(model::StandardModel, mets::Vector{Metabolite})
Add mets
to model
based on metabolite id
.
COBREXA.add_reaction!
— Methodadd_reaction!(model::StandardModel, rxn::Reaction)
Add rxn
to model
based on reaction id
.
COBREXA.add_reactions!
— Methodadd_reactions!(model::StandardModel, rxns::Vector{Reaction})
Add rxns
to model
based on reaction id
.
COBREXA.change_bound!
— Methodchange_bound!(
model::StandardModel,
rxn_id::String;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model in-place.
Example
new_model = change_bound!(model, "ReactionB", lower=-21.15, upper=42.3)
COBREXA.change_bound
— Methodchange_bound(
model::StandardModel,
rxn_id::String;
lower = nothing,
upper = nothing,
)
Change the specified reaction flux bound in the model and return the modified model.
Example
change_bound(model, "ReactionB", lower=-21.15, upper=42.3)
COBREXA.change_bounds!
— Methodchange_bounds!(
model::StandardModel,
rxn_ids::AbstractVector{String};
lower = (nothing for _ = rxn_ids),
upper = (nothing for _ = rxn_ids),
)
Change the specified reaction flux bounds in the model in-place.
Example
new_model = change_bounds!(model, ["ReactionA", "ReactionC"], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_bounds
— Methodchange_bounds(
model::StandardModel,
rxn_ids::AbstractVector{String};
lower = (nothing for _ = rxn_ids),
upper = (nothing for _ = rxn_ids),
)
Change the specified reaction flux bounds in the model and return the modified model.
Example
change_bounds(model, ["ReactionA", "ReactionC"], lower=[-2.1, -50.05], upper=[4.2, 100.1])
COBREXA.change_objective!
— Methodchange_objective!(
model::StandardModel,
rxn_ids::Vector{String};
weights = ones(length(rxn_ids)),
)
Change the objective for model
to reaction(s) with rxn_ids
, optionally specifying their weights
. By default, assume equal weights. If no objective exists in model, sets objective.
COBREXA.remove_gene!
— Methodremove_gene!(
model::StandardModel,
id::Vector{String};
knockout_reactions::Bool = false,
)
Remove gene with id
from model
. If knockout_reactions
is true, then also constrain reactions that require the genes to function to carry zero flux.
Example
remove_gene!(model, "g1")
COBREXA.remove_genes!
— Methodremove_genes!(
model::StandardModel,
ids::Vector{String};
knockout_reactions::Bool = false,
)
Remove all genes with ids
from model
. If knockout_reactions
is true, then also constrain reactions that require the genes to function to carry zero flux.
Example
remove_genes!(model, ["g1", "g2"])
COBREXA.remove_metabolite!
— Methodremove_metabolite!(model::StandardModel, metabolite_id::String)
Remove metabolite from the model of type StandardModel
in-place.
COBREXA.remove_metabolite
— Methodremove_metabolite(model::StandardModel, metabolite_id::String)
Remove metabolite from the model of type StandardModel
and return the modified model.
COBREXA.remove_metabolites!
— Methodremove_metabolites!(model::StandardModel, metabolite_ids::AbstractVector{String})
Remove metabolites from the model of type StandardModel
in-place.
COBREXA.remove_metabolites
— Methodremove_metabolites(model::StandardModel, metabolite_ids::AbstractVector{String})
Remove metabolites from the model of type StandardModel
and return the modified model.
COBREXA.remove_reaction!
— Methodremove_reaction!(model::StandardModel, reaction_id::String)
Remove reaction from the model of type StandardModel
in-place.
COBREXA.remove_reaction
— Methodremove_reaction(model::StandardModel, reaction_id::String)
Remove reaction from the model of type StandardModel
and return the modified model.
COBREXA.remove_reactions!
— Methodremove_reactions!(model::StandardModel, reaction_ids::AbstractVector{String})
Remove reactions from the model of type StandardModel
in-place.
COBREXA.remove_reactions
— Methodremove_reactions(model::StandardModel, reaction_ids::AbstractVector{String})
Remove reactions from the model of type StandardModel
and return the modified model.
COBREXA.@add_reactions!
— Macro@add_reactions!(model::Symbol, ex::Expr)
Shortcut to add multiple reactions and their lower and upper bounds
Call variants
@add_reactions! model begin
reaction_name, reaction
end
@add_reactions! model begin
reaction_name, reaction, lower_bound
end
@add_reactions! model begin
reaction_name, reaction, lower_bound, upper_bound
end
Examples
@add_reactions! model begin
"v1", nothing → A, 0, 500
"v2", A ↔ B + C, -500
"v3", B + C → nothing
end
COBREXA.add_community_objective!
— Methodadd_community_objective!(
community::CoreModel,
objective_mets_weights::Dict{String, Float64};
objective_id = "community_biomass",
)
Add an objective column to the community
model with optional id objective_id
. Supply a dictionary mapping the string names of the objective metabolites to their weights in objective_mets_weights
. Note, the weights are negated inside the function so that positive weights are seen as reagents/substrates, NOT products in the reaction equation.
Example
add_community_objective!(model, Dict("met1"=>1.0, "met2"=>2.0))
See also: update_community_objective!
COBREXA.add_community_objective!
— Methodadd_community_objective!(
community::StandardModel,
objective_mets_weights::Dict{String, Float64};
objective_id = "community_biomass"
)
Variant of [add_community_objective!
] that takes a StandardModel
community model as input.
COBREXA.add_model_with_exchanges!
— Methodadd_model_with_exchanges!(
community::StandardModel,
model::MetabolicModel,
exchange_rxn_mets::Dict{String,String};
model_name = "unknown_species",
biomass_id = nothing,
)
The StandardModel
variant of add_model_with_exchanges
, but is in-place.
COBREXA.add_model_with_exchanges
— Methodadd_model_with_exchanges(
community::CoreModel,
model::MetabolicModel,
exchange_rxn_mets::Dict{String,String};
model_name = "unknown_species",
biomass_id = nothing,
)
Add model
to community
, which is a pre-existing community model with exchange reactions and metabolites in the dictionary exchange_rxn_mets
. The model_name
is appended to each reaction and metabolite, see join_with_exchanges
. If biomass_id
is specified then a biomass metabolite for model
is also added to the resulting model. The column corresponding to the biomass_id
reaction then produces this new biomass metabolite with unit coefficient. The exchange reactions and metabolites in exchange_rxn_mets
must already exist in community
. Always returns a new community model because it is more efficient than resizing all the matrices.
No in-place variant for CoreModel
s exists yet.
Example
community = add_model_with_exchanges(community,
model,
exchange_rxn_mets;
model_name="species_2",
biomass_id="BIOMASS_Ecoli_core_w_GAM")
COBREXA.add_model_with_exchanges
— Methodadd_model_with_exchanges(
community::StandardModel,
model::MetabolicModel,
exchange_rxn_mets::Dict{String,String};
model_name = "unknown_species",
biomass_id = nothing,
)
The StandardModel
variant of add_model_with_exchanges
. Makes a deepcopy of community
and calls the inplace variant of this function on that copy.
COBREXA.join_with_exchanges
— Methodjoin_with_exchanges(
::Type{CoreModel},
models::Vector{M},
exchange_rxn_mets::Dict{String,String};
biomass_ids = String[],
model_names = String[],
) where {M<:MetabolicModel}
Return a CoreModel
representing the community model of models
joined through their exchange reactions and metabolites in the dictionary exchange_rxn_mets
, which maps exchange reactions to their associated metabolite. These exchange reactions and metabolites link model metabolites to environmental metabolites and reactions. Optionally specify model_names
to append a specific name to each reaction and metabolite of an organism for easier reference (default is species_i
for each model index i in models
). Note, the bounds of the environmental variables are all set to zero. Thus, to run a simulation you need to constrain them appropriately. All the other bounds are inherited from the models used to construct the community model.
If biomass_ids
is supplied, then a community model is returned that has an extra reaction added to the end of the stoichiometric matrix (last column) that can be assigned as the objective reaction. It also creates biomass "metabolites" that can be used in this objective reaction. In the returned mode, these biomass metabolites are produced by the reaction corresponding to biomass_ids
in each model respectively. Note, this reaction is unspecified, further action needs to be taken to specify it, e.g. assign weights to the last column of the stoichiometric matrix in the rows corresponding to the biomass metabolites.
To further clarify how this join
works. Suppose you have 2 organisms with stoichiometric matrices S₁ and S₂ and you want to link them with exchange_rxn_mets = Dict(er₁ => em₁, er₂ => em₂, er₃ => em₃, ...)
. Then a new community stoichiometric matrix is constructed that looks like this:
_ er₁ er₂ er₃ ... b_
|S₁ |
| S₂ |
em₁| |
S = em₂| |
em₃| |
...| |
bm₁| |
bm₂|_ _|
The exchange reactions in each model get linked to environmental metabolites, emᵢ
, and these get linked to environmental exchanges, erᵢ
. These erᵢ
behave like normal single organism exchange reactions. When biomass_ids
are supplied, each model's biomass reaction produces a pseudo-metabolite (bmᵢ
). These can be weighted in column b
, called the community_biomass
reaction in the community model, if desired. Refer to the tutorial if this is unclear.
Example
m1 = load_model(core_model_path)
m2 = load_model(CoreModel, core_model_path)
# need to list ALL the exchanges that will form part of the entire model
exchange_rxn_mets = Dict(k => first(keys(reaction_stoichiometry(m1, ex_rxn)))
for filter(looks_like_exchange_reaction, reactions(m1)))
biomass_ids = ["BIOMASS_Ecoli_core_w_GAM", "BIOMASS_Ecoli_core_w_GAM"]
community = join_with_exchanges(
CoreModel,
[m1, m2],
exchange_rxn_mets;
biomass_ids = biomass_ids,
)
COBREXA.join_with_exchanges
— Methodjoin_with_exchanges(
::Type{StandardModel},
models::Vector{M},
exchange_rxn_mets::Dict{String,String};
biomass_ids = [],
model_names = [],
)::StandardModel where {M<:MetabolicModel}
A variant of join_with_exchanges
that returns a StandardModel
.
COBREXA.update_community_objective!
— Methodupdate_community_objective!(
community::CoreModel,
objective_id::String,
objective_mets_weights::Dict{String, Float64}
)
Update the weights for the objective column with id objective_id
in community
using objective_mets_weights
, which maps metabolite ids to weights. The current weights are reset to 0 before being updated to the supplied weights. Note, the weights are negated inside the function so that the objective metabolites are seen as reagents/substrates, NOT products in the reaction equation.
Example
update_community_objective!(model, "community_biomass", Dict("met1"=>1.0, "met2"=>2.0))
See also: add_community_objective!
COBREXA.update_community_objective!
— Methodupdate_community_objective!(
community::StandardModel,
objective_id::String,
objective_mets_weights::Dict{String, Float64}
)
Variant of [update_community_objective!
] that takes a StandardModel
community model as input.
Variant specifiers
COBREXA.with_added_reactions
— Methodwith_added_reactions(args...; kwargs...)
Specifies a model variant with reactions added. Forwards the arguments to add_reactions
. Intended to be used with screen
.
COBREXA.with_changed_bound
— Methodwith_changed_bound(args...; kwargs...)
Specifies a model variant that has a new bound set. Forwards arguments to change_bound
. Intended for usage with screen
.
COBREXA.with_changed_bounds
— Methodwith_changed_bounds(args...; kwargs...)
Specifies a model variant that has new bounds set. Forwards arguments to change_bounds
. Intended for usage with screen
.
COBREXA.with_removed_metabolite
— Methodwith_removed_metabolite(args...; kwargs...)
Specifies a model variant without a certain metabolite. Forwards arguments to remove_metabolite
. Intended to be used with screen
.
COBREXA.with_removed_metabolites
— Methodwith_removed_metabolites(args...; kwargs...)
Plural version of with_removed_metabolite
, calls remove_metabolites
internally.
COBREXA.with_removed_reaction
— Methodwith_removed_reaction(args...; kwargs...)
Specifies a model variant without a certain reaction. Forwards arguments to remove_reaction
. Intended to be used with screen
.
COBREXA.with_removed_reactions
— Methodwith_removed_reactions(args...; kwargs...)
Plural version of with_removed_reaction
, calls remove_reactions
internally.