Ale*_*lex 7 python cheminformatics rdkit
有没有办法使用 RDKit 或其他 python 模块将 SMILES 转换为化学名称或 IUPAC 名称?
我在其他帖子中找不到非常有用的东西。
非常感谢!
据我所知,使用 rdkit 是不可能的,而且我不知道有任何 python 模块具有这种能力。如果您可以使用 Web 服务,则可以使用NCI 解析器。
下面是从 SMILES 字符串中检索 IUPAC 标识符的函数的简单实现:
import requests
CACTUS = "https://cactus.nci.nih.gov/chemical/structure/{0}/{1}"
def smiles_to_iupac(smiles):
rep = "iupac_name"
url = CACTUS.format(smiles, rep)
response = requests.get(url)
response.raise_for_status()
return response.text
print(smiles_to_iupac('c1ccccc1'))
print(smiles_to_iupac('CC(=O)OC1=CC=CC=C1C(=O)O'))
[Out]:
BENZENE
2-acetyloxybenzoic acid
Run Code Online (Sandbox Code Playgroud)
您可以轻松扩展它以转换多种不同的格式,尽管该功能并不完全快......
另一个解决方案是使用 PubChem。您可以将 API 与 python 包pubchempy一起使用。请记住,这可能会返回多个化合物。
import pubchempy
# Use the SMILES you provided
smiles = 'O=C(NCc1ccc(C(F)(F)F)cc1)[C@@H]1Cc2[nH]cnc2CN1Cc1ccc([N+](=O)[O-])cc1'
compounds = pubchempy.get_compounds(smiles, namespace='smiles')
match = compounds[0]
print(match.iupac_name)
[Out]:
(6S)-5-[(4-nitrophenyl)methyl]-N-[[4-(trifluoromethyl)phenyl]methyl]-3,4,6,7-tetrahydroimidazo[4,5-c]pyridine-6-carboxamide
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9090 次 |
| 最近记录: |