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

Improve MMDF #5

Closed
wants to merge 7 commits into from
Closed

Improve MMDF #5

wants to merge 7 commits into from

Conversation

stelmo
Copy link
Member

@stelmo stelmo commented Jan 30, 2024

I changed some stuff here and there, but ended up with something that is very similar to what you had... Made the model simplification steps explicit though, and separated out the allocation steps.

@stelmo stelmo requested a review from exaexa January 30, 2024 16:01
@stelmo stelmo force-pushed the sew-mmdf-improvements branch from d99b157 to 63d852d Compare January 30, 2024 16:35
@stelmo
Copy link
Member Author

stelmo commented Jan 30, 2024

Something is going wrong with the docs + not sure how to make the CI ignore the plots (CairoMakie should not be a test dep)

Copy link
Member

@exaexa exaexa left a comment

Choose a reason for hiding this comment

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

Can you separate out the actual mmdf fixes (esp. the argument organization, mergeable immediately IMO) from the code moving (that shadows any other fixes in the code- if possible always split code moves from actual edits, also that should be rebased on #2 because it does similar thing differently) and from the makie in docs (I've got a feeling that we won't be able to get that working anytime soon because Makie became quite a monster)

Also what changed in the code that the mmdf is so different?

Also also given the MMDF is negative doesn't that mean that the model is in fact thermodynamically infeasible?

@exaexa
Copy link
Member

exaexa commented Jan 30, 2024

Something is going wrong with the docs + not sure how to make the CI ignore the plots (CairoMakie should not be a test dep)

just #src everywhere should do it

@test isapprox(mmdf_solution.min_driving_force, -2.4739129, atol = TEST_TOLERANCE) #src

# ## Plot the results
# We can see that the ΔG bottleneck is 2.5 kJ/mol, and that there is a
Copy link
Member

Choose a reason for hiding this comment

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

from where is this visible?

docs/src/reference.md Outdated Show resolved Hide resolved
@@ -197,6 +185,7 @@ function max_min_driving_force_analysis(
optimized_values(
constraints;
objective = constraints.min_driving_force.value,
sense = Minimal,
Copy link
Member

Choose a reason for hiding this comment

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

the problem is literally called maximization no?


reaction_subset =
isempty(reference_flux) ? A.reactions(model) :
collect(k for (k, v) in reference_flux if abs(v) > reference_flux_atol)
Copy link
Member

Choose a reason for hiding this comment

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

filter(), also omitting zero fluxes contradicts the mmdf paper no?

=#

reaction_subset =
isempty(reference_flux) ? A.reactions(model) :
Copy link
Member

Choose a reason for hiding this comment

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

this should be isnothing (empty container means empty, not "whatever")

)

# map old idxs of metabolites to new order of smaller system
midx_lookup = Dict(
Copy link
Member

Choose a reason for hiding this comment

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

kill indexes, we worked hard to finally eradicate the stupid indexing from everywhere.

this can be done by just using the original code and adding a conditional continue to the right spot

let r = Symbol(rid),
rf = reference_flux[rid],
df = dGr0 + R * T * constraints.reactant_log_concentrations[r].value
dGr = (rf > 0 ? 1 : -1) * driving_forces[r].value
Copy link
Member

Choose a reason for hiding this comment

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

this is not numerically robust, ignores zero tolerance

dGr0 = reaction_standard_gibbs_free_energies[rid],
dGr = dGr0 + R * T * constraints.log_concentration_stoichiometries[r].value

r => C.Constraint(dGr, C.Between(-Inf, Inf))
Copy link
Member

Choose a reason for hiding this comment

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

unnecessary Between

DomainError(
constant_concentrations,
"unknown metabolites referenced by constant_concentrations",
"unknown metabolites referenced by constant_concentrations.",
Copy link
Member

Choose a reason for hiding this comment

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

why is this suddenly a sentence? (either have a normal error message or convert everything to sentences consistently)

[`linear_parsimonious_flux_balance_analysis`](@ref) (computationally simplest
but the consistency is not guaranteed).

Internally, [`log_concentration_constraints`](@ref) is used to lay out the
base structure of the problem.
Internally, [`log_concentration_constraints`](@ref) is used to lay out the base
Copy link
Member

Choose a reason for hiding this comment

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

why is this reformatted? (check your textwidth settings, should be 80)

@stelmo stelmo changed the base branch from master to sew-move-log-conc February 1, 2024 13:10
@stelmo
Copy link
Member Author

stelmo commented Feb 1, 2024

deleting this to make room for better things :)

@stelmo stelmo closed this Feb 1, 2024
@stelmo stelmo deleted the sew-mmdf-improvements branch February 1, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants