Skip to content
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

Fix: Make all non-transport/exchange pyrophosphate reactions irreversible #557

Merged
merged 3 commits into from
May 17, 2023
Merged

Conversation

Devlin-Moyer
Copy link
Collaborator

@Devlin-Moyer Devlin-Moyer commented May 8, 2023

Main improvements in this PR:

Makes all reversible non-transport/exchange reactions that involve pyrophosphate (MAM02759e/c/m/x/n/r) irreversible in the direction of pyrophosphate production, as discussed in #527. In cases where pyrophosphate is currently a “reactant,” products and reactants are swapped to ensure no reactions are constrained to only have fluxes <= 0.

I hereby confirm that I have:

  • Tested my code on my own computer for running the model
  • Selected develop as a target branch
  • Any removed reactions and metabolites have been moved to the corresponding deprecated identifier lists

@Devlin-Moyer
Copy link
Collaborator Author

Oh dang; I used Cobrapy's built-in function for saving models in YAML format, but it appears to have not used the format your automated format checker was expecting

@haowang-bioinfo
Copy link
Member

haowang-bioinfo commented May 9, 2023

looks good

I'm afraid the effect of these changes needs to be checked with verification and essentiality tests that are under construction, will come back as soon as possible

@haowang-bioinfo
Copy link
Member

Oh dang; I used Cobrapy's built-in function for saving models in YAML format, but it appears to have not used the format your automated format checker was expecting

actually is considering to fix the compatibility to cobrapy, any ideas in improving this?

@Devlin-Moyer
Copy link
Collaborator Author

Devlin-Moyer commented May 9, 2023

Cobrapy uses ruamel.yaml to generate their YAML files. I'm not certain if these are all of the differences, but:

  • Cobrapy's YAML files don't have the header section that yours does
  • Cobrapy's YAML files don't quote all character/text/non-numeric fields by default, while yours do (without the quotes, your automated validation bot kept interpreting the "formula" entires for nitrous oxide (NO) metabolites as if they were supposed to be True/False and telling me it couldn't interpret "NO" as either "True" nor "False")
  • Cobrapy's YAML files use two spaces for each level of indentation, but yours have 2 spaces for the first level, 4 spaces for the second, 2 for the third, etc.
  • Cobrapy's YAML files have a separate "id" section (for the model id) at the "root" level (i.e. the same level as the metabolites, reactions, genes, and compartments)
  • Cobrapy's YAML files seem to wrap/split lines that are over 80 characters across multiple lines, which only seemed to affect metabolites with long names and reactions with long gene_reaction_rules (also your automated validation bot never flagged that as an issue)

I suspect that the biggest issues are the contents of the header and the quotes around metabolite formulas; I think fixing the header problem would require changes on Cobrapy's end, because, as far as I can tell, most of the information you have in the header of your YAML file isn't in a Cobrapy YAML file at all. The other things seem like things you could probably tweak with your YAML validation thing to accommodate, but I'm not entirely sure how it works.

Also it may be worth noting that Cobrapy had no problem reading in Human-GEM.yml, as far as I could tell

@mihai-sysbio
Copy link
Member

While I realise it is more cumbersome, SBML is a more robust file format for using the model across different tools/platforms.

@haowang-bioinfo
Copy link
Member

it may be worth noting that Cobrapy had no problem reading in Human-GEM.yml, as far as I could tell

yes, the reading was fixed early on; now probably is time to resolve writing side

Cobrapy's YAML files don't have the header section that yours does
Cobrapy's YAML files don't quote all character/text/non-numeric fields by default, while yours do (without the quotes, your automated validation bot kept interpreting the "formula" entires for nitrous oxide (NO) metabolites as if they were supposed to be True/False and telling me it couldn't interpret "NO" as either "True" nor "False")
Cobrapy's YAML files use two spaces for each level of indentation, but yours have 2 spaces for the first level, 4 spaces for the second, 2 for the third, etc.
Cobrapy's YAML files have a separate "id" section (for the model id) at the "root" level (i.e. the same level as the metabolites, reactions, genes, and compartments)
Cobrapy's YAML files seem to wrap/split lines that are over 80 characters across multiple lines, which only seemed to affect metabolites with long names and reactions with long gene_reaction_rules (also your automated validation bot never flagged that as an issue)

thanks for listing the details

I suspect that the biggest issues are the contents of the header and the quotes around metabolite formulas; I think fixing the header problem would require changes on Cobrapy's end, because, as far as I can tell, most of the information you have in the header of your YAML file isn't in a Cobrapy YAML file at all. The other things seem like things you could probably tweak with your YAML validation thing to accommodate, but I'm not entirely sure how it works.

the quote issue is technically solvable, while header section actually is the tricky part

@haowang-bioinfo
Copy link
Member

I realise it is more cumbersome, SBML is a more robust file format for using the model across different tools/platforms.

yes SBML is a mess

@mihai-sysbio
Copy link
Member

would require changes on Cobrapy's end

This might be the better solution in more than one case.

@haowang-bioinfo
Copy link
Member

I'm afraid the effect of these changes needs to be checked with verification and essentiality tests that are under construction, will come back as soon as possible

@Devlin-Moyer would you be able to merge the latest develop branch into this PR, or start a new PR from the latest develop to add the commits (then close this PR). The idea is to make sure that these changes won't break the model

Copy link
Member

@haowang-bioinfo haowang-bioinfo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice - significant progress in improving thermodynamic constrains!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants