Hi George,
On Fri, Nov 8, 2013 at 5:02 PM, George Papadatos <[email protected]>wrote:
> Hi there,
> DB-related question again:
> When I retrieve fps from a postgres db, they look like this:
>
> \x020c00102204000081000104000198000014084201804000000040040000808000000008c020800423a192001814002021044200000009200004000402000008
>
> Is there are way to convert them to RDKit bitvector fingerprint objects or
> at least bitvector strings in python?
>
There is an rdkit cartridge function called bfp_to_binary_text() that you
can use for the bit vector fingerprints:
In [61]: m = Chem.MolFromSmiles('COC')
In [62]: fp =
Chem.RDKFingerprint(m,minPath=1,maxPath=6,fpSize=1024,nBitsPerHash=2)
In [63]: curs.execute("select bfp_to_binary_text(rdkit_fp('COC'))")
In [64]: row = curs.fetchone()
In [66]: nfp = DataStructs.CreateFromBinaryText(str(row[0]))
In [67]: nfp==fp
Out[67]: True
I don't think there's currently a way to do something equivalent for
count-based fingerprints (sfp's in the cartridge nomenclature), but it
could be added if there was demand.
-greg
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss