Re: [Rdkit-discuss] Announce: RDKit in Oracle - via pypl cartridge.

2014-02-28 Thread Greg Landrum
Jan,

Thanks for posting about this. The idea of being able to use python and
call out to RDKit functionality from within Oracle is very entertaining. :-)

-greg



On Thu, Feb 27, 2014 at 10:56 PM, Jan Holst Jensen 
wrote:

>  Hi RDKitters,
>
> I have dabbled with calling RDKit from Oracle and have succeeded. It is
> done via an Oracle cartridge that makes it possible to call Python scripts
> from Oracle. The cartridge is not nearly as sophisticated as Postgres'
> support for Python, but it gets the job done.
>
> The cartridge is open source, BSD-licensed, and can be downloaded from
> here:
> http://biochemfusion.com/downloads/pypl_2014-02-27.zip - Yes, it's only
> an 8.3 KB download.
>
> The cartridge was created on a Linux machine with CentOS 6.2 and Oracle
> 11g. It shouldn't be too hard to make it compile on Windows too, but I
> haven't had the need yet.
>
> With the cartridge we can create Oracle functions like below that operate
> on MDL molfiles, returning SMILES and LogP values:
>
> create function mol_to_smiles(molfile in clob) return varchar2
> is
> begin
>   return pypl.run_script(
> 'from rdkit import Chem' || Chr(10) ||
> 'from rdkit.Chem import Descriptors' || Chr(10) ||
> 'molfile = """' || molfile || '"""' || Chr(10) ||
> 'result = Chem.MolToSmiles(Chem.MolFromMolBlock(molfile))', 'result');
> end;
> /
>
> create function mol_logp(molfile in clob) return number
> is
> begin
>   return to_number(pypl.run_script(
> 'from rdkit import Chem' || Chr(10) ||
> 'from rdkit.Chem import Descriptors' || Chr(10) ||
> 'molfile = """' || molfile || '"""' || Chr(10) ||
> 'result = str(Descriptors.MolLogP(Chem.MolFromMolBlock(molfile)))',
> 'result'));
> end;
> /
>
> If we have a COMPOUNDS table where the STRUCTURE column has the molecule
> stored in Accelrys Direct format, we can then do the following select:
>
> select
> id,
> mol_to_smiles(molfile(structure)) as smiles,
> mol_logp(molfile(structure)) as logp
>   from compounds
>  where id <= 3;
>
>*ID* *SMILES* *LOGP*  1 O=C(O)c1c1 1.3848  2 CCC(=O)OCCOc1c1
> 2.0186  3 CC1=CC(=O)C=CC1=O 0.6407
> [The molfile() function is an Accelrys Direct function that produces a
> molfile CLOB from the STUCTURE BLOB column.]
>
> There you have it - RDKit functionality directly in an Oracle database.
> Hope that you will find this useful.
>
> Cheers
> -- Jan
>
>
> --
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] RDKit fingerprints in Knime - operations on DenseBitVectorCell

2014-02-28 Thread Greg Landrum
Hi Michal,

On Fri, Feb 28, 2014 at 1:22 PM, Michal Krompiec
wrote:

> Hello,
> I am trying to implement substructure searching with fingerprint-based
> screening in Knime, using RDKit fingerprints (I know that a database
> would be the preferred solution, but for some reasons I'd rather use
> Knime).

In order to do this, I need an equivalent of
> DataStructs.AllProbeBitsMatch() function (or at just logical operators
> on DenseBitVectorCell) - is it possible in Knime? Or otherwise, is it
> possible to convert a DenseBitVectorCell column to something else?
>

I'm afraid that I don't know how to do this from within any of the knime
nodes.
We currently have an item on the ToDo list for the RDKit nodes to allow
using fingerprint-based screening to make substructure searching faster.
The bit operations are clearly usable at the java level. I'm not 100% sure
what the timeline is for completing that work (I need to check with
Manuel), but it shouldn't be too long.

-greg
--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] rdkit as python module fragmented

2014-02-28 Thread Greg Landrum
Hi,

On Fri, Feb 28, 2014 at 4:44 PM, Joshua Meyers wrote:

