You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, below is some code that works for most molecules, but struggles to align the included query_smiles
from rdkit import Chem
from rdkit.Chem import rdDepictor, rdCoordGen, AllChem
query_smiles = "Cn1cnc(CN2CC(C(N)=O)CCC2=O)c1-c1ncccn1"
template_mol_block = """
Ketcher 12192413482D 1 1.00000 0.00000 0
8 8 0 0 0 0 0 0 0 0999 V2000
10.7840 -3.9992 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
10.7840 -4.9992 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
11.6500 -5.4992 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
12.5160 -4.9992 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
12.5160 -3.9992 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
11.6500 -3.4992 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
11.6500 -2.4992 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
9.9180 -3.4992 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 6 1 0 0 0
1 2 1 0 0 0
2 3 1 0 0 0
3 4 1 0 0 0
4 5 1 0 0 0
5 6 1 0 0 0
6 7 2 0 0 0
1 8 1 0 0 0
M END
"""
mol = Chem.MolFromSmiles(query_smiles)
template = Chem.MolFromMolBlock(template_mol_block)
# first scale the template, usually defined by a molV3000
# scales to RDKit default size
rdDepictor.NormalizeDepiction(template, canonicalize=0)
# we now do the same for mol
# but need to compute 2D coords first since came from SMILES
AllChem.Compute2DCoords(mol)
rdDepictor.NormalizeDepiction(mol, canonicalize=0)
# now do the alignment
AllChem.GenerateDepictionMatching2DStructure(mol, template, acceptFailure=True)
gives the following: template:
mol
(note the flipped orientation relative to the desired template orientation)
For examples of mols that align correctly, simply replace query_smiles above with one of the following SMILES: "NC(=O)C1CCC(=O)N(Cc2cnn(-c3ccccn3)n2)C1" "NC(=O)C1CCC(=O)N(Cc2cn(C3CCS(=O)(=O)CC3)nn2)C1"
(which match the desired template orientation)
rdkit version: 2023.09.4
The text was updated successfully, but these errors were encountered:
Hi, below is some code that works for most molecules, but struggles to align the included
query_smiles
gives the following:
template
:mol
(note the flipped orientation relative to the desired template orientation)
For examples of mols that align correctly, simply replace
query_smiles
above with one of the following SMILES:"NC(=O)C1CCC(=O)N(Cc2cnn(-c3ccccn3)n2)C1"
"NC(=O)C1CCC(=O)N(Cc2cn(C3CCS(=O)(=O)CC3)nn2)C1"
(which match the desired template orientation)
rdkit version:
2023.09.4
The text was updated successfully, but these errors were encountered: