-
... although from rdkit.Chem import AllChem as Chem
from rdkit.Chem import rdMolAlign
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
import rdkit
rdkit.__version__
# -> '2023.03.1'
smi_core = "Cn2ccc1ccccc12"
smi_mol = "Cn2cc(CC(N)=O)c1ccccc12"
core = Chem.MolFromSmiles(smi_core)
mol = Chem.MolFromSmiles(smi_mol)
mol.HasSubstructMatch(core)
# -> True
core.Compute2DCoords()
mol.Compute2DCoords()
mh = Chem.AddHs(mol)
mh.HasSubstructMatch(core)
# -> True
rdMolAlign.AlignMol(mh, core)
# ->
# RuntimeError Traceback (most recent call last)
# ----> 1 rdMolAlign.AlignMol(mh, core)
# RuntimeError: No sub-structure match found between the probe and query mol Any ideas? KR Axel |
Beta Was this translation helpful? Give feedback.
Answered by
apahl
Mar 22, 2024
Replies: 3 comments 3 replies
-
rdMolAlign.AlignMol(core , mh) is working ... why ?
Le jeu. 21 mars 2024 à 15:14, Axel Pahl ***@***.***> a écrit :
… ... although HasSubstructMatch says there is one:
from rdkit.Chem import AllChem as Chemfrom rdkit.Chem import rdMolAlignfrom rdkit.Chem import Drawfrom rdkit.Chem.Draw import IPythonConsole
from IPython.core.interactiveshell import InteractiveShellInteractiveShell.ast_node_interactivity = "all"
import rdkitrdkit.__version__# -> '2023.03.1'
smi_core = "Cn2ccc1ccccc12"smi_mol = "Cn2cc(CC(N)=O)c1ccccc12"core = Chem.MolFromSmiles(smi_core)mol = Chem.MolFromSmiles(smi_mol)mol.HasSubstructMatch(core)# -> True
core.Compute2DCoords()mol.Compute2DCoords()mh = Chem.AddHs(mol)mh.HasSubstructMatch(core)# -> True
rdMolAlign.AlignMol(mh, core)# -># RuntimeError Traceback (most recent call last)# ----> 1 rdMolAlign.AlignMol(mh, core)# RuntimeError: No sub-structure match found between the probe and query mol
Any ideas?
KR Axel
—
Reply to this email directly, view it on GitHub
<#7285>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJBWYUFOSABJDVMJ7ZMB7TYZLTMJAVCNFSM6AAAAABFBRKHWSVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZWGQYDIMZSGY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
No Axel, I don't understand why the inverse is working...
Le jeu. 21 mars 2024 à 21:49, Axel Pahl ***@***.***> a écrit :
… Are you saying that I am calling the function with the wrong argument
order? But I want mh to be aligned to core and the documentation says the
first argument is the one that gets aligned.
—
Reply to this email directly, view it on GitHub
<#7285 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJBWYUZ24FINJYHKYG3Q3DYZNBUNAVCNFSM6AAAAABFBRKHWSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DQNZQHA2DG>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
-
Great!
Le ven. 22 mars 2024 à 09:17, Axel Pahl ***@***.***> a écrit :
… But indeed, creating an atom map does work. So thank you anyway for
pointing me into the right direction.
smi_core = "Cn2ccc1ccccc12"smi_mol = "Cn2cc(CC(N)=O)c1ccccc12"
core = Chem.MolFromSmiles(smi_core)mol = Chem.MolFromSmiles(smi_mol)
core_match = tuple(x.GetIdx() for x in core.GetAtoms())mol_match = mol.GetSubstructMatch(core)assert len(core_match) == len(mol_match), "Number of matching atoms is different."atom_map = list(zip(mol_match, core_match))
core.Compute2DCoords()mol.Compute2DCoords()
rdMolAlign.AlignMol(mol, core, atomMap=atom_map)
KR Axel
—
Reply to this email directly, view it on GitHub
<#7285 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJBWYU32VYYG5IPM5D2VHTYZPSJ3AVCNFSM6AAAAABFBRKHWSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DQNZVGA2DS>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But indeed, creating an atom map does work. So thank you anyway for pointing me into the right direction.
KR Axel