将分子名称转换为 SMILES?

A. *_*. Y 7 python cheminformatics

我只是想知道,有没有办法将 IUPAC 或常见的分子名称转换为 SMILES?我想做到这一点,而不必使用在线系统手动转换每一个。任何输入将不胜感激!

作为背景,我目前正在使用 python 和 RDkit,所以我不确定 RDkit 是否可以做到这一点,我只是不知道。我当前的数据是 csv 格式。

谢谢!

rap*_*lpy 13

RDKit 无法将名称转换为 SMILES。 Chemical Identifier Resolver可以转换名称和其他标识符(如 CAS No),并且具有 API,因此您可以使用脚本进行转换。

from urllib.request import urlopen
from urllib.parse import quote

def CIRconvert(ids):
    try:
        url = 'http://cactus.nci.nih.gov/chemical/structure/' + quote(ids) + '/smiles'
        ans = urlopen(url).read().decode('utf8')
        return ans
    except:
        return 'Did not work'

identifiers  = ['3-Methylheptane', 'Aspirin', 'Diethylsulfate', 'Diethyl sulfate', '50-78-2', 'Adamant']

for ids in identifiers :
    print(ids, CIRconvert(ids))
Run Code Online (Sandbox Code Playgroud)

输出

3-Methylheptane CCCCC(C)CC
Aspirin CC(=O)Oc1ccccc1C(O)=O
Diethylsulfate CCO[S](=O)(=O)OCC
Diethyl sulfate CCO[S](=O)(=O)OCC
50-78-2 CC(=O)Oc1ccccc1C(O)=O
Adamant Did not work
Run Code Online (Sandbox Code Playgroud)