| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# safe Perl |
|
2
|
6
|
|
|
6
|
|
24
|
use warnings; |
|
|
6
|
|
|
|
|
8
|
|
|
|
6
|
|
|
|
|
190
|
|
|
3
|
6
|
|
|
6
|
|
22
|
use strict; |
|
|
6
|
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
107
|
|
|
4
|
6
|
|
|
6
|
|
19
|
use Carp; |
|
|
6
|
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
463
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BoutrosLab::TSVStream::Format::VCF::Types |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Collection of types used in VCF format fields. Used internally in |
|
13
|
|
|
|
|
|
|
BoutrosLab::TSVStream::Format::VCF::Role. |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
package BoutrosLab::TSVStream::Format::VCF::Types; |
|
18
|
|
|
|
|
|
|
|
|
19
|
6
|
|
|
|
|
46
|
use MooseX::Types -declare => [ |
|
20
|
|
|
|
|
|
|
qw( |
|
21
|
|
|
|
|
|
|
Str_No_Whitespace |
|
22
|
|
|
|
|
|
|
VCF_Chrom |
|
23
|
|
|
|
|
|
|
VCF_Ref |
|
24
|
|
|
|
|
|
|
VCF_Ref_Full |
|
25
|
|
|
|
|
|
|
VCF_Alt |
|
26
|
|
|
|
|
|
|
VCF_Alt_Full |
|
27
|
|
|
|
|
|
|
VCF_KV_Str |
|
28
|
|
|
|
|
|
|
) |
|
29
|
6
|
|
|
6
|
|
989
|
]; |
|
|
6
|
|
|
|
|
56084
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
6
|
|
|
6
|
|
31959
|
use MooseX::Types::Moose qw( Int Str ArrayRef HashRef ); |
|
|
6
|
|
|
|
|
20104
|
|
|
|
6
|
|
|
|
|
35
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
subtype Str_No_Whitespace, |
|
34
|
|
|
|
|
|
|
as Str, |
|
35
|
|
|
|
|
|
|
where { /^\S+$/ }, |
|
36
|
|
|
|
|
|
|
message {"may not contain whitespace characters"}; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
subtype VCF_Chrom, as Str_No_Whitespace; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
subtype VCF_Ref, |
|
41
|
|
|
|
|
|
|
as Str, |
|
42
|
|
|
|
|
|
|
where { /^-$/ || /^[CGAT]+$/i }, |
|
43
|
|
|
|
|
|
|
message {"VCF_Ref must be '-' (dash), or a series of 'CGAT' characters"}; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
subtype VCF_Ref_Full, |
|
46
|
|
|
|
|
|
|
as Str, |
|
47
|
|
|
|
|
|
|
# where { /^-$/ || /^[CGAT]+$/i }, |
|
48
|
|
|
|
|
|
|
# message {"VCF_Ref must be '-' (dash), or a series of 'CGAT' characters"} |
|
49
|
|
|
|
|
|
|
; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
subtype VCF_Alt, |
|
52
|
|
|
|
|
|
|
as Str, |
|
53
|
|
|
|
|
|
|
where { /^-$/ || /^[CGAT]+(?:,[CGAT]+)*$/i }, |
|
54
|
|
|
|
|
|
|
message {"VCF_Alt must be '-' (dash), or one or more comma-separated series of 'CGAT' characters"}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
subtype VCF_Alt_Full, |
|
57
|
|
|
|
|
|
|
as Str, |
|
58
|
|
|
|
|
|
|
# where { /^-$/ || /^[CGAT]+(?:,[CGAT]+)*$/i }, |
|
59
|
|
|
|
|
|
|
# message {"VCF_Alt must be '-' (dash), or one or more comma-separated series of 'CGAT' characters"} |
|
60
|
|
|
|
|
|
|
; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
subtype VCF_KV_Str, |
|
63
|
|
|
|
|
|
|
as 'BoutrosLab::TSVStream::Format::VCF::Types::KeyValueString'; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
coerce VCF_KV_Str, |
|
66
|
|
|
|
|
|
|
from Str, |
|
67
|
|
|
|
|
|
|
via { BoutrosLab::TSVStream::Format::VCF::Types::KeyValueString->new($_) }; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
package BoutrosLab::TSVStream::Format::VCF::Types::KeyValueString; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
use overload |
|
73
|
6
|
|
|
6
|
|
22650
|
'""' => 'stringify'; |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
40
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub new { |
|
76
|
12
|
|
|
12
|
|
18
|
my ($class, $data) = @_; |
|
77
|
12
|
|
33
|
|
|
42
|
$class = ref($class) || $class; |
|
78
|
12
|
|
|
|
|
18
|
my $data_hash = {}; |
|
79
|
12
|
50
|
|
|
|
18
|
if (ref($data)) { # copy if it is already a HashRef (or KeyValueString object) |
|
80
|
0
|
|
|
|
|
0
|
while (my ($key, $value) = each %$data) { |
|
81
|
0
|
|
|
|
|
0
|
$data_hash->{$key} = $value; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
else { # split up a Str |
|
85
|
12
|
|
|
|
|
32
|
my @split = split(';', $data); |
|
86
|
12
|
|
|
|
|
16
|
foreach my $kv_pair (@split) { |
|
87
|
24
|
|
|
|
|
42
|
my ($key, $value) = split('=', $kv_pair); |
|
88
|
24
|
|
|
|
|
50
|
$data_hash->{$key} = $value; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
} |
|
91
|
12
|
|
|
|
|
227
|
return bless $data_hash, $class; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub clone { |
|
95
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
96
|
0
|
|
|
|
|
0
|
return $self->new($self); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub stringify { |
|
100
|
8
|
|
|
8
|
|
11
|
my ($self) = @_; |
|
101
|
8
|
|
|
|
|
6
|
my $str = ''; |
|
102
|
8
|
|
|
|
|
10
|
foreach my $key (sort keys %{$self}) { |
|
|
8
|
|
|
|
|
39
|
|
|
103
|
16
|
|
|
|
|
15
|
my $val = $self->{$key}; |
|
104
|
16
|
|
|
|
|
15
|
$str .= $key; |
|
105
|
16
|
50
|
|
|
|
31
|
$str .= "=$val" if defined $val; |
|
106
|
16
|
|
|
|
|
19
|
$str .= ";"; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
8
|
|
|
|
|
27
|
$str =~ s/;$//; |
|
109
|
8
|
|
|
|
|
108
|
return $str; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
John Macdonald - Boutros Lab |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Paul Boutros, Phd, PI - Boutros Lab |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The Ontario Institute for Cancer Research |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |
|
126
|
|
|
|
|
|
|
|