Filtering out records with similarity below cutoff would be done in C level
not SQL level and I guess this will be faster.

Can you see how large chunk of code is repeated twice in your SQL. It's not
DRY but I understand it's the only solution available and it does it's job.
Thank you for your help.


On Thu, Jul 11, 2013 at 6:41 PM, James Swetnam <[email protected]> wrote:

> Michal-
>
> Not pretty, but you could do
>
> select mols.*,  tanimoto_sml(morganbv_fp(':query_smiles'::mol),
>
>           morganbv_fp(mols.mol)) as similarity
> from mols
> where tanimoto_sml(morganbv_fp(':query_smiles'::mol),
>
> morganbv_fp(mols.mol)) > :cutoff
>
> or write your own C function is_similar(fp2, fp1, cutoff) and compile it
> into the rdkit extension :)
>
> How would having the parameter speed up query execution?
>
>
>
>
>
>
> On Thu, Jul 11, 2013 at 10:33 AM, Michał Nowotka <[email protected]> wrote:
>
>> Yes, of course this is valid solution but this query gets even more
>> complicated if you want to return similarity as well. This will obviously
>> work, but how much simpler would it be it tanimoto_sml would accept cutoff
>> as optional parameter?
>> This is a kind of design flaw as having this parameter would also speed
>> up query execution.
>>
>>
>> On Thu, Jul 11, 2013 at 6:24 PM, James Swetnam <[email protected]>wrote:
>>
>>> How about
>>>
>>> select * from mols where tanimoto_sml(morganbv_fp(':query_smiles'::mol),
>>>                                         morganbv_fp(mols.mol)) > :cutoff ?
>>> where 'query_smiles' is your desired query molecule, 'cutoff' is the
>>> minimum similarity and mols.mol is the serialized RDkit::ROMol extension
>>>
>>>
>>>
>>> On Thu, Jul 11, 2013 at 9:50 AM, Rodrigo Ochoa <
>>> [email protected]> wrote:
>>>
>>>> Hi Michal
>>>>
>>>> This a problem that can be solved through two ways:
>>>>
>>>> 1) Execute a single query like this before calling the
>>>> rdkit.tanimoto_threshold:
>>>>
>>>> select 'c1ccccc1O'::mol;
>>>>
>>>> Then you can set a tanimoto threshold without problems. Is an internal
>>>> bug, that can be solved according to the second way
>>>>
>>>> 2) You can add this line to the postgressql.conf file:
>>>>
>>>> shared_preload_libraries = 'rdkit'
>>>>
>>>> This is a link with the explanation:
>>>> https://code.google.com/p/rdkit/wiki/BuildingTheCartridge
>>>>
>>>> I hope it helps
>>>>
>>>>
>>>> On Thu, Jul 11, 2013 at 5:52 PM, Michał Nowotka <[email protected]>wrote:
>>>>
>>>>> Is is possible to specify similarity threshold for single query
>>>>> instead of relying on global "rdkit.tanimoto_threshold" which I'm having
>>>>> problems with?
>>>>>
>>>>> It would be much more intuitive to do so, otherwise I need to surround
>>>>> my similarity search SQL with statements changing global threshold and
>>>>> restoring it afterwards.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Michał Nowotka
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> See everything from the browser to the database with AppDynamics
>>>>> Get end-to-end visibility with application monitoring from AppDynamics
>>>>> Isolate bottlenecks and diagnose root cause in seconds.
>>>>> Start your free trial of AppDynamics Pro today!
>>>>>
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>>>>> _______________________________________________
>>>>> Rdkit-discuss mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> ----------------------------------------------------------------------------------------------------
>>>> *Rodrigo Alonso Ochoa Deossa
>>>> **Bioengineer  - MSc(c) Basic Biomedical Sciences*
>>>> *University of Antioquia - SIU - PECET
>>>> Medellín, Colombia
>>>> **e: [email protected]*
>>>> *t: +57-4-2196622*
>>>> *m: +57-3004505174*
>>>>
>>>> ------------------------------------------------------------------------------------------------------
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> See everything from the browser to the database with AppDynamics
>>>> Get end-to-end visibility with application monitoring from AppDynamics
>>>> Isolate bottlenecks and diagnose root cause in seconds.
>>>> Start your free trial of AppDynamics Pro today!
>>>>
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>>>> _______________________________________________
>>>> Rdkit-discuss mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to