Chemistry - Search by CAS Registry name to obtain trackable accession: ie InChI?

Solution 1:

Chemical Identifier Resolver can convert several identifiers and has an API so you can convert with a script.

A Python example for CAS to InChIKey:

from urllib.request import urlopen

def CIRconvert(cas):
    try:
        url = 'http://cactus.nci.nih.gov/chemical/structure/' + cas + '/stdinchikey'
        ans = urlopen(url).read().decode('utf8')
        return ans
    except:
        return cas

casno = ['50-78-2', '69-72-7', '95-1E-6', '108-24-7', '31710-30-2']

for casid in casno:
    print(CIRconvert(casid))

Output:

InChIKey=BSYNRYMUTXBXSQ-UHFFFAOYSA-N
InChIKey=YGSDEFSMJLZEOE-UHFFFAOYSA-N
95-1E-6
InChIKey=WFDIJRYMOXRFFG-UHFFFAOYSA-N
InChIKey=CIPFDHFTBYJKQB-UHFFFAOYSA-N

Solution 2:

Chemical Identifier Resolver has a python API also: https://cirpy.readthedocs.io/en/latest/index.html

import cirpy
print(cirpy.resolve('107-13-1', 'stdinchikey'))

Output

InChIKey=NLHHRLWOUZZQLW-UHFFFAOYSA-N

Tags: