Skip to content

Commit

Permalink
Merge pull request #54 from COBREXA/mk-remove-bounds
Browse files Browse the repository at this point in the history
implement bounds removal (helpful for sign splitting)
  • Loading branch information
exaexa authored Jul 24, 2024
2 parents 68e689f + 4ea1d35 commit 62202a5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 5 additions & 3 deletions docs/src/examples/04-community-models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions src/misc/bounds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 comments on commit 62202a5

@exaexa
Copy link
Member Author

@exaexa exaexa commented on 62202a5 Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/111712

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.1.0 -m "<description of version>" 62202a51ab76c7f3b83264c66467c670e6040c75
git push origin v2.1.0

Please sign in to comment.