Skip to content

Commit

Permalink
Add tests for variant input
Browse files Browse the repository at this point in the history
The current test for the -@ parameter is this:

is $(freebayes -f tiny/q.fa -@ tiny/q.vcf.gz tiny/NA12878.chr22.tiny.bam | grep -v "^#" | wc -l) 19

but this also passes without the variant input flag:

is $(freebayes -f tiny/q.fa tiny/NA12878.chr22.tiny.bam | grep -v "^#" | wc -l) 19

So, it's not really constraining the behavior of -@ very much. This commit
adds two test that use a vcf with fake variants at q:500, q:1000, and q:11000
and checks that they appear in the output vcf or that only they appear in the
output vcf when -l is used.
  • Loading branch information
Marcus Kinsella committed Sep 17, 2015
1 parent c003c1e commit 1781ed4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/t/01_call_variants.t
Expand Up @@ -5,7 +5,7 @@ BASH_TAP_ROOT=bash-tap

PATH=../bin:$PATH # for freebayes

plan tests 6
plan tests 8

is $(echo "$(comm -12 <(cat tiny/NA12878.chr22.tiny.giab.vcf | grep -v "^#" | cut -f 2 | sort) <(freebayes -f tiny/q.fa tiny/NA12878.chr22.tiny.bam | grep -v "^#" | cut -f 2 | sort) | wc -l) >= 13" | bc) 1 "variant calling recovers most of the GiAB variants in a test region"

Expand Down Expand Up @@ -70,3 +70,8 @@ is $(samtools view tiny/NA12878.chr22.tiny.bam | wc -l) $(freebayes -f tiny/q.fa
# ensure targeting works even when there are no reads
is $(freebayes -f tiny/q.fa -@ tiny/q.vcf.gz tiny/NA12878.chr22.tiny.bam | grep -v "^#" | wc -l) 19 "freebayes correctly handles variant input"
# ensure that positions at which no variants exist get put in the out vcf
is $(freebayes -f tiny/q.fa -@ tiny/q_spiked.vcf.gz tiny/NA12878.chr22.tiny.bam | grep -v "^#" | cut -f1,2 | grep -P "(\t500$|\t11000$|\t1000$)" | wc -l) 3 "freebayes puts required variants in output"
is $(freebayes -f tiny/q.fa -@ tiny/q_spiked.vcf.gz tiny/NA12878.chr22.tiny.bam -l | grep -v "^#" | wc -l) 3 "freebayes limits calls to input variants correctly"
Binary file added test/tiny/q_spiked.vcf.gz
Binary file not shown.
Binary file added test/tiny/q_spiked.vcf.gz.tbi
Binary file not shown.

0 comments on commit 1781ed4

Please sign in to comment.