-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathraxml_protocol.py
executable file
·42 lines (34 loc) · 1.56 KB
/
raxml_protocol.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /usr/bin/python
from subprocess import call
from Bio import AlignIO
import os
file = raw_input("FASTA file name: ")
part_file = raw_input("Partition file for RAxML (empty does not use partitions): ")
threads = raw_input("Number of threads: ")
trees = raw_input("Number of searches: ")
bootstrap = raw_input("Number of bootstrap: ")
call("mkdir raxml", shell=True)
os.chdir("raxml")
AlignIO.convert("../"+file, "fasta", file+".phy", "phylip-relaxed")
file_phy = file + ".phy"
if part_file == "": # a different RAxML line if there is partition file or not.
try:
print "raxmlHPC-PTHREADS-AVX -T %s -m GTRCAT -p 12345 -# %s -s %s -n run1" % (threads, trees, file_phy)
call("raxmlHPC-PTHREADS-AVX -T %s -m GTRCAT -p 12345 -# %s -s %s -n run1" % (threads, trees, file_phy), shell=True)
except:
print "IT IS NOT GOOD. PLEASE, CHECK YOUR INPUT FILE(S)"
sys.exit()
else:
try:
print "raxmlHPC-PTHREADS-AVX -T %s -m GTRCAT -p 12345 -q ../%s -# %s -s %s -n run1" % (threads, part_file, trees, file_phy)
call("raxmlHPC-PTHREADS-AVX -T %s -m GTRCAT -p 12345 -q ../%s -# %s -s %s -n run1" % (threads, part_file, trees, file_phy), shell=True)
except:
print "IT IS NOT GOOD. PLEASE, CHECK YOUR INPUT FILE(S)"
sys.exit()
call("raxmlHPC-PTHREADS-AVX -T %s -m GTRCAT -p 12345 -b 12345 -# %s -s %s -n run2" % (threads, bootstrap, file_phy), shell=True)
try:
call("raxmlHPC -m GTRCAT -p 12345 -f b -t RAxML_bestTree.run1 -z RAxML_bootstrap.run2 -n run3 ", shell=True)
print "AND... HERE WE ARE!"
except:
print "SOMETHING HAS GONE BAD. PLEASE, CHECK YOUR INPUT FILE(S)"
sys.exit()