3 # integrative subcmds testing
6 echo "Run all tests for subcommands of MACS2. Need 1 parameter for a tag name! A unique string combining date, time and MACS2 version is recommended. ./test.sh <TAG>"
10 # test all sub-commands
13 CHIP
=CTCF_SE_ChIP_chr22_50k.bed.gz
14 CTRL
=CTCF_SE_CTRL_chr22_50k.bed.gz
16 CHIPPE
=CTCF_PE_ChIP_chr22_50k.bam
17 CTRLPE
=CTCF_PE_CTRL_chr22_50k.bam
19 CHIPBEDPE
=CTCF_PE_ChIP_chr22_50k.bedpe.gz
20 CTRLBEDPE
=CTCF_PE_CTRL_chr22_50k.bedpe.gz
22 CHIPCONTIGS50K
=contigs50k.bed.gz
24 CHIPBIGSPEEDTEST
=CTCF_12878_5M.bed.gz
25 CTRLBIGSPEEDTEST
=input_12878_5M.bed.gz
30 mkdir
${TAG}_run_callpeak_pe_narrow
31 mkdir
${TAG}_run_callpeak_narrow
33 macs2 callpeak
-g 52000000 -t $CHIP -c $CTRL -n run_callpeak_narrow0
-B --outdir ${TAG}_run_callpeak_narrow
--cutoff-analysis &> ${TAG}_run_callpeak_narrow
/run_callpeak_narrow0.log
35 cat ${TAG}_run_callpeak_narrow
/run_callpeak_narrow0.log
37 macs2 callpeak
-g 52000000 -f BAMPE
-t $CHIPPE -c $CTRLPE -n run_callpeak_bampe_narrow
-B --outdir ${TAG}_run_callpeak_pe_narrow
--call-summits --verbose 3 &> ${TAG}_run_callpeak_pe_narrow
/run_callpeak_bampe_narrow.log
39 cat ${TAG}_run_callpeak_pe_narrow
/run_callpeak_bampe_narrow.log
41 echo "2. search for errors or warnings in log files"
43 for i
in `ls ${TAG}_run_*/*.log`;do
44 echo " checking $i..."
45 egrep -A 2 -B 2 -i "error|warning" $i;
47 echo " ... error/warning found!"
54 if [[ $flag == 1 ]]; then
55 echo " Error or Warning can be found! Quit the test!"
59 echo "3. compare with standard outputs"
62 # we do not check the consistency of random subsampling results
63 subfolders
=(callpeak_pe_narrow callpeak_narrow
)
67 for i
in ${subfolders[@]};do
70 for j
in `ls standard_results_${i}/*`; do
73 echo "14.${m}.${n} checking $i $k ..."
74 fq
=${TAG}_run_${i}/${k}
75 fs
=standard_results_
${i}/${k}
76 if [ ! -f "$fq" ]; then
81 d
=`diff tmp_fq.txt tmp_fs.txt`
85 echo " ... failed! Difference:"
86 diff tmp_fq.txt tmp_fs.txt |
head -10
91 rm -f tmp_fq.txt tmp_fs.txt
93 # exit with 1 if test fails
94 if [ $flag -eq 1 ];then