-
Notifications
You must be signed in to change notification settings - Fork 845
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
bad inchi for chiral S when the molecule is sanitized #296
Comments
It's not purely sanitization; it's one of the cleanup operations that the molfile parser does when it sanitizes: In [17]: m3 = Chem.MolFromMolBlock(mb,sanitize=False)
In [18]: Chem.SanitizeMol(m3)
Out[18]: rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE
In [19]: print Chem.MolToInchi(m3)
InChI=1S/C5H12OS/c1-5(2,3)7(4)6/h1-4H3/t7-/m1/s1
In [20]: m3.Debug()
Atoms:
0 6 C chg: 0 deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
1 6 C chg: 0 deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
2 6 C chg: 0 deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
3 6 C chg: 0 deg: 4 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 0
4 6 C chg: 0 deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
5 8 O chg: 0 deg: 1 exp: 2 imp: 0 hyb: 3 arom?: 0 chi: 0
6 16 S chg: 0 deg: 3 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 1
Bonds:
0 3->0 order: 1 conj?: 0 aromatic?: 0
1 3->1 order: 1 conj?: 0 aromatic?: 0
2 3->2 order: 1 conj?: 0 aromatic?: 0
3 6->3 order: 1 conj?: 0 aromatic?: 0
4 6->4 order: 1 dir: 2 conj?: 0 aromatic?: 0
5 6->5 order: 2 conj?: 0 aromatic?: 0 |
Can be traced back to the bond direction: In [21]: b=m3.GetBondWithIdx(4)
In [22]: b.SetBondDir(Chem.BondDir.NONE)
In [23]: print Chem.MolToInchi(m3)
InChI=1S/C5H12OS/c1-5(2,3)7(4)6/h1-4H3/t7-/m0/s1 |
further proof of this, adding bond wedging fixes the problem: In [35]: Chem.WedgeMolBonds(m1,m1.GetConformer())
In [37]: m1.Debug()
Atoms:
0 6 C chg: 0 deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
1 6 C chg: 0 deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
2 6 C chg: 0 deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
3 6 C chg: 0 deg: 4 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 0
4 6 C chg: 0 deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
5 8 O chg: 0 deg: 1 exp: 2 imp: 0 hyb: 3 arom?: 0 chi: 0
6 16 S chg: 0 deg: 3 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 1
Bonds:
0 3->0 order: 1 conj?: 0 aromatic?: 0
1 3->1 order: 1 conj?: 0 aromatic?: 0
2 3->2 order: 1 conj?: 0 aromatic?: 0
3 6->3 order: 1 dir: 2 conj?: 0 aromatic?: 0
4 6->4 order: 1 conj?: 0 aromatic?: 0
5 6->5 order: 2 conj?: 0 aromatic?: 0
In [38]: print Chem.MolToInchi(m1)
InChI=1S/C5H12OS/c1-5(2,3)7(4)6/h1-4H3/t7-/m1/s1 But this wouldn't be a general fix because molecules built from SMILES still won't have the correct InChI: In [41]: print Chem.MolToSmiles(m2,True)
C[S@@](=O)C(C)(C)C
In [42]: print Chem.MolToInchi(Chem.MolFromSmiles('C[S@@](=O)C(C)(C)C'))
InChI=1S/C5H12OS/c1-5(2,3)7(4)6/h1-4H3/t7-/m0/s1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: