line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# safe Perl |
2
|
6
|
|
|
6
|
|
21
|
use warnings; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
190
|
|
3
|
6
|
|
|
6
|
|
22
|
use strict; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
122
|
|
4
|
6
|
|
|
6
|
|
20
|
use Carp; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
456
|
|
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
|
|
|
|
|
40
|
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
|
|
879
|
]; |
|
6
|
|
|
|
|
46658
|
|
30
|
|
|
|
|
|
|
|
31
|
6
|
|
|
6
|
|
29009
|
use MooseX::Types::Moose qw( Int Str ArrayRef HashRef ); |
|
6
|
|
|
|
|
19508
|
|
|
6
|
|
|
|
|
38
|
|
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
|
|
23236
|
'""' => 'stringify'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
42
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub new { |
76
|
12
|
|
|
12
|
|
15
|
my ($class, $data) = @_; |
77
|
12
|
|
33
|
|
|
51
|
$class = ref($class) || $class; |
78
|
12
|
|
|
|
|
20
|
my $data_hash = {}; |
79
|
12
|
50
|
|
|
|
20
|
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
|
|
|
|
|
41
|
my @split = split(';', $data); |
86
|
12
|
|
|
|
|
21
|
foreach my $kv_pair (@split) { |
87
|
24
|
|
|
|
|
49
|
my ($key, $value) = split('=', $kv_pair); |
88
|
24
|
|
|
|
|
61
|
$data_hash->{$key} = $value; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
12
|
|
|
|
|
234
|
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
|
|
|
|
|
12
|
my $str = ''; |
102
|
8
|
|
|
|
|
12
|
foreach my $key (sort keys %{$self}) { |
|
8
|
|
|
|
|
51
|
|
103
|
16
|
|
|
|
|
17
|
my $val = $self->{$key}; |
104
|
16
|
|
|
|
|
19
|
$str .= $key; |
105
|
16
|
50
|
|
|
|
43
|
$str .= "=$val" if defined $val; |
106
|
16
|
|
|
|
|
23
|
$str .= ";"; |
107
|
|
|
|
|
|
|
} |
108
|
8
|
|
|
|
|
129
|
return $str; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 AUTHOR |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
John Macdonald - Boutros Lab |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Paul Boutros, Phd, PI - Boutros Lab |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The Ontario Institute for Cancer Research |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
|