You can store the bits and use them as follows:
sbitsA = set(bitsA)
sbitsB = set(bitsB)
intersection = sbitsA & sbitsB
union = sbitsA | sbitsB
tamimoto = len(intersection) / float(len(union))
print tanimoto
- Noel
On 31 March 2014 07:31, 杨弘宾 <yanyangh...@163.com> wrote:
> Hi,
> I want to calculate the similarity between a query molecule and a set of
> molecules which are stored in a database.
> I tried to store the SMILES in the database and it is too slow for pybel
> to calculate each fingerprint of the set of molecules. So I'd like to store
> the fingerprints of the set of molecules in the database and than it will
> be faster to calculate the similarity.
> However, I don't know how to store the fingerprints.
> I tried use pybel.readstring( _ ).calcfp.bits as the form of fingerprint
> stored in database. But when I reuse the data to calcualte the similarity,
> it return -1.
> For example:
> mol1 = pybel.readstring('smi','ccccc')
> mol2 = pybel.readstring('smi','cccc')
> fp1 = mol1.calcfp()
> fp2 = mol2.calcfp()
> print fp1|fp2
> >>[output] 0.6666666
> store2 = fp2.bits
> >>#store2=[59,671,779,833]
> print fp1|pybel.Fingerprint(store2)
> [output] -1
> -------
> I thought store2(fingerprint.bits) is a good form to store fingerprints of
> molecules. But I can't reuse it.
>
> ------------------------------
> Yang Hongbin, ECUST, China
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss