| 1 | #!/bin/bash -x |
|---|
| 2 | # ------------------------------------------------------------ |
|---|
| 3 | # (C) 2003 Lehrstuhl fuer Mikrobiologie TU Muenchen |
|---|
| 4 | # Coded by Ralf Westram |
|---|
| 5 | # ------------------------------------------------------------ |
|---|
| 6 | # |
|---|
| 7 | # usage: arb_bootstrap count treeprog [keys for treeprog] |
|---|
| 8 | # |
|---|
| 9 | # 'count' is the number of generated trees |
|---|
| 10 | # 'treeprog' calculates the trees (e.g. dnapars, protpars) |
|---|
| 11 | # 'keys for treeprog' is arb_echo'ed to stdin of 'treeprog' |
|---|
| 12 | # |
|---|
| 13 | # expects input data in "infile" |
|---|
| 14 | # output data is written to "outtree" |
|---|
| 15 | # |
|---|
| 16 | # ------------------------------------------------------------ |
|---|
| 17 | |
|---|
| 18 | COUNT=$1 |
|---|
| 19 | TREEPROG=$2 |
|---|
| 20 | shift |
|---|
| 21 | shift |
|---|
| 22 | # additional arguments are pushed to arb_echo |
|---|
| 23 | |
|---|
| 24 | RANDOMSEED1=$(($RANDOM|1)) # a odd number |
|---|
| 25 | RANDOMSEED2=$(($RANDOM|1)) # a odd number |
|---|
| 26 | |
|---|
| 27 | echo "-consense $COUNT" >arb_read_tree_args |
|---|
| 28 | |
|---|
| 29 | # arb_echo $RANDOMSEED r $COUNT y | seqboot |
|---|
| 30 | arb_echo r "$COUNT" y $RANDOMSEED1 | seqboot |
|---|
| 31 | |
|---|
| 32 | if [ \! -f outfile ] ; then |
|---|
| 33 | echo "Error in seqboot: 'outfile' not generated" |
|---|
| 34 | else |
|---|
| 35 | mv -f outfile infile |
|---|
| 36 | TREED=0 |
|---|
| 37 | if [ \( "$TREEPROG" = "dnapars" \) -o \ |
|---|
| 38 | \( "$TREEPROG" = "protpars" \) -o \ |
|---|
| 39 | \( "$TREEPROG" = "proml" \) \ |
|---|
| 40 | ]; then |
|---|
| 41 | arb_echo m d $COUNT $RANDOMSEED2 1 $* y | $TREEPROG |
|---|
| 42 | # $TREEPROG |
|---|
| 43 | TREED=1 |
|---|
| 44 | fi |
|---|
| 45 | |
|---|
| 46 | if [ "$TREED" = 0 ]; then |
|---|
| 47 | echo "treeprogram '$TREEPROG' is unknown by arb_bootstrap" |
|---|
| 48 | else |
|---|
| 49 | if [ \! -f outtree ] ; then |
|---|
| 50 | echo "Error running $TREEPROG: 'outtree' not generated" |
|---|
| 51 | else |
|---|
| 52 | if [ \! -s outtree ] ; then |
|---|
| 53 | echo "Error running $TREEPROG: 'outtree' is empty" |
|---|
| 54 | rm outtree |
|---|
| 55 | else |
|---|
| 56 | mv -f outtree intree |
|---|
| 57 | rm outfile |
|---|
| 58 | arb_echo y | consense |
|---|
| 59 | #consense |
|---|
| 60 | |
|---|
| 61 | if [ \! -f outtree ] ; then |
|---|
| 62 | echo "Error running consense: 'outtree' not generated" |
|---|
| 63 | fi |
|---|
| 64 | fi |
|---|
| 65 | fi |
|---|
| 66 | fi |
|---|
| 67 | fi |
|---|