-
Notifications
You must be signed in to change notification settings - Fork 53
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
Output list type field as array of string in Yaml #107
Comments
@Hao-Chalmers
So instead I would suggest a separate function that can convert the |
@Hao-Chalmers As @BenjaSanchez said, the default As alternative, include a parameter in the edit: renamed suggested parameter |
Here are my comments:
|
@Hao-Chalmers it would definetively include extra lines, for instance what is now:
would then be:
|
True, it does. There won't be many though :-) |
@BenjaSanchez I understand you want to follow the cobrapy standard but the origin of this issue was because an inconsistency with the "subsystem" field in a reaction. It is defined as type string in JSON/Yaml cobrapy scheme whereas models like YEAST may have reactions with list of subsystems (which can makes sense). The problem with annotation fields like 'ec-code' is different. I am not sure you are going to lose compatibility with cobrapy since annotation is defined as 'object'. IMO if multiple values for an annotation field is expected it should always be defined as list, it will simplify automatic parsing. Moreover, if extra lines is a problem, lists can also be represented in an abbreviated form:
can be:
I also suggest to systematically double-quote strings for some of the fields, the current YAML export of HMR model cannot be properly parsed because of some metabolite's names includes YAML syntax e.g. '-['. |
@pecholleyc Also, as mentioned above, there is no problem to have an alternative output from writeYaml, but let's keep the default output cobrapy compatible. As suggested, you can specify a parameter |
@Hao-Chalmers actually they would be many new lines: the |
@edkerk A similar issue has been proposed in cobrapy repo for adjustment in implementation. Let's see how it proceeds. @BenjaSanchez There won't be much differences with whether 82,202 or 74,394 lines, because both could not be managed by human eyes. And there would be no difference for digital storage. The optional |
The JSON/Yaml formats appear to be very useful in GEM curation, exchange and other things, among which one application is for visualization purpose. Now Yaml has been used as input for Metabolic Atlas website development.
However, the current writeYaml function treats the 'list' type fields (e.g. eccodes,subSystems) differently. It outputs the value as string when there is only one element, but output into array of string when there are multiple elements. This inconsistence causes problems when loading the file to public Yaml parser (such as in python), because the information cannot be correctly extracted if some elements have on value and others have multiple. Now this issue has been addressed in this branch: 81be856.
The text was updated successfully, but these errors were encountered: