line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::JBrowse::FeatureStream; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
33
|
$Bio::JBrowse::FeatureStream::AUTHORITY = 'cpan:RBUELS'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$Bio::JBrowse::FeatureStream::VERSION = '0.1'; |
7
|
|
|
|
|
|
|
} |
8
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
9
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
247
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %must_flatten = |
12
|
|
|
|
|
|
|
map { $_ => 1 } |
13
|
|
|
|
|
|
|
qw( name id start end score strand description note ); |
14
|
|
|
|
|
|
|
# given a hashref like { tagname => [ value1, value2 ], ... } |
15
|
|
|
|
|
|
|
# flatten it to numbered tagnames like { tagname => value1, tagname2 => value2 } |
16
|
|
|
|
|
|
|
sub _flatten_multivalues { |
17
|
0
|
|
|
0
|
|
|
my ( $self, $h ) = @_; |
18
|
0
|
|
|
|
|
|
my %flattened; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
for my $key ( keys %$h ) { |
21
|
0
|
|
|
|
|
|
my $v = $h->{$key}; |
22
|
0
|
0
|
|
|
|
|
if( @$v == 1 ) { |
|
|
0
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$flattened{ $key } = $v->[0]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
elsif( $must_flatten{ lc $key } ) { |
26
|
0
|
|
|
|
|
|
for( my $i = 0; $i < @$v; $i++ ) { |
27
|
0
|
0
|
|
|
|
|
$flattened{ $key.($i ? $i+1 : '')} = $v->[$i]; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} else { |
30
|
0
|
|
|
|
|
|
$flattened{ $key } = $v; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return \%flattened; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |