i'm trying to make sure i understand just what `calcfp()` is
doing, by trying to reconcile its two `fp` and `bits` return values.
below is a short demo, showing i cannot.  i'm sure i'm missing
something simple, but don't know what!

thanks for your help.

     rik

>>>> import pybel
>>>> def pybelBits2binary(fps):
>     bitlist=list('0'*1024)
>     for item in fps:
>         bitlist[item-1]='1'
>     bitstring = ''.join(bitlist)
>     return bitstring
> ...
>>>> frag = 'Brc1ccc(c(c1)C(=O)O)N'
>>>> mol = pybel.readstring('can',frag)
>>>> fp = mol.calcfp()
>>>> bits1 = pybelBits2binary(fp.bits)
>>>> bits2 = ''.join([format(num,'032b') for num in fp.fp])
>>>> bits1 == bits2
> False
>>>> bits1
> '000000000000000000000000000100000001000000000000000000000000001100000000000001000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010000000000000000000000000000000000000000010000000000000000000000000000000000100000000000000000001000000000000000000000000000000000000001000000010001010000010000000001000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000001000000000000000100000000000000000010000000000100000000000000000000000000000000000000000000000000100000000001000000000000000000000000000010010000000000000011001000000000000000000000000000000000001000010000000000000000000000000000100000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000001000000100000000000000000000000100000000000000000000000000000000001000100000000000
 000100100

0000000000100000000000000000'
>>>> bits2
> '000010000000000000000000000000001100000000000000000000000000100000000000000001100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000100000000000000000100000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000100001000000000000000000000000000000000100000000010000010100010000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000100000000001000000000000000000000000000000000000000000000000000000100000000001000011000000000000001001000000000000000000000000000000000000000001000000000000000000000010000100000001000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000001000000100000000000000000000000000000000100000000010000000000000010001000000
 000000000

0000000000000100000000000010'

> -------- Forwarded Message --------
> Subject: pybel calcfp() mismatch?
> Date: Wed, 06 May 2015 11:30:59 -0700
> From: R. K. Belew <rbe...@ucsd.edu>
> To: openbabel-discuss@lists.sourceforge.net
>
> i'm trying to make sure i understand just what `calcfp()` is
> doing, by trying to reconcile its two `fp` and `bits` return values.
> below is a short demo, showing i cannot.  i'm sure i'm missing
> something simple, but don't know what!
>
> thanks for your help.
>
>       rik
>
>>>>> import pybel
>>>>> def pybelBits2binary(fps):
>>     bitlist=list('0'*1024)
>>     for item in fps:
>>         bitlist[item-1]='1'
>>     bitstring = ''.join(bitlist)
>>     return bitstring
>> ...
>>>>> frag = 'Brc1ccc(c(c1)C(=O)O)N'
>>>>> mol = pybel.readstring('can',frag)
>>>>> fp = mol.calcfp()
>>>>> bits1 = pybelBits2binary(fp.bits)
>>>>> bits2 = ''.join([format(num,'032b') for num in fp.fp])
>>>>> bits1 == bits2
>> False
>>>>> bits1
>> '00000000000000000000000000010000000100000000000000000000000000110000000000000100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000000000000000001000000000000000000000000000000000010000000000000000000100000000000000000000000000000000000000100000001000101000001000000000100000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000100000000000000010000000000000000001000000000010000000000000000000000000000000000000000000000000010000000000100000000000000000000000000001001000000000000001100100000000000000000000000000000000000100001000000000000000000000000000010000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000100000010000000000000000000000010000000000000000000000000000000000100010000000000
 000010010
0
> 0000000000100000000000000000'
>>>>> bits2
>> '00001000000000000000000000000000110000000000000000000000000010000000000000000110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010000000000000000010000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000010000100000000000000000000000000000000010000000001000001010001000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000100000000000000010000000000000000010000000000100000000000000000000000000000000000000000000000000000010000000000100001100000000000000100100000000000000000000000000000000000000000100000000000000000000001000010000000100000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000000000000000000000000000000000000100000010000000000000000000000000000000010000000001000000000000001000100000
 000000000
0
> 0000000000000100000000000010'
>


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to