Core functionality
Model I/O
COBREXA.download_model
— Methoddownload_model(args...; kwargs...) -> Any
Safely download a model with a known hash. All arguments are forwarded to AbstractFBCModels.download_data_file
– see the documentation in the AbstractFBCModels package for details.
COBREXA.load_model
— Methodload_model(path::String) -> Any
Load a FBC model representation while guessing the correct model type to load. Uses AbstractFBCModels.load
.
This overload almost always involves a search over types; do not use it in environments where performance is critical.
COBREXA.load_model
— Methodload_model(
model_type::Type{I<:AbstractFBCModels.AbstractFBCModel},
path::String
) -> Any
Load a FBC model representation from a known model_type
. Uses AbstractFBCModels.load
.
COBREXA.load_model
— Methodload_model(
model_type::Type{I<:AbstractFBCModels.AbstractFBCModel},
path::String,
convert_to::Type{O<:AbstractFBCModels.AbstractFBCModel}
) -> Any
Overload of load_model
that explicitly specifies the known input type, and immediately converts to another model type given by argument convert_to
.
COBREXA.load_model
— Methodload_model(
path::String,
convert_to::Type{O<:AbstractFBCModels.AbstractFBCModel}
) -> Any
Overload of load_model
that guesses the input type, but immediately converts to the model type given by argument convert_to
.
COBREXA.save_converted_model
— Methodsave_converted_model(
model::AbstractFBCModels.AbstractFBCModel,
path::String
) -> Any
Like save_model
but tries to convert the model
to a type that matches the extension of the path
. For example, this will convert the model
to a JSON model type in case the path
ends with .json
.
This is an utility shortcut – if possible, it is always better to specify the output model type explicitly.
COBREXA.save_model
— Methodsave_model(
model::AbstractFBCModels.AbstractFBCModel,
path::String,
convert_to::Type{O<:AbstractFBCModels.AbstractFBCModel}
) -> Any
Overload of save_model
that converts the model type to convert_to
before saving.
COBREXA.save_model
— Methodsave_model(
model::AbstractFBCModels.AbstractFBCModel,
path::String
) -> Any
Save a FBC model representation. Uses AbstractFBCModels.save
.
Use the 3-parameter overload if you need to convert the model to another representation (e.g., if you want to save a canonical model type as JSON or SBML).
Types
COBREXA.Maybe
— TypeMaybe{X}
Type of optional values.
Configuration
COBREXA.configuration
— Constantconst configuration
The configuration object. You can change the contents of configuration to override the default behavior of some of the functions.
The available options are described by struct Configuration
.
COBREXA.Configuration
— Typemutable struct Configuration
Global configuration options for various COBREXA functions, mainly for various non-interesting function parameters that are too inconvenient to be passed around manually.
Changing the configuration values at runtime is possible via the global configuration
variable.
Fields
exchange_id_prefixes::Vector{String}
: Prefixes thatflux_balance_constraints
uses for guessing which reactions are exchanges.
biomass_id_prefixes::Vector{String}
: Prefixes thatflux_balance_constraints
uses for guessing which reactions are biomass reactions.
atp_maintenance_ids::Vector{String}
: Reaction identifiers thatflux_balance_constraints
considers to be ATP maintenance reactions.
exchange_sbos::Vector{String}
: SBO numbers that label exchange reactions forflux_balance_constraints
.
biomass_sbos::Vector{String}
: SBO numbers that label biomass production reactions forflux_balance_constraints
.
atp_maintenance_sbos::Vector{String}
: SBO numbers that label ATP maintenance reactions forflux_balance_constraints
.
demand_sbos::Vector{String}
: SBO numbers that label metabolite demand reactions forflux_balance_constraints
.
sampler_tolerance::Any
: Default numerical tolerance for sampling functions.
default_solver_settings::Any
: Default settings first applied to all JuMPModel
s.
Solver interface
COBREXA.Feasible
— ConstantMaximal
Objective sense for finding the any feasible value of the objective.
Same as JuMP.FEASIBILITY_SENSE
.
COBREXA.Maximal
— ConstantMaximal
Objective sense for finding the maximal value of the objective.
Same as JuMP.MAX_SENSE
.
COBREXA.Minimal
— ConstantMinimal
Objective sense for finding the minimal value of the objective.
Same as JuMP.MIN_SENSE
.
COBREXA.Switch
— Typemutable struct Switch <: ConstraintTrees.Bound
Representation of a "binary switch" bound for ConstraintTree
s. The value is constrained to be either the value of field a
or of field b
; both fields are Float64
s. Upon translation to JuMP, the switches create an extra boolean variable, and the value is constrained to equal a + boolean_var * (b-a)
.
Switches can be offset by adding real numbers, negated, and multiplied and divided by scalar constraints. For optimizing some special cases, multiplying by exact zero returns an equality bound to zero.
Fields
a::Float64
: One choiceb::Float64
: The other choice
COBREXA.constraint_jump!
— Methodconstraint_jump!(
model,
expr,
b::ConstraintTrees.Between
) -> Union{Bool, JuMP.ConstraintRef}
Add an interval constraint to a JuMP model.
COBREXA.constraint_jump!
— Methodconstraint_jump!(
model,
expr,
b::ConstraintTrees.EqualTo
) -> JuMP.ConstraintRef
Add an equality constraint to a JuMP model.
COBREXA.constraint_jump!
— Methodconstraint_jump!(
model,
expr,
b::Switch
) -> JuMP.ConstraintRef
Add a Switch
constraint to a JuMP model.
COBREXA.is_solved
— Methodis_solved(opt_model::JuMP.Model) -> Bool
true
if opt_model
solved successfully (solution is optimal or locally optimal). false
if any other termination status is reached.
COBREXA.optimization_model
— Methodoptimization_model(
cs::Union{ConstraintTrees.Constraint, ConstraintTrees.Tree{ConstraintTrees.Constraint}};
objective,
optimizer,
sense
)
Construct a JuMP Model
that describes the precise constraint system into the JuMP Model
created for solving in optimizer
, with a given optional objective
and optimization sense
chosen from Maximal
, Minimal
and Feasible
.
All types of values in the constraint tree must have an overload for substitute_jump
.
COBREXA.optimized_model
— Methodoptimized_model(om; output)
Like optimized_values
, but works directly with a given JuMP model om
without applying any settings or creating the optimization model.
To run the process manually, you can use optimization_model
to convert the constraints into a suitable JuMP optimization model.
COBREXA.optimized_objective
— Methodoptimized_objective(
om
) -> Union{Nothing, Float64, Vector{Float64}}
Like optimized_model
but only returns the objective value (or nothing
if the model is not solved).
COBREXA.substitute_jump
— Methodsubstitute_jump(
val::ConstraintTrees.LinearValue,
vars
) -> JuMP.AffExpr
Very efficiently substitute a ConstraintTrees' LinearValue
into a JuMP expression of type AffExpr
.
COBREXA.substitute_jump
— Methodsubstitute_jump(
val::ConstraintTrees.QuadraticValue,
vars
) -> JuMP.QuadExpr
Very efficiently substitute a ConstraintTrees' QuadraticValue
into a JuMP expression of type QuadExpr
.
COBREXA.variable_vector
— Methodvariable_vector(opt_model::JuMP.Model) -> Any
Retrieve the variable vector from a JuMP model created by optimization_model
.
Task distribution support
COBREXA.worker_local_data
— Typemutable struct worker_local_data
Helper struct that provides access to local data that are unboxed and cached directly on distributed workers.
Use with get_worker_local_data
and Distributed.CachingPool
.
Fields
transfer_data::Any
: The data that is transferred to the remote workerlocal_data::Union{Nothing, Some}
: The data that is cached on the remote workertransform::Function
: The function that converts the transferred data to locally-cached data on the remote worker
COBREXA.get_worker_local_data
— Methodget_worker_local_data(x::COBREXA.worker_local_data) -> Any
"Unwrap" the worker_local_data
on a remote worker to get the local_data
out. If required, executes the transform
function.
Local copies of transfer_data
are forgotten after the function executes.