On Thu, May 24, 2012 at 3:38 AM, Andrew Dalke <da...@dalkescientific.com> wrote:
> I would like to save the fragment to an SD file. This seems
> reasonable on the surface. But I don't know enough about the SD
> file to know how meaningful that is. (For example, the above as
> a 'fragment SMILES' is 'cc', which some programs accept and
> many don't.)
>
> RDKit frowns on me trying to do that.
>
>>>> from rdkit import Chem
>>>> mol = Chem.MolFromSmiles("c1ccccc1")
>>>> emol = Chem.EditableMol(Chem.Mol())
>>>> bond = list(mol.GetBonds())[0]
>>>> atoms = [bond.GetBeginAtom(), bond.GetEndAtom()]
>>>> a1 = emol.AddAtom(atoms[0])
>>>> a2 = emol.AddAtom(atoms[1])
>>>> a1, a2
> (0, 1)
>>>> emol.AddBond(a1, a2, bond.GetBondType())
> 1
>>>> mol2 = emol.GetMol()
>>>> Chem.MolToMolBlock(mol2)
> [02:47:11] non-ring atom 0 marked aromatic
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ValueError: Sanitization error: non-ring atom 0 marked aromatic
>>>>
>
>
> What I did to support this (again, I don't know if it's
> really legitimate, according to the SD file conventions)
> is to use "kekulize=False"
>
>>>> print Chem.MolToMolBlock(mol2, kekulize=False)
>
>     RDKit
>
>  2  1  0  0  0  0  0  0  0  0999 V2000
>    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>  1  2  4  0
> M  END
>
>
> It this reasonable for what I'm doing?

The spec document (ping me privately if you want a copy without giving
your data to Accelrys site) is not covering this in much details, but
from what I've gathered the use of bond types > 3 is reserved to
substructure queries - you can use ctabs to make searches, much  like
SMARTS - so I would not expect programs (inclusing RDkit) to load it
as a proper molecule.

On the other hand, it should be perfectly fine to load it with the
purpose of matching it against some other molecule (the query part),
I'm just not sure how RDKit could do that, if there is already an API
availiable, etc.

HTH

Gianluca

-- 
Gianluca Sforna

http://morefedora.blogspot.com
http://identi.ca/giallu - http://twitter.com/giallu

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to