| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::GFF3::LowLevel::Parser::1_0_backcompat; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
1
|
|
|
1
|
|
54
|
$Bio::GFF3::LowLevel::Parser::1_0_backcompat::AUTHORITY = 'cpan:RBUELS'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
|
|
|
|
|
|
$Bio::GFF3::LowLevel::Parser::1_0_backcompat::VERSION = '2.0'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
|
|
|
|
|
|
# ABSTRACT: compatibility layer to support Bio::GFF3::LowLevel::Parser 1.0 API |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
11
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
460
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
|
15
|
16
|
|
|
16
|
1
|
29
|
my $class = shift; |
|
16
|
16
|
|
|
|
|
76
|
my $self = { |
|
17
|
|
|
|
|
|
|
parser => Bio::GFF3::LowLevel::Parser->open( @_ ), |
|
18
|
|
|
|
|
|
|
item_buffer => [], |
|
19
|
|
|
|
|
|
|
}; |
|
20
|
16
|
|
|
|
|
80
|
return bless $self, $class; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub next_item { |
|
25
|
1149
|
|
|
1149
|
1
|
7287
|
my ( $self ) = @_; |
|
26
|
1149
|
|
|
|
|
1772
|
my $item_buffer = $self->{item_buffer}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# try to get more items if the buffer is empty |
|
29
|
1149
|
100
|
|
|
|
2998
|
$self->_buffer_items unless @$item_buffer; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# return the next item if we have some |
|
32
|
1149
|
50
|
|
|
|
4539
|
return shift @$item_buffer if @$item_buffer; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# if we were not able to get any more items, return nothing |
|
35
|
0
|
|
|
|
|
0
|
return; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _buffer_items { |
|
39
|
1147
|
|
|
1147
|
|
1351
|
my ( $self ) = @_; |
|
40
|
1147
|
|
|
|
|
3106
|
my $item = $self->{parser}->next_item; |
|
41
|
1147
|
100
|
|
|
|
2977
|
unless( ref $item eq 'ARRAY' ) { |
|
42
|
45
|
|
|
|
|
45
|
push @{$self->{item_buffer}}, $item; |
|
|
45
|
|
|
|
|
82
|
|
|
43
|
45
|
|
|
|
|
75
|
return; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# convert all the features and child features back to non-arrayrefs |
|
47
|
1102
|
|
|
|
|
1315
|
push @{$self->{item_buffer}}, $self->_xform_1x( $item ); |
|
|
1102
|
|
|
|
|
2938
|
|
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# take a 2.x feature arrayref, return a list of 1.x-compliant features |
|
51
|
|
|
|
|
|
|
sub _xform_1x { |
|
52
|
2503
|
|
|
2503
|
|
3009
|
my ( $self, $f ) = @_; |
|
53
|
2503
|
100
|
|
|
|
5100
|
return $f unless ref $f eq 'ARRAY'; |
|
54
|
2489
|
|
|
|
|
3820
|
for my $line (@$f) { |
|
55
|
2491
|
|
|
|
|
2885
|
for my $attr ( 'child_features', 'derived_features' ) { |
|
56
|
4982
|
|
|
|
|
16699
|
$line->{$attr} = [ |
|
57
|
|
|
|
|
|
|
map $self->_xform_1x( $_ ), |
|
58
|
|
|
|
|
|
|
grep $_ != $f, |
|
59
|
4982
|
|
|
|
|
4923
|
@{ $line->{$attr} } |
|
60
|
|
|
|
|
|
|
]; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
} |
|
63
|
2489
|
|
|
|
|
7962
|
return @$f; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |