-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript-get_tree_space_config-simple.sh
executable file
·80 lines (69 loc) · 1.88 KB
/
script-get_tree_space_config-simple.sh
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
#-------------------------------------------------------------------------------------------
# Arguments
taxa="$1"
if [ "$taxa" == "" ]
then
echo "you did not specify the taxon number!"
echo "exiting..."
exit
fi
part="$2"
if [ "$part" == "" ]
then
echo "you did not specify the partition number!"
echo "exiting..."
exit
fi
id="$3"
if [ "$id" == "" ]
then
echo "you did not specify the coverage id!"
echo "exiting..."
exit
fi
f_path="$4" # either pass it from the previous script or write here the hard path
if [ "$f_path" == "" ]
then
echo "you did not specify the path to terrace_analysis folder!"
echo "exiting..."
exit
fi
#-------------------------------------------------------------------------------------------
# Folders
f_scripts=$f_path/terrace_analysis/scripts
f_work=$f_path/terrace_analysis/data/datasets_${taxa}_taxa/part_${part}/cov_${taxa}_${id}
#-------------------------------------------------------------------------------------------
# Scripts
script="$f_scripts/script-get_tree_space_config-simple.sh"
iqtree="iqtree"
#-------------------------------------------------------------------------------------------
f_rfdist=$f_work/rfdist
f_tsc=$f_work/tree_space_config
file_tsc=$f_tsc/TSG_map_tree_terrace
file_trees=$f_tsc/trees_in_terrace_order
mkdir $f_tsc
if [ -e $file_tsc ]
then
rm $file_tsc
fi
if [ -e $file_trees ]
then
rm $file_tsc
fi
totalNUM="`ls $f_rfdist/terrace_*.terrace_ON | wc -l | awk -F " " '{print $1}'`"
NUM=0
while [ $NUM -ne $totalNUM ]
do
NUM=$[$NUM+1]
i=$f_rfdist/terrace_${NUM}.terrace_ON
echo "$i"
cat $i >> $file_trees
size="`wc -l $i | awk -F " " '{print $1}'`"
while [ $size -ne 0 ]
do
size=$[$size - 1]
echo "$NUM" >> $file_tsc
done
done
$iqtree -rf_all $file_trees