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.

Again, thank you very much for your help.

Yingfeng


On Thu, Feb 20, 2014 at 7:09 AM, Adrian Jasiński
<jasinski.adr...@gmail.com>wrote:

> 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 should write it like that:
>
> >>>> m = Chem.MolFromSmiles('c1cc[nH]c1')
>
> if it is not aromatic than use upper case:
> >>>> m = Chem.MolFromSmiles('CCC[NH]C')
> and than try:
> >>>> AllChem.Compute2DCoords(m)
>
> for second example:
> >>>> m = Chem.MolFromSmiles('CCCCCCCCCCCCCCCCC(=O)OCCO')
> >>>> AllChem.Compute2DCoords(m)
>
>
>
> 2014-02-19 21:46 GMT+01:00 Yingfeng Wang <ywang...@gmail.com>:
>
> 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

Reply via email to