blib/lib/Bio/Gonzales/Feat/IO/Base.pm

filter: Statementstmt 90.7% 69 / 76 Branchbran 90.0% 9 / 10 Conditioncond 77.7% 7 / 9 MC/DCmcdc 60.0% 3 / 5 Subroutinesub 60.0% 9 / 15 Podpod 0.0% 0 / 6 totaltotal 80.1% 97 / 121 CC 15 SCAR 17.0
CC
15
Cov
89%
_collect_feat
11.0
_connect_feats
4.0
next_feat
2.0
CRAP 5.5
« blib/lib/Bio/Gonzales/Search/IO/HMMER3.pm ↑ Summary blib/lib/Bio/Gonzales/Feat/IO.pm »
1 package Bio::Gonzales::Feat::IO::Base;
2  
3  
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 3 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 with 'Bio::Gonzales::Util::Role::FileIO';
14  
15 3 our $VERSION = '0.058'; # VERSION
16  
17 4 ▶has _collection => ( is => 'rw', default => sub { { subfeats => {}, feats => {} } } );
Subroutine __ANON__: called CC=1 SCAR=0.0
18 3 has _num => ( is => 'rw', default => 0 );
19  
20 # file handle iterator
21  
22 sub next_feat {
23 0 ▶ confess 'function not implemented, yet';
Subroutine next_feat: not called CC=1 SCAR=6.9
Pod undocumented
24 }
25  
26 sub write_feat {
27 0 ▶ confess 'function not implemented, yet';
Subroutine write_feat: not called CC=1 SCAR=6.9
Pod undocumented
28 }
29  
30 0 ▶sub write_feature { return shift->write_feat(@_); }
Subroutine write_feature: not called CC=1 SCAR=6.9
Pod undocumented
31  
32 0 ▶sub next_feature { return shift->next_feat(@_); }
Subroutine next_feature: not called CC=1 SCAR=6.9
Pod undocumented
33  
34 sub write_collected_feats {
35 0 ▶ confess 'function not implemented, yet';
Subroutine write_collected_feats: not called CC=1 SCAR=6.9
Pod undocumented
36 }
37  
38 sub _find_parent_feats {
39 1 ▶ my ($self) = @_;
Subroutine _find_parent_feats: called CC=2 SCAR=6.9
40  
41 1 my @parents;
42 1 for my $fs ( values %{ $self->_collection->{feats} } ) {
43 53 push @parents, grep { @{ $_->parentfeats } == 0 } @$fs;
44 }
45 1 return \@parents;
46 }
47  
48 sub _connect_feats {
49 1 ▶ my ($self) = @_;
Subroutine _connect_feats: called CC=4 SCAR=13.9
50  
51 1 my $subfeats = $self->_collection->{subfeats};
52 1 my $feats = $self->_collection->{feats};
53  
54 1 for my $id ( keys %$feats ) {
55 53 my $fs = $feats->{$id};
56 53 for my $f (@$fs) {
57 56 ▶ if ( exists( $subfeats->{$id} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $subfeats->{$id}) 9 47 56
58 9 push @{ $f->subfeats }, @{ $subfeats->{$id} };
59 9 map { push @{ $_->parentfeats }, $f } @{ $subfeats->{$id} };
60 }
61 56 $f->uniq;
62 56 $f->sort_subfeats;
63 }
64 }
65 }
66  
67 sub collect_feat {
68 0 ▶ my ( $self, @feats ) = @_;
Subroutine collect_feat: not called CC=1 SCAR=6.9
Pod undocumented
69  
70 0 confess 'function deprecated';
71 }
72  
73 sub _collect_feat {
74 56 ▶ my ( $self, $f ) = @_;
Subroutine _collect_feat: called CC=11 SCAR=24.0
75  
76 56 my $subfeats = $self->_collection->{subfeats};
77 56 my $feats = $self->_collection->{feats};
78  
79 56 my @parents = $f->parent_ids;
80 56 ▶ if ( @parents && @parents > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@parents and @parents > 0) 31 25 56
Condition66%2/3
@parents and @parents > 0
!ll&&!rl&&r
25031
MC/DC50%1/2
@parents and @parents > 0
@parents @parents > 0
Truth table66%2/3
A and B
A= @parentsB= @parents > 0
ABresult
0X0
100
111
81 31 for my $p (@parents) {
82 # feat has a parent so we have an exon
83 34 ▶ $subfeats->{$p} //= [];
Condition100%2/2
$subfeats->{$p} //= []
l!l
259
MC/DC100%1/1
$subfeats->{$p} //= []
$subfeats->{$p}
Truth table100%2/2
A
A= $subfeats->{$p}
Aresult
11
00
84 34 push @{ $subfeats->{$p} }, $f;
85 }
86 }
87  
88 56 ▶ if ( $f->ids ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f->ids) { } 26 30 56
89 26 for my $id ( $f->ids() ) {
90 26 ▶ $feats->{$id} //= [];
Condition100%2/2
$feats->{$id} //= []
l!l
323
MC/DC100%1/1
$feats->{$id} //= []
$feats->{$id}
Truth table100%2/2
A
A= $feats->{$id}
Aresult
11
00
91 26 push @{ $feats->{$id} }, $f;
92 }
93 } else {
94 30 my $id = "__noid_";
95 30 ▶ $id .= $f->name . "_" if ( $f->name );
Branch: 1 branch
BranchTrueFalseTotal
if $f->name 8 22 30
96 30 ▶ $id .= $f->type . "_" if ( $f->type );
Branch: 1 branch
BranchTrueFalseTotal
if $f->type 30 0 30
97 30 $id .= $self->_num;
98 30 $self->_num( $self->_num + 1 );
99 30 $f->add_attr( "ID" => $id );
100  
101 30 ▶ $feats->{$id} //= [];
Condition50%1/2
$feats->{$id} //= []
l!l
030
MC/DC0%0/1
$feats->{$id} //= []
$feats->{$id}
Truth table50%1/2
A
A= $feats->{$id}
Aresult
11
00
102 30 push @{ $feats->{$id} }, $f;
103  
104 30 carp "feature has no id, made artificial one: " . $f->id;
105 }
106  
107 56 return;
108 }
109  
110 3 1;
« blib/lib/Bio/Gonzales/Search/IO/HMMER3.pm ↑ Summary blib/lib/Bio/Gonzales/Feat/IO.pm »