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

EZ isomerism and chirality #39

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

fgrunewald
Copy link
Collaborator

Implementation for storing chirality and E/Z isomers across double bonds.

Chirallity is simply annotated onto the chiral center with the ordering of nodes giving the improper dihedral defining that center. Note that in order to get R/S classification one still needs to correctly interpret the chiral center. For building coordinates it should be enough to take the imporper dihedral angle defined by the atoms and give it a positive value.

E/Z isomers are annotated to the outermost atoms, which define the isomerism. The annotation consists of the 4 atoms that would form a proper dihedral angle whose value is either cis=0 degrees or trans=180 degrees.

Copy link
Owner

@pckroon pckroon left a comment

Choose a reason for hiding this comment

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

Fantastic, just some very small comments.
Could you also update the README on how to interpret the 'stereo' attributes?

pysmiles/read_smiles.py Show resolved Hide resolved
pysmiles/smiles_helper.py Outdated Show resolved Hide resolved
pysmiles/smiles_helper.py Outdated Show resolved Hide resolved
Comment on lines +598 to +602
msg = (f"Chiral node {node} has {n} neighbors, which "
"is different than the four expected for "
"tetrahedral chirality. If the chiral center "
"contains hydrogen you need to set explicit_hydrogen "
"to True.")
Copy link
Owner

Choose a reason for hiding this comment

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

Why can't there be an implicit hydrogen? That would by definition get the lowest priority, IIRC

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's not how the open smiles definition works though; the chirality is not according to R/S but a local reference frame that is arbitrary viewed from the first atom which may or may not have lowest priority

Copy link
Owner

Choose a reason for hiding this comment

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

If one of the neighbor atoms is a hydrogen and is represented as an atomic property of the chiral center (rather than explicitly as [H]), then it is considered to be the first atom in the clockwise or anticlockwise accounting.

So if the smiles is: N[C@H](O)Br, then N=0, H=1, O=2, Br=3. i.e., look along N-C bond, and the rotation is H-O-Br

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No it is actually even more crazy:

N[C@H](O)Br --> here it is H0 N1 O2 Br3
N[C][H](O)Br --> here it is N0 H1 O2 Br3

the text reads:

If one of the neighbor atoms is a hydrogen and is represented as an atomic property of the chiral center (rather than explicitly as [H]), then it is considered to be the first atom in the clockwise or anticlockwise accounting. Now the question is how do we figure that out in the workflow?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, you're right.

Maybe have the central atom with implicit H itself as first "neighbour"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it is best to tag the node when it has the implicit hydrogen def. This does not change the fact that you cannot have implicit hydrogen here. The entire annotation only makes sense for when you have all hydrogen present.

Copy link
Owner

Choose a reason for hiding this comment

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

I still don't understand the "you cannot have implicit hydrogen". To me "implicit" means that the hydrogen is not an explicit node in the graph, but rather a node attribute

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess we should hide this chirality assignment behind a flag, which then requires explicit hydrogen atoms. Basically, the point being that the assignment of node indices makes only sense if these nodes are actually present.

pysmiles/smiles_helper.py Show resolved Hide resolved
pysmiles/smiles_helper.py Outdated Show resolved Hide resolved
pysmiles/smiles_helper.py Outdated Show resolved Hide resolved
pysmiles/smiles_helper.py Outdated Show resolved Hide resolved
@fgrunewald
Copy link
Collaborator Author

@pckroon the current state is that I think it correctly interprets the chirality but there is no way I can figure out how to get an absolute assignment from this, which means it is nice but also useless

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.

None yet

2 participants