Core functionality

Model I/O

COBREXA.download_modelMethod
download_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.

source
COBREXA.load_modelMethod
load_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.

source
COBREXA.load_modelMethod
load_model(
    model_type::Type{I<:AbstractFBCModels.AbstractFBCModel},
    path::String
) -> Any

Load a FBC model representation from a known model_type. Uses AbstractFBCModels.load.

source
COBREXA.load_modelMethod
load_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.

source
COBREXA.load_modelMethod
load_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.

source
COBREXA.save_converted_modelMethod
save_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.

source
COBREXA.save_modelMethod
save_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.

source
COBREXA.save_modelMethod
save_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).

source

Types

Configuration

COBREXA.configurationConstant
const 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.

source
COBREXA.ConfigurationType
mutable 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 that flux_balance_constraints uses for guessing which reactions are exchanges.
  • biomass_id_prefixes::Vector{String}: Prefixes that flux_balance_constraints uses for guessing which reactions are biomass reactions.
  • atp_maintenance_ids::Vector{String}: Reaction identifiers that flux_balance_constraints considers to be ATP maintenance reactions.
  • sampler_tolerance::Any: Default numerical tolerance for sampling functions.
  • default_solver_settings::Any: Default settings first applied to all JuMP Models.
source

Solver interface

COBREXA.FeasibleConstant
Maximal

Objective sense for finding the any feasible value of the objective.

Same as JuMP.FEASIBILITY_SENSE.

source
COBREXA.MaximalConstant
Maximal

Objective sense for finding the maximal value of the objective.

Same as JuMP.MAX_SENSE.

source
COBREXA.MinimalConstant
Minimal

Objective sense for finding the minimal value of the objective.

Same as JuMP.MIN_SENSE.

source
COBREXA.SwitchType
mutable struct Switch <: ConstraintTrees.Bound

Representation of a "binary switch" bound for ConstraintTrees. The value is constrained to be either the value of field a or of field b; both fields are Float64s. 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 choice

  • b::Float64: The other choice

source
COBREXA.constraint_jump!Method
constraint_jump!(
    model,
    expr,
    b::ConstraintTrees.Between
) -> Union{Bool, JuMP.ConstraintRef}

Add an interval constraint to a JuMP model.

source
COBREXA.constraint_jump!Method
constraint_jump!(
    model,
    expr,
    b::ConstraintTrees.EqualTo
) -> JuMP.ConstraintRef

Add an equality constraint to a JuMP model.

source
COBREXA.is_solvedMethod
is_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.

source
COBREXA.optimization_modelMethod
optimization_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.

source
COBREXA.optimized_modelMethod
optimized_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.

source
COBREXA.substitute_jumpMethod
substitute_jump(
    val::ConstraintTrees.LinearValue,
    vars
) -> JuMP.AffExpr

Very efficiently substitute a ConstraintTrees' LinearValue into a JuMP expression of type AffExpr.

source
COBREXA.substitute_jumpMethod
substitute_jump(
    val::ConstraintTrees.QuadraticValue,
    vars
) -> JuMP.QuadExpr

Very efficiently substitute a ConstraintTrees' QuadraticValue into a JuMP expression of type QuadExpr.

source

Task distribution support

COBREXA.worker_local_dataType
mutable 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 worker

  • local_data::Union{Nothing, Some}: The data that is cached on the remote worker

  • transform::Function: The function that converts the transferred data to locally-cached data on the remote worker

source
COBREXA.get_worker_local_dataMethod
get_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.

source