def test_get_zinc_smile(): out = smilite.get_zinc_smile('ZINC00029323') assert out == 'COc1cccc(c1)NC(=O)c2cccnc2'
def print_usage(): print('\nUSAGE: python3 lookup_zincid.py ZINC_ID [zinc12 (def.) / zinc15]') print('\n\nEXAMPLES (retrieve data from ZINC):\n' '1) python3 lookup_zincid.py ZINC01234567 zinc12\n' '2) python3 lookup_zincid.py ZINC01234567 zinc15') smile_str = '' simple_smile_str = '' try: zinc_id = sys.argv[1] if len(sys.argv) >= 3: backend = sys.argv[2] else: backend = 'zinc12' smile_str = smilite.get_zinc_smile(zinc_id, backend=backend) if smile_str: simple_smile_str = smilite.simplify_smile(smile_str) print('{}\n{}\n{}'.format(zinc_id, smile_str, simple_smile_str)) except IOError as err: print('\n\nERROR: {}'.format(err)) print_usage() except IndexError: print('\n\nERROR: Invalid command line arguments.') print_usage()
smile_str = '' simple_smile_str = '' try: zinc_id = sys.argv[1] if len(sys.argv) > 2: sqlite_file = sys.argv[2] lookup_result = smilite.lookup_id_sqlite(sqlite_file, zinc_id) try: smile_str, simple_smile_str = lookup_result[1], lookup_result[2] except IndexError: pass else: smile_str = smilite.get_zinc_smile(zinc_id) if smile_str: simple_smile_str = smilite.simplify_smile(smile_str) print('{}\n{}\n{}'.format(zinc_id, smile_str, simple_smile_str)) except IOError as err: print('\n\nERROR: {}'.format(err)) print_usage() except IndexError: print('\n\nERROR: Invalid command line arguments.') print_usage()
def print_usage(): print('\nUSAGE: python3 lookup_zincid.py ZINC_ID [zinc12 (default)/zinc15]') print('\n\nEXAMPLES (retrieve data from ZINC):\n' '1) python3 lookup_zincid.py ZINC01234567 zinc12\n' '2) python3 lookup_zincid.py ZINC01234567 zinc15') smile_str = '' simple_smile_str = '' try: zinc_id = sys.argv[1] if len(sys.argv) >= 3: backend = sys.argv[2] else: backend = 'zinc12' smile_str = smilite.get_zinc_smile(zinc_id, backend=backend) if smile_str: simple_smile_str = smilite.simplify_smile(smile_str) print('{}\n{}\n{}'.format(zinc_id, smile_str, simple_smile_str)) except IOError as err: print('\n\nERROR: {}'.format(err)) print_usage() except IndexError: print('\n\nERROR: Invalid command line arguments.') print_usage()