Hi JP,

On Tue, Aug 21, 2012 at 12:26 PM, JP <[email protected]> wrote:
> I am sorry to pick up on this again - but I still cannot get it to work.
>
> I fixed the SMARTS definition to something obvious - just mark all aliphatic
> nitrogens as acceptors
>
> When the order in the definition file is
>
> AtomType NAcceptor [N]
> AtomType NAcceptor [n;+0;!X3;!$([n;H1](cc)cc)]
>
> Debugging with your suggested method gives:
>
> Acceptor.SingleAtomAcceptor [$([N,$([n;+0;!X3;!$([n;H1](cc)cc)])])]
>
> which looks good.
>
> But when I invert the order of the two I get:
>
> Acceptor.SingleAtomAcceptor [$([n;+0;!X3;!$([n;H1](cc)cc),$([N])])]
>
> Which is NOT the same as the above because ";" (AND) has lower precedence
> than ",".  So this is the first bit which is being evaluated is the spurious
> clause !$([n;H1](cc)cc),$([N]) and then following the other ANDs.  I think.
> This of course gives me no acceptor points.

Good point. Sorry I missed that when you first described it.
You should be able to solve the problem by replacing ; with & in your
atom types. Then the precedence problem doesn't arise.

Here's an example:

In [3]: fdf="""AtomType NAcceptor [N]
   ...: AtomType NAcceptor [n;+0;!X3;!$([n;H1](cc)cc)]
   ...: DefineFeature SingleAtomAcceptor [{NAcceptor}]
   ...:   Family Acceptor
   ...:   Weights 1
   ...: EndFeature
   ...:
   ...: AtomType NAcceptor2 [n;+0;!X3;!$([n;H1](cc)cc)]
   ...: AtomType NAcceptor2 [N]
   ...: DefineFeature SingleAtomAcceptor2 [{NAcceptor2}]
   ...:   Family Acceptor2
   ...:   Weights 1
   ...: EndFeature
   ...:
   ...: AtomType NAcceptor3 [n&+0&!X3&!$([n;H1](cc)cc)]
   ...: AtomType NAcceptor3 [N]
   ...: DefineFeature SingleAtomAcceptor3 [{NAcceptor3}]
   ...:   Family Acceptor3
   ...:   Weights 1
   ...: EndFeature
   ...:
   ...: """

In [4]: ff = AllChem.BuildFeatureFactoryFromString(fdf)

In [5]:

In [5]: m = Chem.MolFromSmiles('CN=C')

In [6]: feats=ff.GetFeaturesForMol(m)

In [7]: [x.GetFamily() for x in feats]
Out[7]: ['Acceptor', 'Acceptor3']


I will file a bug against this though. I'll mark it low priority since
there's an easy workaround, but if it's an easy fix (which I suspect
it is), then it will still get done for the next release.

-greg

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to