-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_run
executable file
·136 lines (126 loc) · 4.22 KB
/
test_run
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
function print_help()
{
message=( \
"Testing Script help\n\n" \
" The testing script runs the full pipeline, testing both kernels by default.\n" \
" \t\"help\" prints this brief manual\n" \
" The first argument is the type of test that you want to run:\n" \
" \t\"vcf\" tests qLD-parse-VCF\n" \
" \t\"mdf\" tests qLD-parse-2MDF\n" \
" \t\"compute\" tests qLD-compute\n" \
" \t\"full\" tests all components\n\n" \
" The second argument is used only in tests that include \"compute\"\n" \
" It is set to \"all\" by default:\n" \
" \t\"blis\" runs only using the blis kernel\n" \
" \t\"gpu\" runs only using the OpenCL kernel\n" \
" \t\"fallback\" runs only using the fallback mode\n" \
" \t\"all\" runs all previous modes\n" \
" An example of the default command if we used arguments:\n" \
" ./test_run full all\n"
)
printf "${message[*]}"
exit 0
}
run=${1:-full}
mode=${2:-all}
r2_lim=0.6
threads=1
vcf_dir="$(pwd)/test_dataset/vcf"
inp_dir="$(pwd)/test_dataset/input"
out_dir="$(pwd)/test_dataset/output"
vcf_file="$vcf_dir/test_covid.vcf.gz"
inp_file=$inp_dir/covid_19
mdf_file=$inp_dir/MDF_covid_19
out_file=$out_dir/blis/covid_19_report.txt
out_g_file=$out_dir/gpu/covid_19_report.txt
out_fb_file=$out_dir/fallback/covid_19_report.txt
[[ $run = "help" ]] && print_help
echo Testing qLD on COVID-19 dataset
echo -------------------------------
echo
sleep 1
if [[ $run = "full" || $run = "vcf" ]]
then
[ -d $inp_dir ] || mkdir -p $inp_dir
[ -z "$(ls -A $inp_file 2> /dev/null)" ] || rm -rf $inp_file
echo
echo "Parsing VCF file with qLD-parse-VCF (needed only once per dataset)"
echo "-----------------------------------------------------------------"
./bin/qLD-parse-VCF -input $vcf_file \
-output $inp_file \
-chrom 1 \
-size 1
fi
if [[ $run = "full" || $run = "mdf" ]]
then
[ -d $inp_dir ] || mkdir -p $inp_dir
[ -z "$(ls -A $mdf_file 2> /dev/null)" ] || rm -rf $mdf_file
echo
echo "Creating MDF files with qLD-parse-2MDF (needed only once per dataset)"
echo "---------------------------------------------------------------------"
echo
./bin/qLD-parse-2MDF -input $inp_file -output $mdf_file
fi
if [[ $run = "full" || $run = "compute" ]]
then
echo
echo Running Computations with the selected modes:
echo ---------------------------------------------
input="$inp_file"
[ -d $mdf_file ] && { mdf="-mdf"; input="$mdf_file"; }
[ -d $out_dir ] || mkdir -p $out_dir
[ -z "$(ls -A $out_dir 2> /dev/null)" ] || rm -rf $out_dir/*
if [[ $mode = "all" || $mode = "blis" ]]
then
[ -d $out_dir/blis ] || mkdir -p $out_dir/blis
echo
./bin/qLD-compute \
-input $input \
-output $out_file \
-r2limit $r2_lim \
-ploidy haploid \
$mdf \
-blis \
2>&1 | tee $out_dir/blis/log.txt
mv input_report.txt thread_* $out_dir/blis 2>/dev/null; true;
fi
if [[ $mode = "all" || $mode = "gpu" ]]
then
[ -d $out_dir/gpu ] || mkdir -p $out_dir/gpu
echo
./bin/qLD-compute \
-input $input \
-output $out_g_file \
-r2limit $r2_lim \
-ploidy haploid \
$mdf \
-gpu \
2>&1 | tee $out_dir/gpu/log.txt
mv input_report.txt thread_* $out_dir/gpu 2>/dev/null; true;
fi
if [[ $mode = "all" || $mode = "fallback" ]]
then
[ -d $out_dir/fallback ] || mkdir -p $out_dir/fallback
echo
./bin/qLD-compute \
-input $input \
-output $out_fb_file \
-r2limit $r2_lim \
-ploidy haploid \
$mdf \
2>&1 | tee $out_dir/fallback/log.txt
mv input_report.txt thread_* $out_dir/fallback 2>/dev/null; true;
fi
fi
if [[ $run = "full" || $run = "heatmap" ]]
then
echo
echo "Creating heatmap for blis output:"
echo "---------------------------------"
echo
python3 utilities/heatmap_viewer.py $out_file $out_dir/blis
fi
echo
echo Operation finished
exit 0