Replies: 1 comment 1 reply
-
These lines are changing your atom orders (canonicalization can changes indices)
Note that a "Chem.RWMol" is a valid molecule, so making the following change fixes your issue:
Hope this helps. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My question is similar to this issue but perhaps broader in scope. I am generating molecules as 2D graphs, meaning with a permutation equivariant model producing atoms/bonds in an arbitrary order. I would like to add chiral tags to this graph structure in a consistent way since I need to compare the molecule to a ground truth example and I need the two to match.
From the issue linked above I understand that the chiral tags in rdkit are dependent on bond orders and that there is no straightforward way around this. Based on this I thought of the following two solutions: 1) enforce some canonicalization before adding the chiral tags, 2) define a canonical form using the CIP algorithm. I tried the first approach but it turns out it's not possible because chiral tags change the order of bonds/atoms. Here is an example to illustrate:
Basically the issue with canonicalization is that there is no way to use the canonical smiles order while keeping track of where the chiral tag should be put (and the canonicalization is different with and without chiral tags). The second option is to use an approach similar to what @greglandrum proposed in this notebook but with CIP weights replacing neighboring atom index. Is it possible to get CIP weights using some rdkit functions?
Any other feedback/approaches are more than welcome.
Beta Was this translation helpful? Give feedback.
All reactions