4
use Local::vcflib::Test;
6
my @vcf = split /\n/, <<'';
8
#CHROM POS ID REF ALT QUAL FILTER INFO
9
refseq 502 . G A 38553 PASS
10
refseq 552 . G A 24044 PASS
11
refseq 660 . G A 38553 PASS
12
refseq 678 . G A 24044 PASS
13
refseq 684 . G A 24044 PASS
16
join "\n", @vcf[0 .. $_[0] + 1]
19
my ($output, $header) = ('', <<'');
21
##INFO=<ID=BasesToClosestVariant,Number=1,Type=Integer,Description="Number of bases to the closest variant in the file.">
22
#CHROM POS ID REF ALT QUAL FILTER INFO
25
# Various numbers of variant lines
27
($output) = run_ok(["vcfdistance"], variants(5));
28
is $output, $header . <<'', "distances for 5 variant lines";
29
refseq 502 . G A 38553 PASS BasesToClosestVariant=50;
30
refseq 552 . G A 24044 PASS BasesToClosestVariant=50;
31
refseq 660 . G A 38553 PASS BasesToClosestVariant=18;
32
refseq 678 . G A 24044 PASS BasesToClosestVariant=6;
33
refseq 684 . G A 24044 PASS BasesToClosestVariant=6;
35
($output) = run_ok(["vcfdistance"], variants(4));
36
is $output, $header . <<'', "distances for 4 variant lines";
37
refseq 502 . G A 38553 PASS BasesToClosestVariant=50;
38
refseq 552 . G A 24044 PASS BasesToClosestVariant=50;
39
refseq 660 . G A 38553 PASS BasesToClosestVariant=18;
40
refseq 678 . G A 24044 PASS BasesToClosestVariant=18;
42
($output) = run_ok(["vcfdistance"], variants(3));
43
is $output, $header . <<'', "distances for 3 variant lines";
44
refseq 502 . G A 38553 PASS BasesToClosestVariant=50;
45
refseq 552 . G A 24044 PASS BasesToClosestVariant=50;
46
refseq 660 . G A 38553 PASS BasesToClosestVariant=108;
48
($output) = run_ok(["vcfdistance"], variants(2));
49
is $output, $header . <<'', "distances for 2 variant lines";
50
refseq 502 . G A 38553 PASS BasesToClosestVariant=50;
51
refseq 552 . G A 24044 PASS BasesToClosestVariant=50;
53
($output) = run_ok(["vcfdistance"], variants(1));
54
is $output, $header . <<'', "distances for 1 variant line";
55
refseq 502 . G A 38553 PASS
57
($output) = run_ok(["vcfdistance"], variants(0));
58
is $output, $header, "distances for 0 variant lines";
61
# Various combinations of reference sequences (obviously non-comparable)
63
@vcf = split /\n/, <<'';
65
#CHROM POS ID REF ALT QUAL FILTER INFO
66
ref1 502 . G A 38553 PASS
67
ref2 552 . G A 24044 PASS
68
ref2 660 . G A 38553 PASS
69
ref2 678 . G A 24044 PASS
70
ref3 684 . G A 24044 PASS
72
($output) = run_ok(["vcfdistance"], variants(5));
73
is $output, $header . <<'', "distances for 5 variant lines; three references";
74
ref1 502 . G A 38553 PASS
75
ref2 552 . G A 24044 PASS BasesToClosestVariant=108;
76
ref2 660 . G A 38553 PASS BasesToClosestVariant=18;
77
ref2 678 . G A 24044 PASS BasesToClosestVariant=18;
78
ref3 684 . G A 24044 PASS
80
($output) = run_ok(["vcfdistance"], variants(4));
81
is $output, $header . <<'', "distances for 4 variant lines, two references";
82
ref1 502 . G A 38553 PASS
83
ref2 552 . G A 24044 PASS BasesToClosestVariant=108;
84
ref2 660 . G A 38553 PASS BasesToClosestVariant=18;
85
ref2 678 . G A 24044 PASS BasesToClosestVariant=18;
87
($output) = run_ok(["vcfdistance"], variants(3));
88
is $output, $header . <<'', "distances for 3 variant lines, two references";
89
ref1 502 . G A 38553 PASS
90
ref2 552 . G A 24044 PASS BasesToClosestVariant=108;
91
ref2 660 . G A 38553 PASS BasesToClosestVariant=108;
93
($output) = run_ok(["vcfdistance"], variants(2));
94
is $output, $header . <<'', "distances for 2 variant lines, two references";
95
ref1 502 . G A 38553 PASS
96
ref2 552 . G A 24044 PASS