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

AddBond() fails in RDKit 2020 #21

Open
ljn917 opened this issue Aug 3, 2020 · 0 comments
Open

AddBond() fails in RDKit 2020 #21

ljn917 opened this issue Aug 3, 2020 · 0 comments

Comments

@ljn917
Copy link
Contributor

ljn917 commented Aug 3, 2020

The new rdkit 2020.03 has stricter bond checks (maybe incorrect) and the code to merge molecules fails and gives the following error. A temporary workaround is to use ReplaceBond() instead of AddBond().

>>> from rdchiral.main import *
>>> rdchiralRunText("([#16;a:3]:[c:4]:[c:5](:[#7;a:6])-[CH2;D2;+0:7]-[CH2;D2;+0:8]-[c:9].[NH2;D1;+0:1]-[c:2])>>O=[N+;H0;D3:1](-[O-])-[c:2].[#16;a:3]:[c:4]:[c:5](:[#7;a:6])/[CH;D2;+0:7]=[CH;D2;+0:8]\\[c:9]", "[CH3:1][C:2](=[O:3])[NH:4][c:5]1[n:6][c:7]([CH2:21][CH2:22][c:23]2[cH:24][cH:25][c:26]([NH2:29])[cH:27][cH:28]2)[c:8]([CH2:10][c:11]2[cH:12][cH:13][cH:14][c:15]([S:17]([CH3:18])(=[O:19])=[O:20])[cH:16]2)[s:9]1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ljn/lab_jensen/rdchiral/rdchiral/main.py", line 94, in rdchiralRunText
    return rdchiralRun(rxn, reactants, **kwargs)
  File "/home/ljn/lab_jensen/rdchiral/rdchiral/main.py", line 261, in rdchiralRun
    merged_mol.GetBondBetweenAtoms(
RuntimeError: Pre-condition Violation
	Stereo atoms should be specified before specifying CIS/TRANS bond stereochemistry
	Violation occurred on line 288 in file /usr/local/rdkit/include/rdkit/GraphMol/Bond.h
	Failed Expression: what <= STEREOE || getStereoAtoms().size() == 2
	RDKIT: 2020.03.4
	BOOST: 1_67

ReplaceBond() workaround, replace the code between line 259-266 with

                        merged_mol.AddBond(merged_map_to_id[bi],
                            merged_map_to_id[bj], BondType.UNSPECIFIED)
                        idx = merged_mol.GetBondBetweenAtoms(
                            merged_map_to_id[bi], merged_map_to_id[bj]
                        ).GetIdx()
                        merged_mol.ReplaceBond(idx, b)
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

1 participant