Skip to content

writeYAMLmodel: YAML 1.1 booleans such as NO are written unquoted #10

Closed

Description

@edkerk

needsQuote in src/io/writeYAMLmodel.m quotes the YAML 1.2 booleans (true, True, TRUE, false, False, FALSE) but not the YAML 1.1 ones. A metabolite named NO (nitric oxide) is therefore written as

- name: NO
- formula: NO

and a YAML 1.1 loader such as PyYAML reads both values as False:

>>> yaml.safe_load("- name: NO")
[{'name': False}]

Human-GEM's model/Human-GEM.yml has this for MAM02609c and MAM02609e. It also has formula: Y (MAM02022) and 212 compartment: n values. PyYAML reads y and n as strings, but they are booleans in the YAML 1.1 spec.

Proposal: also quote y, n, yes, no, on and off in any case. raven-toolbox ports this function and has the same gap; it is fixed there in CompMetEng/raven-toolbox#179 (issue CompMetEng/raven-toolbox#178), so that both writers keep writing the same bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions