def usearch(query, db, type, out, threads = '6', evalue = '100', alignment = 'local', max_hits = 100, cluster = False):
    """
    run usearch
    """
    if 'usearch64' in os.environ:
        usearch_loc = os.environ['usearch64']
    else:
        usearch_loc = 'usearch'
    if os.path.exists(out) is False:
        db = usearchdb(db, alignment, usearch_loc) # make the database file, if neceesary
        print('# ... running usearch with %s as query and %s as database' % (query, db), file=sys.stderr)
        if type == 'nucl':
            strand = '-strand both'
        else:
            strand = ''
        if alignment == 'local' and cluster is False:
            os.system('%s \
                    -ublast %s -db %s -blast6out %s \
                    -evalue %s -threads %s %s -maxhits %s >> log.txt' \
                    % (usearch_loc, query, db, out, evalue, threads, strand, max_hits))
        elif alignment == 'global' and cluster is False:
            os.system('%s \
                    -usearch_global %s -db %s -blast6out %s \
                    -id 0.10 -threads %s %s >> log.txt' \
                    % (usearch_loc, query, db, out, threads, strand))
        elif alignment == 'local' and cluster is True:
            qsub = 'qsub -V -N usearch'
            os.system('echo "%s -ublast `pwd`/%s -db %s -blast6out `pwd`/%s -evalue %s -threads %s %s -maxhits %s >> `pwd`/log.txt" | %s' \
                    % (usearch_loc, query, db, out, evalue, threads, strand, max_hits, qsub))
        else:
            print('specify local or global alignment', file=sys.stderr)
            exit()
    else:
        print('# ... usearch output found for %s as query and %s as database' % (query, db), file=sys.stderr)
run usearch