Repository navigation
writeYAMLmodel: nest ec-rxns enzymes; printOrange: print \n as line break - #751
Merged
Merged
Conversation
Each ec-rxns entry writes its enzymes as an !!omap under "- enzymes", but the enzyme lines were written at the same indentation as that key. readYAMLmodel does not look at indentation and reads them back, but a YAML parser sees an empty "enzymes" mapping followed by sibling keys: ruamel.yaml, as used by raven-toolbox and geckopy, fails with "'ScalarNode' object has no attribute 'flow_style'", so no ecModel saved by GECKO 4 could be opened in Python. The lines are now indented two spaces deeper, like the metabolite coefficients under "- metabolites". Tested by re-saving the GECKO full_ecModel tutorial's stage-2 ecModel: RAVEN reads it back with identical rxnEnzMat and kcat, and geckopy now loads it (4834 ec reactions, same maximum growth as in MATLAB).
printOrange prints its text with fprintf('%s',...) so that a "%" in
model text is not read as a format directive. That also stopped "\n"
from being expanded, and every caller that ends a message or breaks a
line with "\n" printed a literal backslash-n instead: 15 calls in RAVEN
and 17 in GECKO, including GECKO 4's backward-compatibility notice.
printOrange now turns "\n" into a line break; no other escape sequence
or format directive is interpreted.
Function test results390 tests 351 ✅ 1m 28s ⏱️ Results for commit 3cbe5c1. |
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.
Two issues found while running GECKO 4's full_ecModel tutorial against RAVEN 3.0.0b1 (see SysBioChalmers/GECKO#481 and CompMetEng/geckopy#54).
writeYAMLmodel: ec-rxns enzymes are not nested under their keyEach
ec-rxnsentry writes its enzyme stoichiometry as an!!omapunder- enzymes, but the enzyme lines were written at the same indentation as that key:readYAMLmodelignores indentation and reads this back correctly. A YAML parser, however, sees an emptyenzymesmapping. ruamel.yaml, as used by raven-toolbox and geckopy, fails with'ScalarNode' object has no attribute 'flow_style', so no ecModel saved from GECKO 4 can be opened in geckopy. The enzyme lines are now two spaces deeper, as the coefficients under- metabolitesalready are.Verification:
rxnEnzMatandkcat.printOrange:\nprinted literallySince
printOrangeprints viafprintf('%s', …)so that a%in model text is not treated as a format directive,\nis no longer expanded either. Callers that end a message with\nprint a literal backslash-n with no line break: 15 calls in RAVEN and 17 in GECKO, including GECKO 4's backward-compatibility notice:printOrangenow turns\ninto a line break; no other escape sequence or format directive is interpreted, so%still prints as-is. All callers in both repositories use only\n.Tests
develop3and passing here:tIO/writeReadYAMLNestsEcRxnEnzymes(indentation plus round trip ofec.enzymes/rxnEnzMat) andtUtils/printOrangeExpandsNewlineWhenPrinting.tIOandtUtilspass locally (MATLAB 2024b); the twoparallelWorkersRAVENtests are filtered by their assumptions on this machine, as before.