File: simple_test.sh

package info (click to toggle)
mindthegap 2.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,076 kB
  • sloc: cpp: 4,482; python: 917; sh: 419; makefile: 5
file content (108 lines) | stat: -rwxr-xr-x 3,380 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

testOK="true"

run_test()
{
    # param : reads_file ref_file true_result prefix
    MindTheGap find -in $1 -ref $2 -kmer-size 31 -out output/$4_find $5 1> output/$4_find.out 2> output/$4_find.err

    MindTheGap fill -bkpt output/$4_find.breakpoints -graph output/$4_find.h5  -out output/$4_fill 1> output/$4_fill.out 2> output/$4_fill.err

    tmp1=output/$4_fill.insertions.fasta.tmp
    tmp2=output/tmp2

    grep -v "^>" output/$4_fill.insertions.fasta > $tmp1
    grep -v "^>" $3 > $tmp2


    diff $tmp1 $tmp2 1> /dev/null 2>&1
    
	var=$?
    if [ $var -eq 0 ]
    then
	     eval $6="passed"
    else
	     testOK="false" ; eval $6="FAILED"
    fi
}



run_test_vcf()
{
# param : reads_file ref_file true_result prefix
	MindTheGap find -in $1 -ref $2 -kmer-size 31 -out output/$4_find $5 1> output/$4_find.out 2> output/$4_find.err

	sh compare_vcf.sh output/$4_find.othervariants.vcf  $3 1> /dev/null 2>&1

	var=$?
	if [ $var -eq 0 ]
	then
		eval $6="passed"
	else
		testOK="false" ; eval $6="FAILED"
	fi
}


mkdir -p output
output=""

output=$output"clean-insert : "
run_test reads/master.fasta references/deleted.fasta truths/insertion.fasta k-1 "-insert-only" retvalue
output=${output}${retvalue}

output=$output"\n13-inserts-ref10k : "
run_test reads/readref10K.fasta  references/g10K_del.fasta truths/insert_ref10K.fasta 13i "-insert-only" retvalue
output=${output}${retvalue}

output=$output"\n1-SNP : "
run_test_vcf reads/master.fasta references/sSNP.fasta truths/truth_snp.vcf sSNP "-snp-only" retvalue
output=${output}${retvalue}

output=$output"\n3-SNP*2 : "
run_test_vcf reads/master.fasta references/multiSNP.fasta truths/multiSNP.vcf multiSNP "-snp-only" retvalue
output=${output}${retvalue}


output=$output"\nsnp-before-clean-insert : "
run_test reads/master.fasta references/deleted_before_SNP.fasta truths/insertion_before_SNP.fasta k-1_before_SNP "-no-deletion -homo-only" retvalue
output=${output}${retvalue}

#output=$output"\nsnp-begin-fuzzy : "
#run_test reads/beginfuzzySNP.fasta references/beginfuzzySNP.fasta truths/beginfuzzySNP.fasta beginfuzzySNP "-snp-only" retvalue
#output=${output}${retvalue}

output=$output"\nhetero-insert : "
run_test reads/deleted.fasta,reads/master.fasta references/deleted.fasta truths/insertion.fasta hete "-hete-only -max-rep 2" retvalue
output=${output}${retvalue}

output=$output"\ndeletion : "
run_test reads/deleted.fasta references/master.fasta truths/deletion.fasta deletion "-deletion-only" retvalue
output=${output}${retvalue}

output=$output"\nfuzzy-deletion : "
run_test reads/deletionfuzzy.fasta references/deletionfuzzy.fasta truths/deletionfuzzy.fasta deletionfuzzy "-deletion-only" retvalue
output=${output}${retvalue}

output=$output"\nn-in-solid-stretch : "
run_test reads/master.fasta references/n_in_stretch.fasta truths/n_in_stretch.fasta n_in_stretch "-insert-only" retvalue
output=${output}${retvalue}

output=$output"\nn-in-before-clean-insert : "
run_test reads/master.fasta references/n_before_gap.fasta truths/n_before_gap.fasta n_before_gap "-insert-only" retvalue
output=${output}${retvalue}

output=$output"\nn-after-clean-insert : "
run_test reads/master.fasta references/n_after_gap.fasta truths/n_after_gap.fasta n_after_gap "-insert-only" retvalue
output=${output}${retvalue}

echo -e $output | column -t


rm -rf output/

if [ $testOK == "false" ]; then
  exit 1
fi