Tools/EUtilities/Info.pm

filter: Statementstmt 82.3% 42 / 51 Branchbran 63.6% 14 / 22 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 88.8% 8 / 9 Podpod 100% 1 / 1 totaltotal 78.4% 73 / 93 CC 16 SCAR 23.7
CC
16
Cov
77%
to_string
20.0
_add_data
13.1
BEGIN
1.0
CRAP 10.7
« Tools/EUtilities/Link.pm ↑ Summary Tools/EUtilities/Summary/Item.pm »
1 package Bio::Tools::EUtilities::Info;
2 BEGIN {
3 2 ▶ $Bio::Tools::EUtilities::Info::AUTHORITY = 'cpan:BIOPERLML';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 }
5 {
6 2 $Bio::Tools::EUtilities::Info::VERSION = '1.73';
7 }
8 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use base qw(Bio::Tools::EUtilities Bio::Tools::EUtilities::EUtilDataI);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Bio::Tools::EUtilities::Info::LinkInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Bio::Tools::EUtilities::Info::FieldInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # ABSTRACT: Interface class for storing einfo data.
16 # AUTHOR: Chris Fields <cjfields@bioperl.org>
17 # OWNER: 2006-2013 Chris Fields
18 # LICENSE: Perl_5
19  
20  
21  
22  
23 # private EUtilDataI method
24  
25 sub _add_data {
26 2 ▶ my ($self, $simple) = @_;
Subroutine _add_data: called CC=13 SCAR=25.7
27 2 ▶ if (exists $simple->{DbList} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}) 1 1 2
Condition66%2/3
exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}
!ll&&!rl&&r
101
MC/DC50%1/2
exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}
exists $simple->{"DbList"} exists $simple->{"DbList"}{"DbName"}
Truth table66%2/3
A and B
A= exists $simple->{"DbList"}B= exists $simple->{"DbList"}{"DbName"}
ABresult
0X0
100
111
28 exists $simple->{DbList}->{DbName}) {
29 1 $self->{'_available_databases'} = $simple->{DbList}->{DbName};
30 }
31 # start setting internal variables
32 2 ▶ if (exists $simple->{DbInfo}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{'DbInfo'}) { } 1 1 2
33 1 for my $key (sort keys %{ $simple->{DbInfo} }) {
34 my $data =
35 ($key eq 'FieldList') ? $simple->{DbInfo}->{$key}->{Field} :
36 ($key eq 'LinkList' ) ? $simple->{DbInfo}->{$key}->{Link} :
37 7 ▶ $simple->{DbInfo}->{$key};
Branch: 2 branches
BranchTrueFalseTotal
$key eq 'FieldList' ? : 1 6 7
$key eq 'LinkList' ? : 1 5 6
38 7 ▶ if ($key eq 'FieldList' || $key eq 'LinkList') {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq 'FieldList' or $key eq 'LinkList') { } 2 5 7
Condition100%3/3
$key eq "FieldList" or $key eq "LinkList"
l!l&&r!l&&!r
115
MC/DC100%2/2
$key eq "FieldList" or $key eq "LinkList"
$key eq "FieldList" $key eq "LinkList"
Truth table100%3/3
A or B
A= $key eq "FieldList"B= $key eq "LinkList"
ABresult
1X1
011
000
39 2 for my $chunk (@{$data}) {
40 87 ▶ if (exists $simple->{DbInfo}->{DbName}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{"DbInfo"}{"DbName"}) 87 0 87
41 87 $chunk->{DbFrom} = $simple->{DbInfo}->{DbName};
42 }
43 87 ▶ my $type = ($key eq 'FieldList') ? 'FieldInfo' : 'LinkInfo';
Branch: 1 branch
BranchTrueFalseTotal
$key eq 'FieldList' ? : 41 46 87
44 87 my $obj = "Bio::Tools::EUtilities::Info::$type"->new(
45 -eutil => 'einfo',
46 -type => lc $type,
47 -verbose => $self->verbose);
48 87 $obj->_add_data($chunk);
49 87 push @{ $self->{'_'.lc $type} }, $obj;
50 }
51 } else {
52 5 $self->{'_'.lc $key} = $data;
53 }
54 }
55 } else {
56 1 ▶ map { $self->{'_'.lc $_} = $simple->{$_} unless ref $simple->{$_}} keys %$simple;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $simple->{$_} 0 1 1
57 }
58 }
59  
60  
61 sub to_string {
62 0 ▶ my $self = shift;
Subroutine to_string: not called CC=4 SCAR=30.0
Pod documented
63 0 my $string = $self->SUPER::to_string;
64 0 ▶ if (my @dbs = $self->get_databases) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@dbs) = $self->get_databases) 0 0 0
65 0 $string .= sprintf("%-20s:%s\n\n", 'DB',
66 $self->_text_wrap('', ' 'x20 .':', join(', ',@dbs)));
67 }
68 0 ▶ while (my $fi = $self->next_FieldInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $fi = $self->next_FieldInfo) 0 0 0
69 0 $string .= $fi->to_string."\n";
70 }
71 0 ▶ while (my $li = $self->next_LinkInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $li = $self->next_LinkInfo) 0 0 0
72 0 $string .= $li->to_string."\n";
73 }
74 0 return $string;
75 }
76  
77 2 1;
78  
79 __END__
« Tools/EUtilities/Link.pm ↑ Summary Tools/EUtilities/Summary/Item.pm »