On 29 May 2011 01:48, Andrew Dalke <[email protected]> wrote:
> On May 29, 2011, at 1:27 AM, Andrew Dalke wrote:
>> This looks to be a bug in the code which calculates the implicit hydrogen 
>> count.
>
> Here's another another case where the implicit h-count is wrong, this time 
> with P.
>
> Daylight says the valence levels for P in SMILES are (3,5)
>
> Given  N=PPCC
>
> The second atom (the first P) has a double bond and a single,
> so it's valences are filled. It should have no implicit hydrogens.
>
> However, here's first the RDKit.MACCS pattern which passed, unexpectedly, in 
> OpenBabel
>
>>>> mol = pybel.readstring("smi", "N=PPCC")
>>>> matcher = pybel.Smarts("[!#6;!#1;!H0]~[!#6;!#1;!H0]")
>>>> matcher.findall(mol)
> [(1, 2), (2, 3)]
>>>> Hmatcher = pybel.Smarts("[!H0]")
>>>> Hmatcher.findall(mol)
> [(1,), (2,), (3,), (4,), (5,)]
>>>>
>
> You can see it's because the matcher thinks all of the atoms have at least 
> one implicit hydrogen.
>
>
> Compare this to RDKit, which correctly has the P with no implicit hydrogens.
>
>>>> mol = Chem.MolFromSmiles("N=PPCC")
>>>> pat = Chem.MolFromSmarts("[!#6;!#1;!H0]~[!#6;!#1;!H0]")
>>>> mol.GetSubstructMatches(pat)
> ()
>>>> Hpat = Chem.MolFromSmarts("[!H0]")
>>>> mol.GetSubstructMatches(Hpat)
> ((0,), (2,), (3,), (4,))
>>>>
>

I've filed a bug report.

- Noel

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
OpenBabel-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to