Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make the semantics cut #776

Merged
merged 19 commits into from
May 8, 2023
Merged

make the semantics cut #776

merged 19 commits into from
May 8, 2023

Conversation

exaexa
Copy link
Collaborator

@exaexa exaexa commented May 2, 2023

I have this specially separated from the rest of the (RELATIVELY HARMLESS) semantics-are-everywhere change because it's gonna be the most breaking part, and the reviews should be kinda clear.

In this state it's not looking good (tests will fail until I fix them) but most of the errors I see seem fixable.

As the main points:

  • stoichiometry is now just a nice name for metabolite_variables_matrix
  • balance is gone, instead of that the metabolites have the balance bounds
  • stoichiometry is no more matrixy "by default", the dictionary-ish metabolite_variables is the master form now as with other semantics..
    • pros: resizing variables or reactions doesn't kill stoichiometry and you don't need to care about that much
    • cons: reconstructing the stoichiometry from dicts isn't that nicely efficient, we'll need a bit of extra annotations to be able to pipe the matrixy form through wrappers easily

I'll fix the rest, at this points any comments welcome.

@exaexa exaexa requested a review from stelmo May 2, 2023 13:19
@exaexa exaexa added ❌ breaking Merging requires a major version bump 🪓 code axing 🪓 Use this for PRs that remove code which might still be re-used later labels May 2, 2023
@exaexa exaexa marked this pull request as draft May 2, 2023 13:20
@exaexa exaexa added this to the v2.0 milestone May 2, 2023
Copy link
Collaborator

@stelmo stelmo left a comment

Choose a reason for hiding this comment

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

YES

@@ -108,7 +108,7 @@ modifying the reaction list, stoichiometry, and bounds:
COBREXA.unwrap_model(x::LeakyModel) = x.mdl
COBREXA.reaction_count(x::LeakyModel) = reaction_count(x.mdl) + 1
COBREXA.reaction_ids(x::LeakyModel) = [reaction_ids(x.mdl); "The Leak"]
COBREXA.stoichiometry(x::LeakyModel) = [stoichiometry(x.mdl) [m in x.leaking_metabolites ? -1.0 : 0.0 for m = metabolites(x.mdl)]]
COBREXA.stoichiometry(x::LeakyModel) = [stoichiometry(x.mdl) [m in x.leaking_metabolites ? -1.0 : 0.0 for m = metabolite_ids(x.mdl)]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably want a better name than leaking_metabolites

@@ -54,7 +54,7 @@ function gapfill_minimum_reactions(
precache!(model)

# constraints from universal reactions that can fill gaps
univs = _universal_stoichiometry(universal_reactions, metabolites(model))
univs = _universal_stoichiometry(universal_reactions, metabolite_ids(model))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Love it

@@ -89,7 +89,7 @@ function gapfill_minimum_reactions(
@constraint(
opt_model,
extended_stoichiometry * [x; ux] .==
[balance(model); zeros(length(univs.new_mids))]
[metabolite_bounds(model); zeros(length(univs.new_mids))]
Copy link
Collaborator

Choose a reason for hiding this comment

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

YES

@exaexa exaexa marked this pull request as ready for review May 8, 2023 10:11
@exaexa
Copy link
Collaborator Author

exaexa commented May 8, 2023

@stelmo I guess this is ready for merging into the bigger PR now (at least the tests pass). It might be necessary to redo the logic of the community models a bit. Matrix passthrough still doesn't really work but that's patchable later (it's mostly a minor performance issue)

@codecov
Copy link

codecov bot commented May 8, 2023

Codecov Report

Patch coverage: 89.76% and project coverage change: -0.07 ⚠️

Comparison is base (6272230) 89.03% compared to head (9173d69) 88.97%.

Additional details and impacted files
@@                    Coverage Diff                    @@
##           mk-finalize-semantics     #776      +/-   ##
=========================================================
- Coverage                  89.03%   88.97%   -0.07%     
=========================================================
  Files                         92       92              
  Lines                       2444     2403      -41     
=========================================================
- Hits                        2176     2138      -38     
+ Misses                       268      265       -3     
Impacted Files Coverage Δ
src/analysis/sampling/affine_hit_and_run.jl 94.11% <ø> (ø)
src/analysis/variability_analysis.jl 97.29% <ø> (ø)
src/io/show/AbstractMetabolicModel.jl 100.00% <ø> (ø)
src/reconstruction/MatrixCoupling.jl 96.05% <ø> (ø)
src/utils/looks_like.jl 44.44% <0.00%> (ø)
src/wrappers/SimplifiedEnzymeConstrainedModel.jl 92.59% <ø> (ø)
src/wrappers/misc/mmdf.jl 100.00% <ø> (ø)
src/types/wrappers/EqualGrowthCommunityModel.jl 84.21% <33.33%> (ø)
src/types/accessors/AbstractMetabolicModel.jl 74.57% <50.00%> (-3.04%) ⬇️
src/solver.jl 85.00% <77.77%> (+8.72%) ⬆️
... and 17 more

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@stelmo
Copy link
Collaborator

stelmo commented May 8, 2023

@stelmo I guess this is ready for merging into the bigger PR now (at least the tests pass). It might be necessary to redo the logic of the community models a bit. Matrix passthrough still doesn't really work but that's patchable later (it's mostly a minor performance issue)

🚀 let's figure out the problems as they come up

@exaexa
Copy link
Collaborator Author

exaexa commented May 8, 2023

ok 💥

@exaexa exaexa merged commit 74ab0d0 into mk-finalize-semantics May 8, 2023
@exaexa exaexa deleted the mk-make-the-cut branch May 8, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪓 code axing 🪓 Use this for PRs that remove code which might still be re-used later ❌ breaking Merging requires a major version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants