Dear Greg,

I update the version of RDKit by git. And it works as you described, like

>>> from rdkit import Chem
>>> from rdkit.Chem import Descriptors
>>> m
=Chem.MolFromInchi('InChI=1S/C10H9N3O/c1-7-11-10(14)9(13-12-7)8-5-3-2-4-6-8/h2-6H,1H3,(H,11,12,14)')
>>> em = Chem.EditableMol(m)
>>> em.RemoveBond(8,7)
>>> nm = em.GetMol()
>>> frags = Chem.GetMolFrags(nm,asMols=True,sanitizeFrags=False)
>>> from rdkit.Chem import AllChem
>>> [AllChem.CalcMolFormula(x) for x in frags]
['C4H4N3O', 'C6H5']
>>> [Descriptors.ExactMolWt(x) for x in frags]
[110.035436748, 77.03912516]

But with inchi format

>>> [Chem.MolToInchi(x) for x in frags]
['InChI=1S/C4H5N3O/c1-3-6-4(8)2-5-7-3/h2H,1H3,(H,6,7,8)',
'InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H']


it is still "C6H6" not "C6H5".

Actually, I need the 2D structure of fragments of "C6H5" (not necessary
inchi format data). Is there a way to retrieve this information? Right now,
a solution in my mind could be to retrieve the 2D information of the
original compound (in my example, it's m) first. Then identify the removing
bonds (in my example, it's Bond(8,7)). Finally, I can get 2D information of
fragments. Could you please let me know whether there is a better solution
to get 2D information of fragments?

Thanks.

Yingfeng




On Sun, Jun 2, 2013 at 8:39 AM, Yingfeng Wang <[email protected]> wrote:

> Dear Greg,
>
> Thank you very much! I think 'C6H5' is good enough to me.
>
> Yingfeng
>
>
> On Sun, Jun 2, 2013 at 12:25 AM, Greg Landrum <[email protected]>wrote:
>
>>
>> On Sat, Jun 1, 2013 at 6:46 AM, Yingfeng Wang <[email protected]> wrote:
>>
>>> Dear Greg,
>>>
>>> Thanks.
>>>
>>> As for
>>> In [19]: frags = Chem.GetMolFrags(nm,asMols=True)
>>> In [20]: [AllChem.CalcMolFormula(x) for x in frags]
>>> Out[20]: ['C4H5N3O', 'C6H6']
>>>
>>> Is it possible to directly get 'C6H5+' instead of 'C6H6'?
>>>
>>
>> You can't get C6H5+, because there's not really any way for the code to
>> know here to assign charges if you just call break bonds, but as of this
>> morning (I just committed it) you can tell the RDKit not to sanitize the
>> fragments:
>>
>> In [10]: frags = Chem.GetMolFrags(nm,asMols=True,sanitizeFrags=False)
>>
>> In [11]: [AllChem.CalcMolFormula(x) for x in frags]
>> Out[11]: ['C4H4N3O', 'C6H5']
>>
>> In [10]: frags = Chem.GetMolFrags(nm,asMols=True,sanitizeFrags=False)
>>
>> In [11]: [AllChem.CalcMolFormula(x) for x in frags]
>> Out[11]: ['C4H4N3O', 'C6H5']
>>
>>
>>
>>>
>>> As for the difference between ExactMolWt() and MolWt(). The confusion
>>> is from the following case:
>>>
>>> >>>[Chem.MolToSmiles(x) for x in frags]
>>> ['Cc1nncc(O)n1', 'c1ccccc1']
>>>
>>> >>> Descriptors.MolWt(Chem.MolFromSmiles('Cc1nncc(O)n1'))
>>> 111.10399999999998
>>> >>> Descriptors.MolWt(Chem.MolFromSmiles('c1ccccc1'))
>>> 78.11399999999999
>>> >>> [Descriptors.ExactMolWt(x) for x in frags]
>>> [111.04326178, 78.046950192]
>>>
>>> By far, every thing is perfect.
>>>
>>> But if I use
>>>
>>> >>>[Descriptors.MolWt(x) for x in frags]
>>> [5.04, 6.048]
>>>
>>> It looks I can get correct mass by MolWt() if I transfer mol to Smiles
>>> format, and transfer Smiles format back to mol. However, if I directly
>>> apply MolWt() on the original mol, I got weird results.
>>>
>>
>> I can reproduce this and it looks like a bug. I'll get it fixed.
>>
>> -greg
>>
>
>
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to