擅长:python、mysql、java
<p>RDKit无法将名字转换成微笑。
<a href="https://cactus.nci.nih.gov/chemical/structure" rel="nofollow noreferrer">Chemical Identifier Resolver</a>可以转换名称和其他标识符(如casno),并且有一个API,因此可以使用脚本进行转换。在</p>
<pre><code>from urllib.request import urlopen
def CIRconvert(ids):
try:
url = 'http://cactus.nci.nih.gov/chemical/structure/' + 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']
for ids in identifiers :
print(ids, CIRconvert(ids))
</code></pre>
<p>输出</p>
^{pr2}$