Dear RdKit Users!
Following the tutorial I am trying to use the following function to
automatically make 2D sketches for ligands in PDB format which works
fine
resolution = (350,350)
def draw_mol_from_dir(mol_dir: Path, ouput_dir: Path):
for mol_file in mol_dir.iterdir():
if mol_file.suffix == mol_file_extension:
mol = Chem.MolFromPDBFile(str(mol_file))
if mol:
AllChem.Compute2DCoords(mol)
Draw.MolToFile(mol, Path(ouput_dir, mol_file.stem +
".png"), size=resolution)
else:
print(mol_file, " couldn't be red as molecule by rdkit.")
Now I am trying to customize alitle bit the representation of
molecules using modified function:
def draw_mol_from_dir(mol_dir: Path, ouput_dir: Path):
for mol_file in mol_dir.iterdir():
if mol_file.suffix == mol_file_extension:
mol = Chem.MolFromPDBFile(str(mol_file))
if mol:
AllChem.Compute2DCoords(mol)
print("The portrait of", mol_file.stem, "has been
painted. Go next !")
d = rdMolDraw2D.MolDraw2DCairo(resolution[0], resolution[1])
d.drawOptions().addStereoAnnotation = True
d.drawOptions().addAtomIndices = True
d.DrawMolecule(mol)
d.FinishDrawing()
d.WriteDrawingText(str(Path(ouput_dir, mol_file.stem +
".png")))
else:
print(mol_file, " couldn't be red as molecule by rdkit.")
basically I like more the second representation but I noticed that the
information about the chirality of the ligands is missed (compared to
the first function), even if the addStereoAnnotation = True has been
activated. How I could fix it?
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss