mcs07 / PubChemPy

Python wrapper for the PubChem PUG REST API.
http://pubchempy.readthedocs.io
MIT License
388 stars 108 forks source link

Generating Pubchem Binary Fingerprint #51

Open hyojin0912 opened 3 years ago

hyojin0912 commented 3 years ago

Hello, thank you for your nice package.

I want to generate PubChem fingerprint which is 881 length binary bit vector (PubChem fingerprint description: https://ftp.ncbi.nlm.nih.gov/pubchem/specifications/pubchem_fingerprints.pdf)

Looking at the folder below in git, I found a suitable example. "PubChemPy/examples/Chemical fingerprints and similarity.ipynb."

import pubchempy as pcp

coumarin = pcp.Compound.from_cid(323)

bin(int(coumarin.fingerprint, 16))

But output of bin function is length 900 and it contains "b".

I want to get exact length of PubChem Fingerprint from CID.

Please describe me how to do this.

Thanks in advance,

Hyojin