-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreequar.sh
More file actions
executable file
·63 lines (61 loc) · 1.51 KB
/
treequar.sh
File metadata and controls
executable file
·63 lines (61 loc) · 1.51 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
link_on=0 #efficient quartets off by default
check_on=0 #check quartet off by default
if [ $# -eq 0 ]
then
echo "Need arguments in form ./treequar.sh [opts] tree_file output_file"
exit 1
fi
while getopts ":ec" opt
do
case $opt in
l)
link_on=1
;;
c)
check_on=1
;;
\?)
echo "Invalid Option: -$OPTARG"
;;
esac
done
shift $((OPTIND-1))
arr=("$@")
infile=${arr[0]}
if [ ${#arr[@]} -eq 2 ]
then
outfile=${arr[1]}
else
outfile="quarfile" #default quartet filename
fi
#intree & intree2 are input files to treedist
intree="intree"
intree2="intree2"
echo -n "`cat $infile > $intree`"
distopts="R\nD\n2\nC\nV\nY\n"
if [ $check_on -eq 1 ] #infile is a list of trees, run all in maxcut and check with treedist
then
echo -n "`echo -n "" > $intree2`" #clear intree2 file
echo -n "`echo -e "\n" >> $intree`" #put new line at end of file incase there isnt one already
while read -r line && [[ -n $line ]]
do
tree=$line
echo -n "`echo "$tree" > temp`" #input for treemeth.py
if [ $link_on -eq 1 ]
then
echo "`python2.7 treemeth.py temp $outfile link`"
else
echo "`python2.7 treemeth.py temp $outfile`"
fi
echo -n "`./find-cut-Linux-64 qrtt=$outfile otre=temp`" #run max cut on results
echo -n "`cat temp >> $intree2`" #add result to intree2
done < $intree
echo "`echo -e $distopts | ./treedist`"
echo "treedist run, look in outfile for result"
elif [ $link_on -eq 1 ]
then
echo "`python2.7 treemeth.py $infile $outfile link`"
else
echo "`python2.7 treemeth.py $infile $outfile`"
fi