This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Download Pubchem Chemical Compunds fingerprint

I want to download fingerprint of pubchem compound with CID I used the Pubchem api: https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/42628049/property/Fingerprint2D/xml

but I have a huge list that I need its corresponding fingerprint Is there any way to download as bulk or any way to speed up retrieving data ?

fingerprint pubchem

1 answer

Not elegant, but works:

cat CIDs.txt | \
while read CID; do
    curl -L https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/${CID}/property/Fingerprint2D/xml -o ${CID}.xml
done

Where CIDs.txt is a file with the CIDs of interest, one per line.

edit: pay attention to NCBI limits:

Request Volume Limitations

All PubChem web pages (or requests to NCBI in general) have a policy that users should throttle their web page requests, which includes web-based programmatic services. Violation of usage policies may result in the user being temporarily blocked from accessing PubChem (or NCBI) resources. The current request volume limits are:

No more than 5 requests per second.

No more than 400 requests per minute.

No longer than 300 second running time per minute.

Log in to answer this question.