diff --git a/Project.toml b/Project.toml index 994d962f..97f04104 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "COBREXA" uuid = "babc4406-5200-4a30-9033-bf5ae714c842" authors = ["The developers of COBREXA.jl"] -version = "2.0.2" +version = "2.1.0" [deps] AbstractFBCModels = "5a4f3dfa-1789-40f8-8221-69268c29937c" diff --git a/docs/src/examples/04-community-models.jl b/docs/src/examples/04-community-models.jl index 80e962f3..97fd3c95 100644 --- a/docs/src/examples/04-community-models.jl +++ b/docs/src/examples/04-community-models.jl @@ -121,15 +121,17 @@ flux_balance_constraints(ecoli, interface = :boundary).interface # (such as `EX_` for exchanges). # Even if all of these methods fail, a suitable interface yourself can be -# produced manually: +# produced manually. (Additionally, we can do useful stuff, such as removing +# the unnecessary bounds from the exchange descriptions.) custom_model = flux_balance_constraints(ecoli) -custom_model *= +custom_model *= remove_bounds( :interface^C.ConstraintTree( :biomass => custom_model.fluxes.BIOMASS_Ecoli_core_w_GAM, :exchanges => C.ConstraintTree( k => v for (k, v) in custom_model.fluxes if startswith(string(k), "EX_") ), - ) + ), +) custom_model.interface.exchanges # ## Connecting the community constraints manually diff --git a/src/misc/bounds.jl b/src/misc/bounds.jl index 2b5b21a6..e4a5f23f 100644 --- a/src/misc/bounds.jl +++ b/src/misc/bounds.jl @@ -39,3 +39,18 @@ relative_tolerance_bound(tolerance) = x -> begin end export relative_tolerance_bound + +""" +$(TYPEDSIGNATURES) + +Make a copy of a constraint tree with all bounds removed. This is helpful when +creating large trees only for for value representation purposes, which should +not directly constraint anything (and thus should not put additional stress on +the constraint solver). +""" +remove_bounds(cs::C.ConstraintTree) = + C.map(cs) do c + C.Constraint(c.value, nothing) + end + +export remove_bounds