feat: add diffModels for structured model comparison - #686
Merged
Conversation
compareMultipleModels and compareRxnsGenesMetsComps report overlap counts and distances; neither says what actually changed between two models. diffModels keys reactions, metabolites and genes by id and, for the ids in both models, compares stoichiometry (within a tolerance), bounds, objective coefficient, grRule, EC codes, and metabolite formula, charge and compartment. It returns an equal flag, a list of human-readable differences, and the id sets present in only one model, with per-category truncation. grRules are compared as logic, not text: each is expanded to DNF and the genes within each isozyme, and the isozymes, are sorted before comparison, so "a and b" equals "b and a". This reuses the grRule parser and is stronger than the case/whitespace string match the Python counterpart uses.
Function test results297 tests 271 ✅ 1m 13s ⏱️ Results for commit 5979f31. |
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.
Main improvements in this PR:
diffModels(modelA, modelB)reports what changed between two models: reaction/metabolite/gene ids present in only one, and for shared ids the differences in stoichiometry (within a tolerance), bounds, objective, grRule, EC codes, and metabolite formula/charge/compartment. Returns anequalflag plus a list of differences. The existing comparison functions only give overlap counts and distances.a and bequalsb and a— by expanding to DNF and sorting, reusing the grRule parser.tComparison.mcovering equality, dropped reactions, bounds, stoichiometry tolerance, order-insensitive grRule equality, and truncation.Instructions on merging this PR:
develop3as target branch, and will be resolved with a squash-merge.