(Moved to openbabel-scripting)
You should compare the bits that are set. Pybel makes this easy (look
at calcfp() in pybel.py to see what's happening):
>>> mol = pybel.readstring("smi", "CCCC")
>>> mol.calcfp()
<pybel.Fingerprint object at 0x013EAD10>
>>> mol.calcfp().bits
[261, 385, 671]
>>> mol_b = pybel.readstring("smi", "CCCCC")
>>> mol_b.calcfp().bits
[261, 385, 671, 985]
If you convert both lists to a set, you can check whether they are identical.
- Noel
openbabel-scripting <ope...@li...>
2009/6/22 Mingyue Zheng <my...@ma...>:
> Hi all,
> I'd like to compare two OBBitVec instances using the following script:
>
> #!/usr/bin/env python
> import openbabel
> bv1=openbabel.OBBitVec()
> bv2=openbabel.OBBitVec()
> ...
> if bv1==bv2:
> ...
> ...
>
> However, since the OBBitVec class wrapped in openbabel.py has no definition for the __eq__() or __ne__() operations, I assume that "bv1==bv2" comparison will compare these two class instances by their physical address, which is not what I want.
>
> Is here anybody has a solution to this issue? Any comments would be appreciated.
>
> Regards,
> 9thNight
>
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> OpenBabel-discuss mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
|