예제 #1
0
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()
예제 #2
0
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()

예제 #3
0
def test_simplify_smile():
    out = smilite.simplify_smile('C[C@H](CCC(=O)NCCS(=O)(=O)[O-])')
    assert out == 'CC(CCC(=O)NCCS(=O)(=O)O)'
예제 #4
0
def test_simplify_smile():
    out = smilite.simplify_smile('C[C@H](CCC(=O)NCCS(=O)(=O)[O-])')
    assert out == 'CC(CCC(=O)NCCS(=O)(=O)O)'