source: tags/cvs_2_svn/SH/arb_protml

Last change on this file was 2713, checked in by westram, 20 years ago
  • added info message about fixed protml crash
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1#!/bin/bash -x
2# renames output to 'treefile'
3
4if [ -f treefile ]; then
5    rm treefile
6fi
7
8if [ -z "$5" ]; then
9    arb_message "Usage: arb_protml modelflag searchflag rearrange calclengths inputfile"
10else
11    MODEL=$1
12    SEARCH=$2
13    REARRANGE=$3
14    CALCLENGTH=$4
15    INFILE=$5
16
17    if [ \! -s $INFILE ]; then
18        arb_message "Error: no or empty input file"
19        ls -al $INFILE
20    else
21        FLAGS="-v $MODEL"
22        if [ \! "$REARRANGE" = "0" ]; then
23            if [ "$SEARCH" = "-s" ]; then
24                arb_message "You have selected 'Star decomposition search' AND 'Rearrangement'.\n  Original protml crashed with this parameter combination.\n  We fixed protml, but we did not check the results\n  - so use them with care!"
25            fi
26            FLAGS="$FLAGS $REARRANGE"
27        fi
28
29        # normal tree generation with protml
30        echo >arb_read_tree_args
31        if [ "$SEARCH" = "-s" ]; then
32            if [ "$CALCLENGTH" = "0" ]; then
33                arb_message "Note: Star decomposition search always calculates branchlengths"
34            fi
35            # Star decomposition search (may not be the ML tree)
36            protml $FLAGS -I -s $INFILE
37        else
38            # Exhaustive search or quickadd
39            protml $FLAGS -I $SEARCH $INFILE | tail -1 >outtree # write last tree to outtree
40
41            if [ -s outtree ]; then
42                if [ "$CALCLENGTH" = "1" ]; then
43                    echo "1" >intree #no of trees
44                    cat outtree >>intree
45                    protml -v $MODEL -u -I $INFILE intree # calculates branch lengths
46                else
47                    mv outtree protml.tre
48                fi
49            else
50                arb_message "Error running protml: outtree is empty"
51            fi
52        fi
53
54        if [ \! -s protml.tre ]; then
55            arb_message "Error running protml: protml.tre was not generated or is empty"
56        else
57            mv protml.tre treefile
58        fi
59    fi
60
61    # remove protml junk:
62    rm protml.eps protml.tpl
63fi
64
Note: See TracBrowser for help on using the repository browser.