-2

我一直在使用 PubChem API 将化学微笑转换为结构,但仍然有错误。

这是我尝试使用 PIL 图像和 TKinter 的 google colab

https://colab.research.google.com/drive/1TE9WxXwaWKSLQzKRQoNlWFqztVSoIxB7

我想要的输出应该是这样的结构格式

https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/O=C(N1C=CN=C1)N2C=CN=C2/PNG?record_type=2d&image_size=large

4

1 回答 1

1

下载并在 Jupyter Notebook 中显示

from urllib.request import urlretrieve
from IPython.display import Image

smiles = 'NC1=NC(C)=C(C2=CC=C(S(=O)(C)=O)C(F)=C2)S1'
urlretrieve('https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/'+smiles+'/PNG', 'smi_pic.png')
p = Image(filename='smi_pic.png')
p

输出

结构体

于 2020-05-05T09:36:58.603 回答