Fingerprinting using python module called pybel

778 views Asked by At

I want to get fingerprints using smiles of compounds. I did but the problem is I want to get in a higher bit and a list format so I can calculate the length of lists. In this case I just get classes. Any solution in python using pybel? I did this but when I write len(fps[0]) I get an error

import pybel
smiles = ['CCCC', 'CCCN']
mols = [pybel.readstring("smi", x) for x in smiles]
fps = [x.calcfp() for x in mols]
print fps[0]
1

There are 1 answers

0
knawell On

You can use function fp for fingerprint object. By default FP2 fingerprint is calculated, its length is 32. There is code, which output length and bit-0

import pybel
smiles = ['CCCC', 'CCCN']
mols = [pybel.readstring("smi", x) for x in smiles]
fps = [x.calcfp() for x in mols]
print len(fps[0].fp)
print fps[0].fp[0]

Result:

32 
0