I have been experimenting with rdkit and PG cartridge recently. Both are really cool. However I have a question related to similarity functions like this
"""create or replace function get_mfp2_neighbors(smiles text)
    returns table(molregno integer, m mol, similarity double precision) as
  select molregno,m,tanimoto_sml(morganbv_fp(mol_from_smiles($1::cstring)),mfp2) as similarity
  from rdk.fps join rdk.mols using (molregno)
  where morganbv_fp(mol_from_smiles($1::cstring))%mfp2
  -- order by morganbv_fp(mol_from_smiles($1::cstring))<%>mfp2;
  $$ language sql stable ;
Is it possible to modify the function so it doesn't recalculate morganbv_fp(mol_from_smiles($1::cstring))? 
Or would it be possible that the function accept mol or even better - fingerprint? Or maybe ID of your "query fingerprint" in another table? I a plan to run large number of comparisons (tens of thousands) with several fingerprints, so I am looking for ways how to make it fastest possible.
I tried to fiddle with the function but my sql knowledge is really rudimental. I cannot figure out how PG function handles custom types. So I would appreciate your advice.
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Rdkit-discuss mailing list

Reply via email to