On Jun 11, 2015, at 2:20 PM, Laƫtitia Bomble wrote:
> Is there a rdkit tool to get IUPAC name of a molecule?

No, there isn't. If you only have a few names, and/or are
willing to wait for a web service, you can use the NCI
resolver at

  http://cactus.nci.nih.gov/chemical/structure

For example, the following URL returns the IUPAC name
for caffeine:

http://cactus.nci.nih.gov/chemical/structure/C%5BN%5D1C=NC2=C1C(=O)N(C(=O)N2C)C/iupac_name

1,3,7-trimethylpurine-2,6-dione

I've appended a small program which uses that service. Here's
an example of how to use it:

% python nci_iupac_name.py c1ccccc1O CO 
'InChI=1S/C8H10N4O2/c1-10-4-9-6-5(10)7(13)12(3)8(14)11(6)2/h4H,1-3H3' 'ascorbic 
acid'
c1ccccc1O       PHENOL
CO      methanol
InChI=1S/C8H10N4O2/c1-10-4-9-6-5(10)7(13)12(3)8(14)11(6)2/h4H,1-3H3     
1,3,7-trimethylpurine-2,6-dione
ascorbic acid   2-(1,2-dihydroxyethyl)-4,5-dihydroxyfuran-3-one




                                Andrew
                                [email protected]


# Interface to the NCI services to get an IUPAC name
# given a SMILES, InChI, or other compound name/structure.

# Example:

# % python nci_iupac_name.py c1ccccc1O CO 'InChI=1S/C8H10N4O2/c1-10-4-9-6-5(10)7(13)12(3)8(14)11(6)2/h4H,1-3H3' 'ascorbic acid'
# c1ccccc1O	PHENOL
# CO	methanol
# InChI=1S/C8H10N4O2/c1-10-4-9-6-5(10)7(13)12(3)8(14)11(6)2/h4H,1-3H3	1,3,7-trimethylpurine-2,6-dione
ascorbic acid	2-(1,2-dihydroxyethyl)-4,5-dihydroxyfuran-3-one


import sys
import urllib2

def fetch_nci_iupac_name(name):
    quoted_name = urllib2.quote(name)
    try:
        f = urllib2.urlopen("http://cactus.nci.nih.gov/chemical/structure/%s/iupac_name";
                            % (quoted_name,))
        iupac_name = f.read()
    except urllib2.HTTPError, err:
        code = err.getcode()
        if code == 404:
            # Not a valid structure
            return None
        raise
    return iupac_name
    

def main(argv=None):
    if argv is None:
        argv = sys.argv
        
    for name in argv[1:]:
        iupac_name = fetch_nci_iupac_name(name)
        if iupac_name is None:
            iupac_name = "*"
        sys.stdout.write("%s\t%s\n" % (name, iupac_name))
    
    
if __name__ == "__main__":
    main()

------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to