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('CCCCCCCCCCCCCCCCC(=O)OCCO', sanitize=False)
>>> AllChem.Compute2DCoords(m)
I got
****
Pre-condition Violation
getNumImplicitHs() called without preceding call to calcImplicitValence()
Violation occurred on line 170 in file
/home/yf1/software/RDKit/install_version/latest/Code/GraphMol/Atom.cpp
Failed Expression: d_implicitValence>-1
****
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: Pre-condition Violation
On Wed, Feb 19, 2014 at 3:27 PM, Yingfeng Wang <ywang...@gmail.com> wrote:
> 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):
> File "<stdin>", line 1, in <module>
> Boost.Python.ArgumentError: Python argument types in
> rdkit.Chem.rdDepictor.Compute2DCoords(NoneType)
> did not match C++ signature:
> Compute2DCoords(RDKit::ROMol {lvalue} mol, bool canonOrient=True, bool
> clearConfs=True, boost::python::dict {lvalue} coordMap={}, unsigned int
> nFlipsPerSample=0, unsigned int nSample=0, int sampleSeed=0, bool
> permuteDeg4Nodes=False, double bondLength=-1.0)
>
>
> Actually, "ccc[nH]c" is a fragment. Could you please help me to know
> whether there is a work around to this case?
>
> Thanks.
>
> Yingfeng
>
>
>
>
> On Mon, Feb 17, 2014 at 2:58 PM, Yingfeng Wang <ywang...@gmail.com> wrote:
>
>> Adrian,
>>
>> Thanks, it works.
>>
>> Yingfeng
>>
>>
>> On Mon, Feb 17, 2014 at 12:50 PM, Adrian Jasiński <
>> jasinski.adr...@gmail.com> 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.Compute2DCoords(m)>>>
>>> >>> from rdkit.Chem import Draw>>>
>>> >>> Draw.MolToFile(ms[0],'images/cdk2_mol1.png')>>>
>>> >>> Draw.MolToFile(ms[1],'images/cdk2_mol2.png')
>>>
>>>
>>> for this example with you pasted you can just write mol to file:
>>>
>>>
>>> >>> from rdkit.Chem import AllChem
>>>
>>>
>>>
>>> >>> from rdkit import Chem
>>> >>> m = Chem.MolFromSmiles('c1nccc2n1ccc2')
>>>
>>> >>> AllChem.Compute2DCoords(m)
>>>
>>> Draw.MolToFile(m,'example.png')
>>>
>>>
>>>
>>>
>>>
>>> pozdrawiam
>>> Adrian Jasiński
>>>
>>>
>>> 2014-02-17 18:34 GMT+01:00 Yingfeng Wang <ywang...@gmail.com>:
>>>
>>>> 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.Compute2DCoords(m)
>>>> 0
>>>> >>> template = Chem.MolFromSmiles('c1nccc2n1ccc2')
>>>> >>> AllChem.Compute2DCoords(template)
>>>> 0
>>>> >>> AllChem.GenerateDepictionMatching2DStructure(m,template)
>>>> >>>
>>>>
>>>>
>>>> However, I got nothing. I am wondering what the correct way is to
>>>> generate the 2D figure of "c1nccc2n1ccc2". Thanks.
>>>>
>>>> Yingfeng
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Managing the Performance of Cloud-Based Applications
>>>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>>>> Read the Whitepaper.
>>>>
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
>>>> _______________________________________________
>>>> Rdkit-discuss mailing list
>>>> Rdkit-discuss@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss