def run_raxml(rax_out, boot, a_id_phylip, threads, aligned, model, cluster, node):
    """
    run raxml
    """
    # set ppn based on threads
    if threads > 24:
        ppn = 24
    else:
        ppn = threads
    if 'raxml' in os.environ:
        raxml = os.environ['raxml']
        threads = '-T %s' % (threads)
    else:
        raxml = 'raxml'
        threads = ''
    rax_tree = 'RAxML_bipartitions.%s' % (rax_out)
    if check(rax_tree) is False:
        seed = random.randint(123456789, 12345678910000000)
        print(seed, file=open('seed.txt', 'w'))
        if check_type(aligned) == 'nucl' and model is False:
            model = 'GTRCAT'
        elif model is False:
            model = 'PROTCATJTT'
        dir = os.getcwd()
        command = '%s -f a -m %s -n %s -N %s -s %s -x %s -p %s %s > %s.log 2>>%s.log' % \
                    (raxml, model, rax_out, boot, a_id_phylip, seed, seed, threads, rax_out, rax_out)
        if cluster is False:
            p = Popen(command, shell = True)
        else:
            if node is False:
               node = '1'
            qsub = 'qsub -l nodes=%s:ppn=%s -m e -N raxml' % (node, ppn)
            command = 'cd /tmp; mkdir raxml_%s; cd raxml_%s; cp %s/%s .; %s; mv * %s/; rm -r ../raxml_%s' \
                    % (seed, seed, dir, a_id_phylip, command, dir, seed)
            re_call = 'cd %s; %s --no-fast' % (dir.rsplit('/', 1)[0], ' '.join(sys.argv))
            p = Popen('echo "%s;%s" | %s' % (command, re_call, qsub), shell = True)
        p.communicate()
    return rax_tree
run raxml