Reputation: 103
I'm working with this molecule found in the the pdb database. https://pubchem.ncbi.nlm.nih.gov/compound/65106
When I go to use the MoltoSMILES module, I'm not getting anything in return, or it seems to inconsistent. Here is my code I use in Jupyter Notebook. Another issue I'm having is minor, but I'd like to use Spyder. I notice the figure never draws in Spyder so I switched to Jupyter. Anyways, here is the code, and I'll show differnt SMILES formats I've either found of generated:
#%% Modules
import pandas as pd
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Draw
from rdkit.Chem import rdDepictor
from rdkit.Chem import PandasTools
IPythonConsole.ipython_useSVG=True
from rdkit.Chem import rdRGroupDecomposition
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.warning')
import rdkit
print(rdkit.__version__)
#%% Create Chlorin Scaffold
scaffold=Chem.MolFromSmiles('C1CC2=NC1=CC3=CC=C(N3)C=C4C=CC(=N4)C=C5C=CC(=C2)N5')
scaffold
I have also tried a couple of other SMILES strings I found in the pdb database, wikipedia, and that I've generated with OpenBable. Here they are:
C1CC2=NC1=CC3=CC=C(N3)C=C4C=CC(=N4)C=C5C=CC(=C2)N5
C(N1)(/C=C2N=C(C=C\2)/C=C3N/C(C=C\3)=C\4)=CC=C1/C=C5CCC4=N/5
[nH]1/c/2=C\C3=N/C(=C\c4ccc([nH]4)/C=C\4/C=CC(=N4)/C=c\1/cc2)/C=C3
None of them return the correct drawing. I'm not sure how to fix this. Is there a preference to SMILES format that RDKit expects? I'd mention that the bonding and atoms are correct, but the final shape is the only thing that's wrong.
Here's the image of what I would expect to see:
Thank you,
Upvotes: 1
Views: 866
Reputation: 1869
Let RDKit compute 2D coordinates and use the CoordGen library.
from rdkit import Chem
from rdkit.Chem import rdDepictor
rdDepictor.SetPreferCoordGen(True)
from rdkit.Chem.Draw import IPythonConsole
smiles = 'C1CC2=NC1=CC3=CC=C(N3)C=C4C=CC(=N4)C=C5C=CC(=C2)N5'
scaffold = Chem.MolFromSmiles(smiles)
rdDepictor.Compute2DCoords(scaffold)
To use Spyder, type scaffold
in the console after you executed the code.
Upvotes: 1