Re: [Rdkit-discuss] generate 2D figure

2014-02-20 Thread Greg Landrum
Yingfeng, This is a somewhat advanced topic. You need to do a partial sanitization. There's some info here: http://nbviewer.ipython.org/gist/greglandrum/4316433 -greg On Thu, Feb 20, 2014 at 2:44 PM, Yingfeng Wang wrote: > Adrian, > > Thanks. Actually, 'c1cc[nH]c1' is a fragment. I have a ar

Re: [Rdkit-discuss] generate 2D figure

2014-02-20 Thread Yingfeng Wang
Adrian, Thanks. Actually, 'c1cc[nH]c1' is a fragment. I have a aromatic molecule, and break one ring bond. RDKit returns the Smiles format of the fragment. And I want to draw this fragment. In this case, it is 'c1cc[nH]c1'. So I am wondering whether there is a way to draw this kind of fragments.

Re: [Rdkit-discuss] generate 2D figure

2014-02-20 Thread Adrian Jasiński
m = Chem.MolFromSmiles('ccc[nH]c', sanitize=False) I think that in this example there is a problem with your SMILES. Why you use lower case? In SMILES format it's a aromatic molecule but you don't have the beginning and ending of aromatic bond noted by number. If you have aromatic molecule you sho

Re: [Rdkit-discuss] generate 2D figure

2014-02-19 Thread Yingfeng Wang
Here are more details. If I use m = Chem.MolFromSmiles('ccc[nH]c', sanitize=False) AllChem.Compute2DCoords(m) It works. But I get trouble with >>> m = Chem.MolFromSmiles('C(=O)OCCO', sanitize=False) >>> AllChem.Compute2DCoords(m) I got Pre-condition Violation getNumImplic

Re: [Rdkit-discuss] generate 2D figure

2014-02-19 Thread Yingfeng Wang
Adrian, I meet a weird case. >>> import matplotlib.offsetbox >>> from rdkit import Chem >>> from rdkit.Chem import AllChem >>> from rdkit.Chem import Draw >>> m = Chem.MolFromSmiles('ccc[nH]c') I got non-ring atom 0 marked aromatic >>> AllChem.Compute2DCoords(m) Traceback (most recent call last)

Re: [Rdkit-discuss] generate 2D figure

2014-02-17 Thread Yingfeng Wang
Adrian, Thanks, it works. Yingfeng On Mon, Feb 17, 2014 at 12:50 PM, Adrian Jasiński wrote: > If you read all from tutorial you will find a example: > > >>> suppl = Chem.SDMolSupplier('data/cdk2.sdf')>>> ms = [x for x in suppl if > >>> x is not None]>>> for m in ms: tmp=AllChem.Compute2DCoor

Re: [Rdkit-discuss] generate 2D figure

2014-02-17 Thread Adrian Jasiński
If you read all from tutorial you will find a example: >>> suppl = Chem.SDMolSupplier('data/cdk2.sdf')>>> ms = [x for x in suppl if x >>> is not None]>>> for m in ms: tmp=AllChem.Compute2DCoords(m)>>> from >>> rdkit.Chem import Draw>>> Draw.MolToFile(ms[0],'images/cdk2_mol1.png')>>> >>> Draw.Mo

[Rdkit-discuss] generate 2D figure

2014-02-17 Thread Yingfeng Wang
I want to draw a 2D figure of a compound. And I follow the example given at the following link, http://www.rdkit.org/docs/GettingStartedInPython.html My code is given as follows, >>> from rdkit.Chem import AllChem >>> from rdkit import Chem >>> m = Chem.MolFromSmiles('c1nccc2n1ccc2') >>> AllChem