1 | #!/bin/bash -x |
---|
2 | |
---|
3 | showinput() { |
---|
4 | echo '------------------' |
---|
5 | cat - |
---|
6 | echo '------------------' |
---|
7 | } |
---|
8 | |
---|
9 | switchmodel() { |
---|
10 | if [ $1 = 0 ]; then |
---|
11 | echo "" |
---|
12 | else |
---|
13 | echo "m `switchmodel $[$1-1]`" |
---|
14 | fi |
---|
15 | } |
---|
16 | |
---|
17 | PHYML=$ARBHOME/bin/phyml |
---|
18 | if [ \! -x $PHYML ]; then |
---|
19 | arb_message 'Error: You have to install phyml and link it into $ARBHOME/bin\n(e.g.: cd ARBHOME/bin; ln -s /path/to/your/phyml .)' |
---|
20 | else |
---|
21 | INFILE=$1; shift |
---|
22 | DATATYPE=$1; shift |
---|
23 | MODEL=$1; shift |
---|
24 | |
---|
25 | if [ "$DATATYPE" = "DNA" ]; then |
---|
26 | OPTFREQ=$1; shift |
---|
27 | BASEFREQEST=$1; shift |
---|
28 | TSTVRATIO=$1; shift |
---|
29 | PINVAR=$1; shift |
---|
30 | else |
---|
31 | if [ "$DATATYPE" = "AA" ]; then |
---|
32 | PINVAR=$1; shift |
---|
33 | else |
---|
34 | arb_message "Invalid datatype '$DATATYPE'" |
---|
35 | exit 1 |
---|
36 | fi |
---|
37 | fi |
---|
38 | INTERACTIVE=$1; shift |
---|
39 | |
---|
40 | if [ -z $INTERACTIVE -o \! -z $1 ]; then |
---|
41 | echo 'Usage: arb_phyml seqfile DNA substmodel optfreq basefreqest tstvratio pinvar interactive' |
---|
42 | echo 'Usage: arb_phyml seqfile AA substmodel pinvar interactive' |
---|
43 | else |
---|
44 | # echo "INFILE='$INFILE'" |
---|
45 | # echo "DATATYPE='$DATATYPE'" |
---|
46 | # echo "MODEL='$MODEL'" |
---|
47 | # echo "OPTFREQ='$OPTFREQ'" |
---|
48 | # echo "BASEFREQEST='$BASEFREQEST'" |
---|
49 | # echo "TSTVRATIO='$TSTVRATIO'" |
---|
50 | # echo "PINVAR='$PINVAR'" |
---|
51 | # echo "INTERACTIVE='$INTERACTIVE'" |
---|
52 | |
---|
53 | ARGS=$INFILE |
---|
54 | SETMODEL=`switchmodel $MODEL` |
---|
55 | if [ "$DATATYPE" = "AA" ]; then |
---|
56 | ARGS="$ARGS d $SETMODEL" |
---|
57 | if [ $PINVAR = 1 ]; then |
---|
58 | ARGS="$ARGS v y" |
---|
59 | fi |
---|
60 | else |
---|
61 | ARGS="$ARGS $SETMODEL" |
---|
62 | if [ $OPTFREQ = 1 ]; then |
---|
63 | if [ $MODEL = 4 ]; then |
---|
64 | ARGS="$ARGS e" |
---|
65 | else |
---|
66 | arb_message "'Optimize equilibrium frequencies' only applies to 'custom' model. Ignored." |
---|
67 | fi |
---|
68 | fi |
---|
69 | if [ $BASEFREQEST = 1 ]; then |
---|
70 | if [ $MODEL = 5 -o $MODEL = 6 -o $MODEL = 4 ]; then |
---|
71 | arb_message "'Base frequency estimates' does not apply to chosen model. Ignored." |
---|
72 | else |
---|
73 | ARGS="$ARGS e" |
---|
74 | fi |
---|
75 | fi |
---|
76 | if [ $TSTVRATIO = 1 ]; then |
---|
77 | if [ $MODEL = 3 -o $MODEL = 4 -o $MODEL = 5 -o $MODEL = 7 ]; then |
---|
78 | arb_message "'Ts/tv ratio' does not apply to chosen model. Ignored." |
---|
79 | else |
---|
80 | ARGS="$ARGS t y" |
---|
81 | fi |
---|
82 | fi |
---|
83 | if [ $PINVAR = 1 ]; then |
---|
84 | if [ $MODEL = 4 ]; then |
---|
85 | arb_message "'Proportion of invariable sites' does not apply to chosen model. Ignored." |
---|
86 | else |
---|
87 | ARGS="$ARGS v y" |
---|
88 | fi |
---|
89 | fi |
---|
90 | fi |
---|
91 | |
---|
92 | # PHYML=showinput |
---|
93 | if [ $INTERACTIVE = 1 ]; then |
---|
94 | (arb_echo $ARGS; cat -) | $PHYML |
---|
95 | else |
---|
96 | arb_echo $ARGS y | $PHYML |
---|
97 | fi |
---|
98 | |
---|
99 | TREEFILE=infile_phyml_tree.txt |
---|
100 | if [ \! -s $TREEFILE ]; then |
---|
101 | arb_message "'$TREEFILE' was not generated or is empty" |
---|
102 | false |
---|
103 | else |
---|
104 | echo >arb_read_tree_args |
---|
105 | mv $TREEFILE outtree |
---|
106 | fi |
---|
107 | fi |
---|
108 | fi |
---|