-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathrun_empirical_validation.sh
63 lines (48 loc) · 2.08 KB
/
run_empirical_validation.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
#!/bin/bash
source ./Empirical_validation.cfg
train_bam=${1}
test_bam=${2}
cnv_bed=${3}
output_base=${4}
if [ $# -ne 4 ]
then
echo "usage: [script.sh] [directory for TRAINING bam files] [directory for sets of TESTING bam files] [CNV list] [base name for output file]"
echo "*** Bam files for each testing set need to be grouped as a directory"
exit 1
fi
out_dir="output_"${output_base}
if [ -d ${out_dir} ]
then
echo "[error] output directory \"${out_dir}\" already exists"
exit 1
fi
mkdir ${out_dir}
bam_list=${out_dir}/${output_base}"_bam_list.txt"
mkdir ${out_dir}/cpmMatrix
mkdir ${out_dir}/incidenceMatrix
echo ${test_bam}
echo "=================================================="
echo "calculating CPM ..."
echo " =============================="
${path_to_python} ./backend/CalculateCoverageMatrix.py ${train_bam} ${cnv_bed} ${mappingCutoff} ${readCutoff} ${path_to_samtools} ${path_to_bedtools} ./${out_dir}/"cpmMatrix/train"
for i in `ls ${test_bam}`
do
echo " =============================="
echo " > sample "${i}
${path_to_python} ./backend/CalculateCoverageMatrix_empirical.py ${i} ${cnv_bed} ${mappingCutoff} ${readCutoff} ${path_to_samtools} ${path_to_bedtools} ./${out_dir}/"cpmMatrix/"${i} ${test_bam}
${path_to_rscript} ./backend/plot_bean_CPM_validation.R ./${out_dir}/"cpmMatrix/"${i}"_cpmMatrix.csv" ./${out_dir}/"cpmMatrix/train_cpmMatrix.csv" ./${out_dir}/"incidenceMatrix/"${i}"_result" ${fdrCutoff}
done
echo "=================================================="
echo "calculating FDR ..."
rm -rf ${out_dir}"/incidenceMatrix/"*"_result.pdf"
cd ${out_dir}"/incidenceMatrix"
touch ${output_base}"_result.txt"
ls >> ${output_base}"_result.txt"
cd ..
cd ..
${path_to_perl} ./backend/process_empirical_Val_result.pl ${output_base} ${out_dir}"/incidenceMatrix/"${output_base}"_result.txt" ${out_dir}"/"${output_base}"_FDRs_for_Boxplot.txt"
echo "=================================================="
echo "drawing box plot ..."
${path_to_rscript} ./backend/plot_Boxplot.R ${out_dir} ${output_base} "empirical validation"
rm -rf ${out_dir}"/cpmMatrix"
rm -rf ${out_dir}"/incidenceMatrix"