# 简单来说即使这样下载,注意check路径,以ftp开头而非http
wget -c -m -np ftp://ftp.ncbi.nlm.nih.gov/pubchem/Compound_3D/01_conf_per_cmpd/SDF/
# SMILE还不会下载,提供的路径不对,在摸python脚本下载
ftp://ftp.ncbi.nlm.nih.gov/pubchem/Compound/Extras/CID-SMILES.gz
根据化合物CID列表一次性批量获取相应SMILES的方法:
import requests
# get SMILES
cids='216416,65028,2764'
url = 'https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/property/CanonicalSMILES,title/CSV'
headers = {"content-type":"application/x-www-form-urlencoded"}
data={"cid":cids}
res = requests.post(url,data=data,headers=headers)
print (res.text)
# write to csv
with open('result.csv', 'w', encoding='UTF8') as f:
f.write(res.text)
f.close