ngs_server 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ngs_server +72 -50
- data/ext/bamtools/extconf.rb +3 -3
- data/ext/vcftools/Makefile +28 -0
- data/ext/vcftools/README.txt +36 -0
- data/ext/vcftools/cpp/.svn/all-wcprops +125 -0
- data/ext/vcftools/cpp/.svn/dir-prop-base +6 -0
- data/ext/vcftools/cpp/.svn/entries +708 -0
- data/ext/vcftools/cpp/.svn/text-base/Makefile.svn-base +46 -0
- data/ext/vcftools/cpp/.svn/text-base/dgeev.cpp.svn-base +146 -0
- data/ext/vcftools/cpp/.svn/text-base/dgeev.h.svn-base +43 -0
- data/ext/vcftools/cpp/.svn/text-base/output_log.cpp.svn-base +79 -0
- data/ext/vcftools/cpp/.svn/text-base/output_log.h.svn-base +34 -0
- data/ext/vcftools/cpp/.svn/text-base/parameters.cpp.svn-base +535 -0
- data/ext/vcftools/cpp/.svn/text-base/parameters.h.svn-base +154 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_entry.cpp.svn-base +497 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_entry.h.svn-base +190 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_entry_getters.cpp.svn-base +421 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_entry_setters.cpp.svn-base +482 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file.cpp.svn-base +495 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file.h.svn-base +184 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_diff.cpp.svn-base +1282 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_filters.cpp.svn-base +1215 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_format_convert.cpp.svn-base +1138 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_index.cpp.svn-base +171 -0
- data/ext/vcftools/cpp/.svn/text-base/vcf_file_output.cpp.svn-base +3012 -0
- data/ext/vcftools/cpp/.svn/text-base/vcftools.cpp.svn-base +107 -0
- data/ext/vcftools/cpp/.svn/text-base/vcftools.h.svn-base +25 -0
- data/ext/vcftools/cpp/Makefile +46 -0
- data/ext/vcftools/cpp/dgeev.cpp +146 -0
- data/ext/vcftools/cpp/dgeev.h +43 -0
- data/ext/vcftools/cpp/output_log.cpp +79 -0
- data/ext/vcftools/cpp/output_log.h +34 -0
- data/ext/vcftools/cpp/parameters.cpp +535 -0
- data/ext/vcftools/cpp/parameters.h +154 -0
- data/ext/vcftools/cpp/vcf_entry.cpp +497 -0
- data/ext/vcftools/cpp/vcf_entry.h +190 -0
- data/ext/vcftools/cpp/vcf_entry_getters.cpp +421 -0
- data/ext/vcftools/cpp/vcf_entry_setters.cpp +482 -0
- data/ext/vcftools/cpp/vcf_file.cpp +495 -0
- data/ext/vcftools/cpp/vcf_file.h +184 -0
- data/ext/vcftools/cpp/vcf_file_diff.cpp +1282 -0
- data/ext/vcftools/cpp/vcf_file_filters.cpp +1215 -0
- data/ext/vcftools/cpp/vcf_file_format_convert.cpp +1138 -0
- data/ext/vcftools/cpp/vcf_file_index.cpp +171 -0
- data/ext/vcftools/cpp/vcf_file_output.cpp +3012 -0
- data/ext/vcftools/cpp/vcftools.cpp +107 -0
- data/ext/vcftools/cpp/vcftools.h +25 -0
- data/ext/vcftools/examples/.svn/all-wcprops +185 -0
- data/ext/vcftools/examples/.svn/dir-prop-base +6 -0
- data/ext/vcftools/examples/.svn/entries +1048 -0
- data/ext/vcftools/examples/.svn/prop-base/perl-api-1.pl.svn-base +5 -0
- data/ext/vcftools/examples/.svn/text-base/annotate-test.vcf.svn-base +37 -0
- data/ext/vcftools/examples/.svn/text-base/annotate.out.svn-base +23 -0
- data/ext/vcftools/examples/.svn/text-base/annotate.txt.svn-base +7 -0
- data/ext/vcftools/examples/.svn/text-base/annotate2.out.svn-base +52 -0
- data/ext/vcftools/examples/.svn/text-base/annotate3.out.svn-base +23 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test-a-3.3.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test-a.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test-b-3.3.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test-b.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/cmp-test.out.svn-base +53 -0
- data/ext/vcftools/examples/.svn/text-base/concat-a.vcf.svn-base +21 -0
- data/ext/vcftools/examples/.svn/text-base/concat-b.vcf.svn-base +13 -0
- data/ext/vcftools/examples/.svn/text-base/concat-c.vcf.svn-base +19 -0
- data/ext/vcftools/examples/.svn/text-base/concat.out.svn-base +39 -0
- data/ext/vcftools/examples/.svn/text-base/invalid-4.0.vcf.svn-base +31 -0
- data/ext/vcftools/examples/.svn/text-base/isec-n2-test.vcf.out.svn-base +19 -0
- data/ext/vcftools/examples/.svn/text-base/merge-test-a.vcf.svn-base +17 -0
- data/ext/vcftools/examples/.svn/text-base/merge-test-b.vcf.svn-base +17 -0
- data/ext/vcftools/examples/.svn/text-base/merge-test-c.vcf.svn-base +15 -0
- data/ext/vcftools/examples/.svn/text-base/merge-test.vcf.out.svn-base +31 -0
- data/ext/vcftools/examples/.svn/text-base/perl-api-1.pl.svn-base +46 -0
- data/ext/vcftools/examples/.svn/text-base/query-test.out.svn-base +6 -0
- data/ext/vcftools/examples/.svn/text-base/shuffle-test.vcf.svn-base +12 -0
- data/ext/vcftools/examples/.svn/text-base/subset.SNPs.out.svn-base +10 -0
- data/ext/vcftools/examples/.svn/text-base/subset.indels.out.svn-base +18 -0
- data/ext/vcftools/examples/.svn/text-base/subset.vcf.svn-base +21 -0
- data/ext/vcftools/examples/.svn/text-base/valid-3.3.vcf.svn-base +30 -0
- data/ext/vcftools/examples/.svn/text-base/valid-4.0.vcf.stats.svn-base +104 -0
- data/ext/vcftools/examples/.svn/text-base/valid-4.0.vcf.svn-base +34 -0
- data/ext/vcftools/examples/.svn/text-base/valid-4.1.vcf.svn-base +37 -0
- data/ext/vcftools/examples/annotate-test.vcf +37 -0
- data/ext/vcftools/examples/annotate.out +23 -0
- data/ext/vcftools/examples/annotate.txt +7 -0
- data/ext/vcftools/examples/annotate2.out +52 -0
- data/ext/vcftools/examples/annotate3.out +23 -0
- data/ext/vcftools/examples/cmp-test-a-3.3.vcf +12 -0
- data/ext/vcftools/examples/cmp-test-a.vcf +12 -0
- data/ext/vcftools/examples/cmp-test-b-3.3.vcf +12 -0
- data/ext/vcftools/examples/cmp-test-b.vcf +12 -0
- data/ext/vcftools/examples/cmp-test.out +53 -0
- data/ext/vcftools/examples/concat-a.vcf +21 -0
- data/ext/vcftools/examples/concat-b.vcf +13 -0
- data/ext/vcftools/examples/concat-c.vcf +19 -0
- data/ext/vcftools/examples/concat.out +39 -0
- data/ext/vcftools/examples/invalid-4.0.vcf +31 -0
- data/ext/vcftools/examples/isec-n2-test.vcf.out +19 -0
- data/ext/vcftools/examples/merge-test-a.vcf +17 -0
- data/ext/vcftools/examples/merge-test-b.vcf +17 -0
- data/ext/vcftools/examples/merge-test-c.vcf +15 -0
- data/ext/vcftools/examples/merge-test.vcf.out +31 -0
- data/ext/vcftools/examples/perl-api-1.pl +46 -0
- data/ext/vcftools/examples/query-test.out +6 -0
- data/ext/vcftools/examples/shuffle-test.vcf +12 -0
- data/ext/vcftools/examples/subset.SNPs.out +10 -0
- data/ext/vcftools/examples/subset.indels.out +18 -0
- data/ext/vcftools/examples/subset.vcf +21 -0
- data/ext/vcftools/examples/valid-3.3.vcf +30 -0
- data/ext/vcftools/examples/valid-4.0.vcf +34 -0
- data/ext/vcftools/examples/valid-4.0.vcf.stats +104 -0
- data/ext/vcftools/examples/valid-4.1.vcf +37 -0
- data/ext/vcftools/extconf.rb +2 -0
- data/ext/vcftools/perl/.svn/all-wcprops +149 -0
- data/ext/vcftools/perl/.svn/entries +844 -0
- data/ext/vcftools/perl/.svn/prop-base/fill-aa.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/fill-an-ac.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/fill-ref-md5.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/tab-to-vcf.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/test.t.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-annotate.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-compare.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-concat.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-convert.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-fix-newlines.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-isec.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-merge.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-query.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-shuffle-cols.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-sort.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-stats.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-subset.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-to-tab.svn-base +5 -0
- data/ext/vcftools/perl/.svn/prop-base/vcf-validator.svn-base +5 -0
- data/ext/vcftools/perl/.svn/text-base/ChangeLog.svn-base +84 -0
- data/ext/vcftools/perl/.svn/text-base/FaSlice.pm.svn-base +214 -0
- data/ext/vcftools/perl/.svn/text-base/Makefile.svn-base +12 -0
- data/ext/vcftools/perl/.svn/text-base/Vcf.pm.svn-base +2853 -0
- data/ext/vcftools/perl/.svn/text-base/VcfStats.pm.svn-base +681 -0
- data/ext/vcftools/perl/.svn/text-base/fill-aa.svn-base +103 -0
- data/ext/vcftools/perl/.svn/text-base/fill-an-ac.svn-base +56 -0
- data/ext/vcftools/perl/.svn/text-base/fill-ref-md5.svn-base +204 -0
- data/ext/vcftools/perl/.svn/text-base/tab-to-vcf.svn-base +92 -0
- data/ext/vcftools/perl/.svn/text-base/test.t.svn-base +376 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-annotate.svn-base +1099 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-compare.svn-base +1193 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-concat.svn-base +310 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-convert.svn-base +180 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-fix-newlines.svn-base +97 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-isec.svn-base +660 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-merge.svn-base +577 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-query.svn-base +272 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-shuffle-cols.svn-base +89 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-sort.svn-base +79 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-stats.svn-base +160 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-subset.svn-base +206 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-to-tab.svn-base +112 -0
- data/ext/vcftools/perl/.svn/text-base/vcf-validator.svn-base +145 -0
- data/ext/vcftools/perl/ChangeLog +84 -0
- data/ext/vcftools/perl/FaSlice.pm +214 -0
- data/ext/vcftools/perl/Makefile +12 -0
- data/ext/vcftools/perl/Vcf.pm +2853 -0
- data/ext/vcftools/perl/VcfStats.pm +681 -0
- data/ext/vcftools/perl/fill-aa +103 -0
- data/ext/vcftools/perl/fill-an-ac +56 -0
- data/ext/vcftools/perl/fill-ref-md5 +204 -0
- data/ext/vcftools/perl/tab-to-vcf +92 -0
- data/ext/vcftools/perl/test.t +376 -0
- data/ext/vcftools/perl/vcf-annotate +1099 -0
- data/ext/vcftools/perl/vcf-compare +1193 -0
- data/ext/vcftools/perl/vcf-concat +310 -0
- data/ext/vcftools/perl/vcf-convert +180 -0
- data/ext/vcftools/perl/vcf-fix-newlines +97 -0
- data/ext/vcftools/perl/vcf-isec +660 -0
- data/ext/vcftools/perl/vcf-merge +577 -0
- data/ext/vcftools/perl/vcf-query +286 -0
- data/ext/vcftools/perl/vcf-shuffle-cols +89 -0
- data/ext/vcftools/perl/vcf-sort +79 -0
- data/ext/vcftools/perl/vcf-stats +160 -0
- data/ext/vcftools/perl/vcf-subset +206 -0
- data/ext/vcftools/perl/vcf-to-tab +112 -0
- data/ext/vcftools/perl/vcf-validator +145 -0
- data/ext/vcftools/website/.svn/all-wcprops +41 -0
- data/ext/vcftools/website/.svn/entries +238 -0
- data/ext/vcftools/website/.svn/prop-base/VCF-poster.pdf.svn-base +5 -0
- data/ext/vcftools/website/.svn/prop-base/favicon.ico.svn-base +5 -0
- data/ext/vcftools/website/.svn/prop-base/favicon.png.svn-base +5 -0
- data/ext/vcftools/website/.svn/text-base/Makefile.svn-base +6 -0
- data/ext/vcftools/website/.svn/text-base/README.svn-base +2 -0
- data/ext/vcftools/website/.svn/text-base/VCF-poster.pdf.svn-base +0 -0
- data/ext/vcftools/website/.svn/text-base/default.css.svn-base +250 -0
- data/ext/vcftools/website/.svn/text-base/favicon.ico.svn-base +0 -0
- data/ext/vcftools/website/.svn/text-base/favicon.png.svn-base +0 -0
- data/ext/vcftools/website/Makefile +6 -0
- data/ext/vcftools/website/README +2 -0
- data/ext/vcftools/website/VCF-poster.pdf +0 -0
- data/ext/vcftools/website/default.css +250 -0
- data/ext/vcftools/website/favicon.ico +0 -0
- data/ext/vcftools/website/favicon.png +0 -0
- data/ext/vcftools/website/img/.svn/all-wcprops +53 -0
- data/ext/vcftools/website/img/.svn/entries +300 -0
- data/ext/vcftools/website/img/.svn/prop-base/bg.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/bgcode.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/bgcontainer.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/bgul.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/header.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/li.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/quote.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/prop-base/search.gif.svn-base +5 -0
- data/ext/vcftools/website/img/.svn/text-base/bg.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/bgcode.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/bgcontainer.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/bgul.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/header.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/li.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/quote.gif.svn-base +0 -0
- data/ext/vcftools/website/img/.svn/text-base/search.gif.svn-base +0 -0
- data/ext/vcftools/website/img/bg.gif +0 -0
- data/ext/vcftools/website/img/bgcode.gif +0 -0
- data/ext/vcftools/website/img/bgcontainer.gif +0 -0
- data/ext/vcftools/website/img/bgul.gif +0 -0
- data/ext/vcftools/website/img/header.gif +0 -0
- data/ext/vcftools/website/img/li.gif +0 -0
- data/ext/vcftools/website/img/quote.gif +0 -0
- data/ext/vcftools/website/img/search.gif +0 -0
- data/ext/vcftools/website/src/.svn/all-wcprops +53 -0
- data/ext/vcftools/website/src/.svn/entries +300 -0
- data/ext/vcftools/website/src/.svn/text-base/docs.inc.svn-base +202 -0
- data/ext/vcftools/website/src/.svn/text-base/index.inc.svn-base +52 -0
- data/ext/vcftools/website/src/.svn/text-base/index.php.svn-base +80 -0
- data/ext/vcftools/website/src/.svn/text-base/license.inc.svn-base +27 -0
- data/ext/vcftools/website/src/.svn/text-base/links.inc.svn-base +13 -0
- data/ext/vcftools/website/src/.svn/text-base/options.inc.svn-base +654 -0
- data/ext/vcftools/website/src/.svn/text-base/perl_module.inc.svn-base +249 -0
- data/ext/vcftools/website/src/.svn/text-base/specs.inc.svn-base +18 -0
- data/ext/vcftools/website/src/docs.inc +202 -0
- data/ext/vcftools/website/src/index.inc +52 -0
- data/ext/vcftools/website/src/index.php +80 -0
- data/ext/vcftools/website/src/license.inc +27 -0
- data/ext/vcftools/website/src/links.inc +13 -0
- data/ext/vcftools/website/src/options.inc +654 -0
- data/ext/vcftools/website/src/perl_module.inc +249 -0
- data/ext/vcftools/website/src/specs.inc +18 -0
- data/lib/config.ru +9 -0
- data/lib/ngs_server/add.rb +9 -0
- data/lib/ngs_server/version.rb +1 -1
- data/lib/ngs_server.rb +55 -3
- data/ngs_server.gemspec +5 -2
- metadata +296 -6
@@ -0,0 +1,376 @@
|
|
1
|
+
#!/usr/bin/env perl
|
2
|
+
#
|
3
|
+
# Author: petr.danecek@sanger
|
4
|
+
#
|
5
|
+
# Usage: test.t [-d]
|
6
|
+
#
|
7
|
+
|
8
|
+
use strict;
|
9
|
+
use warnings;
|
10
|
+
use Carp;
|
11
|
+
use IPC::Open2;
|
12
|
+
use FindBin;
|
13
|
+
use lib "$FindBin::Bin";
|
14
|
+
use Vcf;
|
15
|
+
|
16
|
+
BEGIN {
|
17
|
+
use Test::Most tests => 34;
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
my $path = $FindBin::RealBin;
|
22
|
+
|
23
|
+
my $debug = ($ARGV[0] && $ARGV[0] eq '-d') ? 1 : 0;
|
24
|
+
|
25
|
+
test_bgzip_and_tabix("$path/../examples/merge-test-a.vcf");
|
26
|
+
test_validator($path,"$path/../examples/valid-3.3.vcf");
|
27
|
+
test_validator($path,"$path/../examples/valid-4.0.vcf");
|
28
|
+
test_validator($path,"$path/../examples/valid-4.1.vcf");
|
29
|
+
test_validator($path,"$path/../examples/floats.vcf");
|
30
|
+
test_format_validation($path,'3.3');
|
31
|
+
test_format_validation($path,'4.0');
|
32
|
+
test_format_validation($path,'4.1');
|
33
|
+
test_vcf_stats($path,"$path/../examples/valid-4.0.vcf");
|
34
|
+
test_empty_cols($path,'4.0');
|
35
|
+
test_merge($path,'merge-test.vcf.out','merge-test-a.vcf','merge-test-b.vcf','merge-test-c.vcf');
|
36
|
+
test_compare($path,'cmp-test-a.vcf','cmp-test-b.vcf','cmp-test.out');
|
37
|
+
test_isec($path,'-n +2','isec-n2-test.vcf.out','merge-test-a.vcf','merge-test-b.vcf','merge-test-c.vcf');
|
38
|
+
test_query_vcf("$path/../examples/",'cmp-test-a.vcf','query-test.out','%CHROM:%POS\tref=%REF\talt=%ALT\tqual=%QUAL\t%INFO/DP[\t%SAMPLE=%GT]\n');
|
39
|
+
test_shuffle("$path/../examples/",'cmp-test-a.vcf','shuffle-test.vcf');
|
40
|
+
test_concat("$path/../examples/",'concat.out','concat-a.vcf','concat-b.vcf','concat-c.vcf');
|
41
|
+
test_annotate("$path/../examples/",'-c FROM,TO,CHROM,-,-,-,INFO/HM2,INFO/GN,INFO/DP -d key=INFO,ID=HM2,Number=0,Type=Flag,Description="HapMap2 membership" -d key=INFO,ID=GN,Number=1,Type=String,Description="Gene Name" -d key=INFO,ID=DP,Number=0,Type=Integer,Description="Depth,etc"','annotate.out','concat-a.vcf','annotate.txt');
|
42
|
+
test_annotate("$path/../examples/",'-c FROM,TO,CHROM,ID,REF,ALT,INFO/HM2,INFO/GN,INFO/DP -d key=INFO,ID=HM2,Number=0,Type=Flag,Description="HapMap2 membership" -d key=INFO,ID=GN,Number=1,Type=String,Description="Gene Name" -d key=INFO,ID=DP,Number=0,Type=Integer,Description="Depth,etc"','annotate3.out','concat-a.vcf','annotate.txt');
|
43
|
+
test_annotate("$path/../examples/",'-f +/D=34/c=2,3','annotate2.out','annotate-test.vcf');
|
44
|
+
test_fill_an_ac("$path/../examples/",'fill-an-ac.out','concat-a.vcf');
|
45
|
+
test_api_event_type([qw(A C),'s 1 C'],[qw(A ACGT),'i 3 CGT'],[qw(ACGT A),'i -3 CGT'],[qw(ACGT ACT),'i -1 G'],
|
46
|
+
[qw(ACGT AAA),'o 3 AAA'],[qw(A .),'r 0 A'],[qw(A <ID>),'u 0 <ID>'],[qw(ACG AGC),'s 2 AGC'], [qw(A .A),'b'], [qw(A A.),'b']);
|
47
|
+
|
48
|
+
exit;
|
49
|
+
|
50
|
+
#--------------------------------------
|
51
|
+
|
52
|
+
sub test_bgzip_and_tabix
|
53
|
+
{
|
54
|
+
my ($file) = @_;
|
55
|
+
my $cmd;
|
56
|
+
|
57
|
+
$cmd = "cat $file | bgzip -c > $file.gz";
|
58
|
+
system($cmd);
|
59
|
+
is(0,$?,"Is bgzip OK? .. $cmd");
|
60
|
+
|
61
|
+
$cmd = "tabix $file.gz";
|
62
|
+
system($cmd);
|
63
|
+
is(0,$?,"Is tabix OK? .. $cmd");
|
64
|
+
}
|
65
|
+
|
66
|
+
sub test_validator
|
67
|
+
{
|
68
|
+
my ($path,$fname) = @_;
|
69
|
+
|
70
|
+
my $cmd = "perl -I$path -MVcf -e validate $fname";
|
71
|
+
my @out = `$cmd 2>&1`;
|
72
|
+
my @exp = ();
|
73
|
+
is_deeply(\@out,\@exp,"Testing validator .. $cmd");
|
74
|
+
}
|
75
|
+
|
76
|
+
sub test_format_validation
|
77
|
+
{
|
78
|
+
my ($path,$version) = @_;
|
79
|
+
|
80
|
+
my ($chld_in,$chld_out);
|
81
|
+
my $cmd = "perl -I$path -MVcf -e validate 2>&1";
|
82
|
+
my $pid = open2($chld_out, $chld_in, $cmd);
|
83
|
+
|
84
|
+
my $vcf = Vcf->new(version=>$version);
|
85
|
+
$vcf->recalc_ac_an(2);
|
86
|
+
$vcf->add_header_line({key=>'INFO', ID=>'AC',Number=>-1,Type=>'Integer',Description=>'Allele count in genotypes'});
|
87
|
+
$vcf->add_header_line({key=>'INFO', ID=>'AN',Number=>1,Type=>'Integer',Description=>'Total number of alleles in called genotypes'});
|
88
|
+
$vcf->add_header_line({key=>'FORMAT', ID=>'GT',Number=>1,Type=>'String',Description=>'Genotype'});
|
89
|
+
if ( $version >= 4.0 )
|
90
|
+
{
|
91
|
+
$vcf->add_header_line({key=>'ALT',ID=>'DEL:ME:ALU', Description=>'Deletion of ALU element'});
|
92
|
+
}
|
93
|
+
if ( $version >= 4.1 )
|
94
|
+
{
|
95
|
+
$vcf->add_header_line({key=>'reference',value=>'file:/some/file.fa'});
|
96
|
+
$vcf->add_header_line({key=>'contig',ID=>'1',length=>12345,md5=>'f126cdf8a6e0c7f379d618ff66beb2da',assembly=>'E.T.'});
|
97
|
+
}
|
98
|
+
$vcf->add_columns('NA0001','NA0002');
|
99
|
+
print $vcf->format_header() unless !$debug;
|
100
|
+
print $chld_in $vcf->format_header();
|
101
|
+
|
102
|
+
my %rec = ( CHROM=>1, POS=>1, REF=>'A', QUAL=>$$vcf{defaults}{QUAL}, FORMAT=>['GT'] );
|
103
|
+
$rec{gtypes}{NA0001}{GT} = 'A/A';
|
104
|
+
$rec{gtypes}{NA0002}{GT} = $$vcf{defaults}{GT};
|
105
|
+
$vcf->format_genotype_strings(\%rec);
|
106
|
+
print $vcf->format_line(\%rec) unless !$debug;
|
107
|
+
print $chld_in $vcf->format_line(\%rec);
|
108
|
+
|
109
|
+
$rec{POS} = 2;
|
110
|
+
$rec{gtypes}{NA0002}{GT} = 'IA|D1';
|
111
|
+
if ( $version >= 4.0 )
|
112
|
+
{
|
113
|
+
$rec{REF} = 'AC';
|
114
|
+
$rec{gtypes}{NA0002}{GT} = 'ATC|<DEL:ME:ALU>';
|
115
|
+
}
|
116
|
+
$vcf->format_genotype_strings(\%rec);
|
117
|
+
print $vcf->format_line(\%rec) unless !$debug;
|
118
|
+
print $chld_in $vcf->format_line(\%rec);
|
119
|
+
close($chld_in);
|
120
|
+
|
121
|
+
my @exp = ();
|
122
|
+
my @out = ();
|
123
|
+
while (my $line=<$chld_out>)
|
124
|
+
{
|
125
|
+
chomp($line);
|
126
|
+
push @out,$line;
|
127
|
+
}
|
128
|
+
close($chld_out);
|
129
|
+
waitpid $pid, 0;
|
130
|
+
|
131
|
+
if ( !is_deeply(\@out,\@exp,"Testing formatting followed by validation .. $cmd") )
|
132
|
+
{
|
133
|
+
print STDERR @out;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
sub test_vcf_stats
|
138
|
+
{
|
139
|
+
my ($path,$file) = @_;
|
140
|
+
my $cmd = "perl -I$path -MVcf $path/vcf-stats $file";
|
141
|
+
my @out = `$cmd 2>&1`;
|
142
|
+
open(my $fh,'<',"$file.stats") or confess("$file.stats: $!");
|
143
|
+
my @exp = <$fh>;
|
144
|
+
close($fh);
|
145
|
+
|
146
|
+
is_deeply(\@out,\@exp,"Testing vcf-stats .. $cmd");
|
147
|
+
}
|
148
|
+
|
149
|
+
sub test_empty_cols
|
150
|
+
{
|
151
|
+
my ($path,$version) = @_;
|
152
|
+
|
153
|
+
my ($header,$vcf,@out,$exp);
|
154
|
+
|
155
|
+
$vcf = Vcf->new(version=>$version);
|
156
|
+
$vcf->add_header_line({key=>'FORMAT', ID=>'GT',Number=>1,Type=>'String',Description=>'Genotype'});
|
157
|
+
$vcf->add_columns(qw(CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA0001));
|
158
|
+
$header = $vcf->format_header();
|
159
|
+
@out = split(/\n/,$header);
|
160
|
+
$exp = join("\t",qw(CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA0001));
|
161
|
+
is_deeply($out[-1],'#'.$exp,"Testing add_columns with genotypes full, $version.");
|
162
|
+
|
163
|
+
$vcf = Vcf->new(version=>$version);
|
164
|
+
$vcf->add_header_line({key=>'FORMAT', ID=>'GT',Number=>1,Type=>'String',Description=>'Genotype'});
|
165
|
+
$vcf->add_columns('NA0001');
|
166
|
+
$header = $vcf->format_header();
|
167
|
+
@out = split(/\n/,$header);
|
168
|
+
$exp = join("\t",qw(CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA0001));
|
169
|
+
is_deeply($out[-1],'#'.$exp,"Testing add_columns with genotypes brief, $version.");
|
170
|
+
|
171
|
+
$vcf = Vcf->new(version=>$version);
|
172
|
+
$vcf->add_header_line({key=>'FORMAT', ID=>'GT',Number=>1,Type=>'String',Description=>'Genotype'});
|
173
|
+
$vcf->add_columns();
|
174
|
+
$header = $vcf->format_header();
|
175
|
+
@out = split(/\n/,$header);
|
176
|
+
$exp = join("\t",qw(CHROM POS ID REF ALT QUAL FILTER INFO));
|
177
|
+
is_deeply($out[-1],'#'.$exp,"Testing add_columns brief, $version.");
|
178
|
+
|
179
|
+
$vcf = Vcf->new(version=>$version);
|
180
|
+
$vcf->add_header_line({key=>'FORMAT', ID=>'GT',Number=>1,Type=>'String',Description=>'Genotype'});
|
181
|
+
$vcf->add_columns('FORMAT');
|
182
|
+
$header = $vcf->format_header();
|
183
|
+
@out = split(/\n/,$header);
|
184
|
+
$exp = join("\t",qw(CHROM POS ID REF ALT QUAL FILTER INFO FORMAT));
|
185
|
+
is_deeply($out[-1],'#'.$exp,"Testing add_columns no gtypes, $version.");
|
186
|
+
}
|
187
|
+
|
188
|
+
sub test_compare
|
189
|
+
{
|
190
|
+
my ($path,$a,$b,$expected) = @_;
|
191
|
+
|
192
|
+
my $curdir = `pwd`;
|
193
|
+
chomp($curdir);
|
194
|
+
chdir("$path/../examples");
|
195
|
+
|
196
|
+
for my $file ($a,$b)
|
197
|
+
{
|
198
|
+
`cat $file | bgzip -c > $file.gz`;
|
199
|
+
`tabix -p vcf -f $file.gz`;
|
200
|
+
}
|
201
|
+
|
202
|
+
my $cmd = "perl -I../perl/ -MVcf ../perl/vcf-compare -g $a.gz $b.gz";
|
203
|
+
my @out = `$cmd 2>&1`;
|
204
|
+
open(my $fh,'<',"$expected") or confess("$expected: $!");
|
205
|
+
my @exp = <$fh>;
|
206
|
+
close($fh);
|
207
|
+
|
208
|
+
chdir($curdir);
|
209
|
+
|
210
|
+
is_deeply(\@out,\@exp,"Testing vcf-compare .. $cmd");
|
211
|
+
}
|
212
|
+
|
213
|
+
sub test_merge
|
214
|
+
{
|
215
|
+
my ($path,$expected,@files) = @_;
|
216
|
+
|
217
|
+
my $curdir = `pwd`;
|
218
|
+
chomp($curdir);
|
219
|
+
chdir("$path/../examples");
|
220
|
+
|
221
|
+
my $cmd = "perl -I../perl/ -MVcf ../perl/vcf-merge";
|
222
|
+
for my $file (@files)
|
223
|
+
{
|
224
|
+
`cat $file | bgzip -c > $file.gz; tabix -f -p vcf $file.gz`;
|
225
|
+
$cmd .= " $file.gz";
|
226
|
+
}
|
227
|
+
my @out = `$cmd 2>&1 | grep -v ^##source`;
|
228
|
+
open(my $fh,'<',$expected) or confess("$expected: $!");
|
229
|
+
my @exp = <$fh>;
|
230
|
+
close($fh);
|
231
|
+
|
232
|
+
chdir($curdir);
|
233
|
+
is_deeply(\@out,\@exp,"Testing vcf-merge .. $cmd");
|
234
|
+
}
|
235
|
+
|
236
|
+
sub test_isec
|
237
|
+
{
|
238
|
+
my ($path,$opts,$expected,@files) = @_;
|
239
|
+
|
240
|
+
my $curdir = `pwd`;
|
241
|
+
chomp($curdir);
|
242
|
+
chdir("$path/../examples");
|
243
|
+
|
244
|
+
my $cmd = "perl -I../perl/ -MVcf ../perl/vcf-isec -f $opts";
|
245
|
+
for my $file (@files)
|
246
|
+
{
|
247
|
+
`cat $file | bgzip -c > $file.gz; tabix -f -p vcf $file.gz`;
|
248
|
+
$cmd .= " $file.gz";
|
249
|
+
}
|
250
|
+
my @out = `$cmd 2>&1 | grep -v ^##source`;
|
251
|
+
open(my $fh,'<',$expected) or confess("$expected: $!");
|
252
|
+
my @exp = <$fh>;
|
253
|
+
close($fh);
|
254
|
+
|
255
|
+
chdir($curdir);
|
256
|
+
is_deeply(\@out,\@exp,"Testing vcf-isec .. $cmd");
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
sub test_query_vcf
|
261
|
+
{
|
262
|
+
my ($path,$file,$expected,$query) = @_;
|
263
|
+
|
264
|
+
my $curdir = `pwd`;
|
265
|
+
chomp($curdir);
|
266
|
+
chdir("$path/../examples");
|
267
|
+
|
268
|
+
my $cmd = "perl -I../perl/ -MVcf ../perl/vcf-query -f '$query' $file";
|
269
|
+
my @out = `$cmd 2>&1`;
|
270
|
+
open(my $fh,'<',$expected) or confess("$expected: $!");
|
271
|
+
my @exp = <$fh>;
|
272
|
+
close($fh);
|
273
|
+
|
274
|
+
chdir($curdir);
|
275
|
+
is_deeply(\@out,\@exp,"Testing vcf-query .. $cmd");
|
276
|
+
}
|
277
|
+
|
278
|
+
|
279
|
+
sub test_shuffle
|
280
|
+
{
|
281
|
+
my ($path,$template,$file) = @_;
|
282
|
+
|
283
|
+
my $curdir = `pwd`;
|
284
|
+
chomp($curdir);
|
285
|
+
chdir("$path/../examples");
|
286
|
+
|
287
|
+
my $cmd = "perl -I../perl/ -MVcf ../perl/vcf-shuffle-cols -t $template $file";
|
288
|
+
my @out = `$cmd 2>&1`;
|
289
|
+
open(my $fh,'<',$template) or confess("$template: $!");
|
290
|
+
my @exp = <$fh>;
|
291
|
+
close($fh);
|
292
|
+
|
293
|
+
chdir($curdir);
|
294
|
+
is_deeply(\@out,\@exp,"Testing vcf-shuffle-cols .. $cmd");
|
295
|
+
}
|
296
|
+
|
297
|
+
sub test_concat
|
298
|
+
{
|
299
|
+
my ($path,$out,@files) = @_;
|
300
|
+
|
301
|
+
my $curdir = `pwd`;
|
302
|
+
chomp($curdir);
|
303
|
+
chdir("$path/../examples");
|
304
|
+
|
305
|
+
my $cmd = "perl -I../perl/ -MVcf ../perl/vcf-concat -s 3";
|
306
|
+
for my $file (@files)
|
307
|
+
{
|
308
|
+
`cat $file | bgzip -c > $file.gz`;
|
309
|
+
`tabix -p vcf -f $file.gz`;
|
310
|
+
$cmd .= " $file.gz";
|
311
|
+
}
|
312
|
+
|
313
|
+
my @out = `$cmd 2>&1`;
|
314
|
+
open(my $fh,'<',$out) or confess("$out: $!");
|
315
|
+
my @exp = <$fh>;
|
316
|
+
close($fh);
|
317
|
+
|
318
|
+
chdir($curdir);
|
319
|
+
is_deeply(\@out,\@exp,"Testing vcf-concat .. $cmd");
|
320
|
+
}
|
321
|
+
|
322
|
+
|
323
|
+
sub test_annotate
|
324
|
+
{
|
325
|
+
my ($path,$args,$out,$vcf,$annot) = @_;
|
326
|
+
|
327
|
+
my $curdir = `pwd`;
|
328
|
+
chomp($curdir);
|
329
|
+
chdir("$path/../examples");
|
330
|
+
|
331
|
+
my $cmd = "perl -I../perl/ -MVcf ../perl/vcf-annotate $args $vcf";
|
332
|
+
|
333
|
+
if ( defined $annot )
|
334
|
+
{
|
335
|
+
`cat $annot | bgzip -c > $annot.gz`;
|
336
|
+
`tabix -s 3 -b 1 -e 2 -f $annot.gz`;
|
337
|
+
$cmd .= " -a $annot.gz";
|
338
|
+
}
|
339
|
+
|
340
|
+
my @out = `$cmd 2>&1 | grep -v ^##source`;
|
341
|
+
open(my $fh,'<',$out) or confess("$out: $!");
|
342
|
+
my @exp = <$fh>;
|
343
|
+
close($fh);
|
344
|
+
|
345
|
+
chdir($curdir);
|
346
|
+
is_deeply(\@out,\@exp,"Testing vcf-annotate .. $cmd");
|
347
|
+
}
|
348
|
+
|
349
|
+
sub test_fill_an_ac
|
350
|
+
{
|
351
|
+
my ($path,$out,$vcf) = @_;
|
352
|
+
|
353
|
+
my $curdir = `pwd`;
|
354
|
+
chomp($curdir);
|
355
|
+
chdir("$path/../examples");
|
356
|
+
|
357
|
+
my $cmd = "perl -I../perl/ -MVcf ../perl/fill-an-ac $vcf";
|
358
|
+
my @out = `$cmd 2>&1`;
|
359
|
+
open(my $fh,'<',$out) or confess("$out: $!");
|
360
|
+
my @exp = <$fh>;
|
361
|
+
close($fh);
|
362
|
+
|
363
|
+
chdir($curdir);
|
364
|
+
is_deeply(\@out,\@exp,"Testing fill-an-ac .. $cmd");
|
365
|
+
}
|
366
|
+
|
367
|
+
sub test_api_event_type
|
368
|
+
{
|
369
|
+
my (@subs) = @_;
|
370
|
+
my $vcf = Vcf->new();
|
371
|
+
for my $mut (@subs)
|
372
|
+
{
|
373
|
+
my $exp = join(' ', $vcf->event_type($$mut[0],$$mut[1]));
|
374
|
+
is_deeply($$mut[2],$exp,"Testing API event_type($$mut[0],$$mut[1]) .. $exp");
|
375
|
+
}
|
376
|
+
}
|