Hi JP,

On Wed, Mar 9, 2011 at 3:27 PM, JP <jeanpaul.ebe...@inhibox.com> wrote:
> Following the documentation on:
> http://code.google.com/p/rdkit/wiki/DatabaseCartridgeReferenceDocumentation
> I can see no obvious way how to calculate rotatable bonds per molecule
> through the database cartridge.

Yeah, that's not exposed yet.

> If there isn't a way: how difficult would it be to add this myself? (I need
> this info through sql so I can just use it in my queries).
> Presumably RDkit already does this: and it is just missing on the DB API.
>  Correct?

yep.

> Where do I start?

I was torn here between explaining how to do it and just doing it,
which probably is quicker. :-)

Then I realized I could just do it and point you to how it was done,
so here we go.

At the moment the rotatable bonds count is done purely in Python using
the code in
$RDBASE/rdkit/Chem/Lipinski.py
It counts the number of times the SMARTS pattern
[!$(*#*)&!D1]-&!@[!$(*#*)&!D1] matches the molecule. This should
ideally be added as a function in the C++ interface, and I will do
that at some point, but for this example I did the simpler thing and
added the computation to the cartridge code directly.

I checked this in with rev1659:
http://rdkit.svn.sourceforge.net/viewvc/rdkit?view=revision&revision=1659

The first thing I did was add the computation function in C++ in adapter.cpp:
http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/PgSQL/rdkit/adapter.cpp?r1=1659&r2=1658&pathrev=1659
It's pretty simple: count the number of times the substructure appears.

This is also added to the rdkit.h header:
http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/PgSQL/rdkit/rdkit.h?r1=1659&r2=1658&pathrev=1659

Then I needed to make this available in C so that postgresql can call
it. That's here:
http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/PgSQL/rdkit/mol_op.c?r1=1659&r2=1658&pathrev=1659

Add the function definition for postgresql:
http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/PgSQL/rdkit/rdkit.sql.in?r1=1659&r2=1658&pathrev=1659

and then add a test:
http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/PgSQL/rdkit/sql/props.sql?r1=1659&r2=1658&pathrev=1659
and the expected result:
http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/PgSQL/rdkit/expected/props.out?r1=1659&r2=1658&pathrev=1659

after that, I ran "make", "make install", and "make installcheck" and
it was done.

Hope that helps,
-greg

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to