Hi Park,

I didn't quite understand your original question.

Here's how to calculate the Tanimoto coefficient, which is defined as the
intersection of two sets/the union of two sets.

>>> import pybel
>>> molA = pybel.readstring("smi", "CO")
>>> molB = pybel.readstring("smi", "CCO")
>>> fps = [mol.calcfp() for mol in [molA, molB]]
>>> print fps[0].bits
[516]
>>> print fps[1].bits
[516, 532, 671]
>>> union = set(fps[0].bits) | set(fps[1].bits)
>>> print union
set([532, 516, 671])
>>> intersection = set(fps[0].bits) & set(fps[1].bits)
>>> print intersection
set([516])
>>> print len(intersection) / float(len(union))
0.333333333333
>>>

The Tanimoto coefficient is 0.3333.

- Noel

On 18 May 2012 03:20, Park Hyerin <parkh...@gmail.com> wrote:

>
> I guessed "_openbabel.so" has tanimoto formula and calculates it, but I
> cannot see inside of "_openbabel.so".
> Can I get the code of tanimoto calculate function?
>
> From that... I want to calculate substructure coefficient.
>
> I'll be thank full for your help and kindness ;)
>
>
> Park.
>
>
>
> ------------------------------------------------------------------------------
> 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