Get variable stoichiometries fully working - #1342
Merged
Merged
Conversation
Also comment out 'we don't support this' error message, and claim we support those tags in the SBML Test Suite.
* Include a new stoichiometryMap * New resetRateRuleStoichPtr * resetAll (in Python) includes stoichiometries.
All new tests now pass: the reset functions properly reset stoichiometries, and setting them also works.
We need a new minor version number for rr, since we now write out stoichiometryMap to the save/load state.
A reaction like J0: A + A -> B has one stoichiometry for A in the reaction J0 (-2), but it comes from two different values (1 and 1). If one or more of those stoichiometries have IDs, things get very complicated very quickly. Hopefully, we can figure out a way to handle this.
First, a design thing: Get/SetValue("stoich(A, J0)") will now always *get* the stoichiometry of the species in the reaction. This might be negative of GetValue("n"), even if 'n' is the stoichiometry value of A, if it's a reactant. This also will hold true for reactions with multiple speciesReferences to the same species.
Also, do better throwing LLVM exceptions (we were getting a lot of 'invalid file' errors that had nothing to do with invalid files).
Need storage for initial stoichiometries, and all the 'multiReactantProduct' stoichiometries before we can start using them.
Also set up some new test cases for the whole thing.
Went back and forth with Claude for ages before finally getting clarity on setting/getting stoichiometries by name ('n') vs. by position ('stoich(S1, J0)'). The upshot is that name will always give you the literal value of that stoichiometry, and by position will always give you the stoichiometry matrix value for the species/reaction combination. So it can be opposite signs for the same root value!
Also, don't throw when getting stoichiometries when conserved moieties have been turned on, only when setting them.
Better name than multiReactantAndOrProduct, also. (And just before doing a ton more with the elements.)
Stores and retrieves and sets the value of stoichiometries that must be combined with other stoichiometries to get the final stoichiometry of a species in a particular reaction (i.e. A + A -> B + 2 B). In particular, when they're named, they get to be manipulated elsewhere in the SBML model, such as with a rate rule or assignment rule, or even with an event assignment or initial assignment.
…with events. This fixes all the SBML Test Suite tests that were failing. In addition, some other tests were deliberately checking to make sure they threw, since we didn't support it. But now we do!
The previous version must have had some sort of slight change? Anyway.
It's now by reaction instead of by species.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
They sort of half-work now; add new tests to more fully check everything.