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

Canonicalisation of Reactions from ReactionEquation #10

Open
A-Thakkar opened this issue Sep 9, 2022 · 1 comment
Open

Canonicalisation of Reactions from ReactionEquation #10

A-Thakkar opened this issue Sep 9, 2022 · 1 comment

Comments

@A-Thakkar
Copy link
Member

Related to https://github.com/rxn4chemistry/rxn-chemutils/issues/8

proposal to add canonicalisation and removal of atom mapping as arguments to the to_string method of ReactionEquation
reaction.to_string(canonicalise=True, remove_atom_mapping=True)

@avaucher
Copy link
Member

avaucher commented Sep 9, 2022

My personal choice would be not to do that. A few points of explanation:

  • I see the conversion to string, the canonicalization, and the removal of atom mapping as three distinct things. To me the to_string function should really be about that: the conversion to a string. [PS1]
  • This would raise the question of adding it to all the reaction-to-string conversions, i.e. also the one with extended SMILES
  • I try to avoid confusion by keeping the number of arguments small
  • Linked to the last point: this may lead to other potential arguments such as sorting, removal of duplicates, etc.

Having said that, I am more open to having an external function doing multiple of those if needed. Something along the lines of cleanup_reaction(reaction_equation)? Here I would prefer to work on the reaction equation as on the str, as it is compatible with extended SMILES for instance. Also, I tend to prefer free non-member functions when possible.

What are your thoughts on this?

[PS1]: following up on the arguments with free functions and other kinds of strings, I was already tempted a few times to remove to_string from the ReactionEquation class 😉

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

No branches or pull requests

2 participants