I don't have any C code but the output is a series of hexadecimal numbers
listed in reverse order (i.e the last number is for the first 32 bits, the
hexadecimal number itself is not backwards or anything). If you read all of
those numbers into a list, and then pass it to a function like pybel's
_findbits (which should be easily translatable to C) you should get out the
bits. Note that Pybel's _findbits goes from 1->1024, whereas Open Babel
itself internally uses 0->1023.

For example,

>obabel -:SC -ofpt -xf FP2
>   2 bits set
00000000 00000000 00000000 00100000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
00000000 00010000
1 molecule converted

>obabel -:SC -ofpt -xfFP2 -xs
>
0 16 <16>
0 16 1 6 <916>
1 molecule converted

>python
>>> import pybel
>>> fp = pybel.readstring("smi", "SC").calcfp()
>>> print fp
65536, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0
, 0, 0, 1048576, 0, 0, 0
>>> print fp.bits
[17, 917]
>>>

- Noel

On 15 May 2012 18:09, Rajarshi Guha <rajarshi.g...@gmail.com> wrote:

> Could anybody point me to C code that would parse the Openbabel FP2
> (and FP3) format into say an array of bit positions? Is there a
> description of the format somewhere (beyond
> http://openbabel.org/docs/2.3.0/FileFormats/Fingerprint_format.html)?
>
> (This is so that I can handle Openbabel FP's in my R fingerprint package)
>
> --
> Rajarshi Guha | http://blog.rguha.net
> NIH Center for Advancing Translational Science
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to