我想使用InChI作为输入从几个数据库中检索I。
InChI=1S/C6H14N2O2/c7-4-2-1-3-5(8)6(9)10/h5H,1-4,7-8H2,(H,9,10)/t5-/m0/s1我们可以使用来自unichem的bioservices,然而,这些函数都需要InChIKey作为输入。
KDXKERNSBIXSRK-YFKPBYRVSA-N是否可以使用bioservices将两者相互转换,如果不能,是否可以以某种方式将unichem中的函数与InChI而不是InChIKey一起使用
我试过:
from bioservices import *
u = UniChem()
u.get_src_compound_ids_from_inchikey('KDXKERNSBIXSRK-YFKPBYRVSA-N')但效果很好,
u.get_src_compound_ids_from_inchikey('InChI=1S/C6H14N2O2/c7-4-2-1-3-5(8)6(9)10/h5H,1-4,7-8H2,(H,9,10)/t5-/m0/s1')不工作,并返回400。
发布于 2017-09-01 12:47:53
不确定是否可以在bioservices中直接使用,但可以使用化学蜘蛛执行以下解决方法
import requests
host = "http://www.chemspider.com"
getstring = "/InChI.asmx/InChIToInChIKey?inchi="
inchi = 'InChI=1S/C6H14N2O2/c7-4-2-1-3-5(8)6(9)10/h5H,1-4,7-8H2,(H,9,10)/t5-/m0/s1'
r = requests.get('{}{}{}'.format(host, getstring, inchi))
if r.ok:
res = str(r.text.replace('<?xml version="1.0" encoding="utf-8"?>\r\n<string xmlns="http://www.chemspider.com/">', '').replace('</string>', '').strip())
else:
print "provide a valid inchi!"这将给出所需的InChIKey
'KDXKERNSBIXSRK-YFKPBYRVSA-N'可以在unichem中使用。
https://stackoverflow.com/questions/45996962
复制相似问题