Repository navigation
Read a metabolite SMILES annotation whatever shape it is in - #56
Merged
Merged
Conversation
cobra returns an annotation value as the object it was assigned, and as a list for a model read back from a file. A metabolite annotated in memory by find_met_smiles carries "CCO"; the same metabolite after save_ec_model + load_ec_model carries ["CCO"]. extract_enzyme_substrate_pairs -- which both write_dlkcat_input and the OpenKineticsPredictor input builder go through -- assumed the string. On a reloaded model the ignore-list membership test hashed a list and the whole step died with TypeError, and had it not, the list would have been written into the DLKcat input in place of the SMILES. The tutorial does not hit this because it annotates and writes in one session, but it documents reloading from the saved stage-1 model between those steps, which is enough to reach it. databases.met_smiles reads either shape and is the one place that knows the difference.
`parse_okp_output`: indexing metabolites by `annotation['smiles']` used the annotation value as a dict key, which raises `TypeError: cannot use 'list' as a dict key` on a saved-and-reloaded model, the same shape mismatch `met_smiles` already handles for the DLKcat input writer.
…ion-round-trip # Conflicts: # CHANGELOG.md
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.
cobra returns an annotation value as the object it was assigned, and as a list for a model read back from a file. A metabolite annotated in memory by
find_met_smilescarries"CCO"; the same metabolite aftersave_ec_model+load_ec_modelcarries["CCO"].extract_enzyme_substrate_pairs— which bothwrite_dlkcat_inputand the OpenKineticsPredictor input builder go through — assumed the string:On a reloaded model that raises
TypeError: cannot use 'list' as a set element (unhashable type: 'list'), and had it not, the list would have been written into the DLKcat input in place of the SMILES.Reproduced on the full_ecModel tutorial: save the stage-1 model after
find_met_smiles, reload it, callwrite_dlkcat_input— TypeError. The tutorial itself does not hit it because it annotates and writes in one session, but it documents reloading from the saved model between those steps.databases.met_smilesnow reads either shape and is the one place that knows the difference. Two regression tests cover the list-valued annotation: that the SMILES still reaches the output, and that the ignore-list check still matches.Found while benchmarking something unrelated, where it silently degraded structure-based substrate matching to name-only matching rather than raising.