>
> Hi,
>
> I have been trying to use rdkit in python but cannot seem to get it to
> import properly
> RDKit works fine through C++, I have compiled and can run programs but it
> will not import as a python module
>
> from rdkit import Chem
>
> Fatal Python error: PyThreadState_Get: no current thread
> Abort trap: 6
>
> I am using Mac OS X 10.8.5 and have home-brewed version of rdkit
> I have two versions of Python installed (the Mac default, and a newer
> version in /usr/local/bin/python which I believe is the problem but I can't
> seem to fix it through altering the $PATH variable in the terminal
>
>
This is almost always caused by using a different version of python/boost
than the one you used to build the RDKit, so I guess it is the second
installation that's causing the problem.

Based on the log file, it looks like you actually did use the system python
in that session, could it be that /usr/local/bin/python was used by
homebrew to build the rdkit?

If you try explicitly running /usr/local/bin/python, can you import the
rdkit from there?

-greg
--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Insert mol objects directly into postgres rdkit cartridge column?

2014-02-28 Thread Riccardo Vianello
On Wed, Feb 26, 2014 at 7:26 PM, Adrian Jasiński
wrote:

> you can try use razi:
>

Unfortunately, razi is currenly a bit old and unmaintained. Moreover it's
based on sqlalchemy and it wouldn't therefore integrate easily with the
django database api. One might consider having a look at django-chem, but
that is also quite old (iirc it targeted django 1.3), and it's based on an
implementation approach that I think is becoming in part obsolete.

As it has been also mentioned in reply to Hari's question on stackoverflow,
the upcoming version 1.7 of django will support custom lookup operators.
This is likely to help, but I also partly agree that extending the database
api is still quite a lot of work compared to the fraction of
domain-specific queries, and a single application project could just
consider using raw SQL queries in the few places where it is needed.

Of course things are much simpler if one doesn't need/want to abstract the
api from the database backend and it could be also of interest that there's
currently a kickstarter project which is aimed at contributing extended
postgresql support to django:
https://www.kickstarter.com/projects/mjtamlyn/improved-postgresql-support-in-django
.

Best regards,
Riccardo



>
> http://razi.readthedocs.org/en/latest/database_creation_tutorial.html
>
> pozdrawiam
> Adrian
>
>
> 2014-02-26 18:34 GMT+01:00 Greg Landrum :
>
> Hi Hari,
>>
>> You can use "mol_from_pkl()". Here's a quick demo:
>> In [20]: m = Chem.MolFromSmiles('c1cnccc1')
>>
>> In [21]: pkl = buffer(m.ToBinary())
>>
>> In [22]: curs.execute('select mol_from_pkl(%s)',(pkl,))
>>
>> In [23]: curs.fetchone()
>> Out[23]: ('c1ccncc1',)
>>
>> Is that enough to get you started?
>> -greg
>>
>>
>>
>> On Tue, Feb 25, 2014 at 8:28 PM, hari jayaram  wrote:
>>
>>> Hi ,
>>> I am a newbie to postgres and the rdkit postgres database cartridge.
>>>
>>> I have gotten the cartridge installed and can query sub-structure
>>> similarity and do other things as documented in the cartridge documentation
>>> page.
>>>
>>> To create a molecule from the cartridge the documentation
>>> recommends something like:
>>>
>>>
>>> >>> curs.execute('select molregno,mol_send(m) from rdk.mols where m@
>>> >%s',('c12c1nncc2',))
>>> >>> row = curs.fetchone()
>>> >>> row
>>> (9830, )
>>>
>>> Then the pickled output of mol_send will be used to create a new molecule
>>>
>>> >>> from rdkit import Chem
>>> >>> m = Chem.Mol(str(row[1]))
>>> >>> Chem.MolToSmiles(m,True)
>>> 'CC(C)Sc1ccc(CC2CCN(C3CCN(C(=O)c4cnnc5c54)CC3)CC2)cc1'
>>>
>>>
>>> My question is : how about the other way .Is the only way to use the
>>> smiles and do an sql insert with the smiles and the mol_from_smiles
>>> function as in :
>>>
>>>  insert into compounds (smiles,rdkit_mol,internal,external) VALUES
>>> ('C',mol_from_smiles('C);'ID-111','EI-222');
>>>
>>> Is there a way to insert the python rdkit mol object into the database
>>> rdkit "mol" column directly.
>>>
>>> This is in some ways connected to a question I just asked ( django
>>> related) on stack 
>>> overflow.
>>>
>>> Thanks a tonne for your help in advance
>>> Hari
>>>
>>>
>>>
>>>
>>> --
>>> Flow-based real-time traffic analytics software. Cisco certified tool.
>>> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>>> Customize your own dashboards, set traffic alerts and generate reports.
>>> Network behavioral analysis & security monitoring. All-in-one tool.
>>>
>>> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>>> ___
>>> Rdkit-discuss mailing list
>>> Rdkit-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>>>
>>
>>
>> --
>> Flow-based real-time traffic analytics software. Cisco certified tool.
>> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>> Customize your own dashboards, set traffic alerts and generate reports.
>> Network behavioral analysis & security monitoring. All-in-one tool.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>> ___
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>>
>
>
> --
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.do

[Rdkit-discuss] rdkit as python module fragmented

2014-02-28 Thread Joshua Meyers

Hi,

I have been trying to use rdkit in python but cannot seem to get it to import 
properly
RDKit works fine through C++, I have compiled and can run programs but it will 
not import as a python module

from rdkit import Chem
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

I am using Mac OS X 10.8.5 and have home-brewed version of rdkit
I have two versions of Python installed (the Mac default, and a newer version 
in /usr/local/bin/python which I believe is the problem but I can't seem to fix 
it through altering the $PATH variable in the terminal

Here is the error file:



The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.

rdkit_error.log
Description: rdkit_error.log
here is the extract from my .bash_profile#export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH #the directory below contains a symbolic link to the python executable hereexport PATH=/usr/local/bin/:$PATHexport PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH#rdkitexport RDBASE=/usr/local/share/RDKitexport DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$RDBASE/libany help would be greatly appreciated,I have been having this problem for a while now…Many thanks,Josh--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] RDKit fingerprints in Knime - operations on DenseBitVectorCell

2014-02-28 Thread Michal Krompiec
Hello,
I am trying to implement substructure searching with fingerprint-based
screening in Knime, using RDKit fingerprints (I know that a database
would be the preferred solution, but for some reasons I'd rather use
Knime).
In order to do this, I need an equivalent of
DataStructs.AllProbeBitsMatch() function (or at just logical operators
on DenseBitVectorCell) - is it possible in Knime? Or otherwise, is it
possible to convert a DenseBitVectorCell column to something else?
Best wishes,
Michal

--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss