lib/Bio/KEGG/API.pm

filter: Statementstmt 42.8% 36 / 84 Branchbran 7.1% 3 / 42 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 64.2% 9 / 14 Podpod 0.0% 0 / 6 totaltotal 27.2% 48 / 176 CC 30 SCAR 38.6
CC
30
Cov
27%
data_search
110.0
entry_list
56.0
id_convertion
42.0
CRAP 47.4
↑ Summary
1 package Bio::KEGG::API;
2  
3 1 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use REST::Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Net::FTP::Tiny qw(ftp_get);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $VERSION = '0.02';
12  
13 has 'client' => (
14 is => 'rw',
15 isa => 'REST::Client',
16 1 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
17 1 my $self = shift;
18 1 return my $obj = REST::Client->new({host=> "http://rest.kegg.jp", timeout => 30,});
19 }
20 1 );
21  
22 1 has 'operation' => (
23 is => 'rw',
24 isa => 'Str',
25 );
26  
27 1 has 'database' => (
28 is => 'rw',
29 isa => 'Str',
30 );
31  
32 1 has 'organism' => (
33 is => 'rw',
34 isa => 'Str',
35 );
36  
37  
38 1 ▶sub database_info {
Subroutine database_info: called CC=5 SCAR=18.1
Pod undocumented
39 1 my $self = shift;
40 1 my %param = @_;
41  
42 1 $self->operation('/info/');
43 1 ▶ $self->database($param{'database'}) if defined $param{'database'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"database"} 1 0 1
44 1 ▶ $self->organism($param{'organism'}) if defined $param{'organism'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"organism"} 0 1 1
45  
46 1 ▶ if ( $param{'database'} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($param{'database'}) { } 1 0 1
elsif ($param{'organism'}) { } 0 0 0
47
48 1 $self->client->GET($self->operation.$param{'database'});
49  
50 } elsif ( $param{'organism'} ) {
51  
52 0 $self->client->GET($self->operation.$param{'organism'});
53 }
54  
55 1 return $self->client->responseContent;
56 }
57  
58  
59 0 ▶sub entry_list {
Subroutine entry_list: not called CC=7 SCAR=40.3
Pod undocumented
60 0 my $self = shift;
61 0 my %param = @_;
62  
63 0 $self->operation('/list/');
64 0 ▶ $self->database($param{'database'}) if defined $param{'database'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"database"} 0 0 0
65 0 ▶ $self->organism($param{'organism'}) if defined $param{'organism'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"organism"} 0 0 0
66  
67 0 ▶ if ( $param{'database'} && $param{'organism'} ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($param{'database'} and $param{'organism'}) { } 0 0 0
elsif ($param{'database'}) { } 0 0 0
elsif ($param{'organism'}) { } 0 0 0
Condition0%0/3
$param{"database"} and $param{"organism"}
!ll&&!rl&&r
000
MC/DC0%0/2
$param{"database"} and $param{"organism"}
$param{"database"} $param{"organism"}
Truth table0%0/3
A and B
A= $param{"database"}B= $param{"organism"}
ABresult
0X0
100
111
68
69 0 $self->client->GET($self->operation.$param{'database'}."/".$param{'organism'});
70
71 } elsif ( $param{'database'} ) {
72
73 0 $self->client->GET($self->operation.$param{'database'});
74  
75 } elsif ( $param{'organism'} ) {
76  
77 0 $self->client->GET($self->operation.$param{'organism'});
78  
79 }
80  
81 0 my @result = split(/\n/, $self->client->responseContent);
82 0 return @result;
83  
84 }
85  
86  
87 0 ▶sub data_search {
Subroutine data_search: not called CC=10 SCAR=47.0
Pod undocumented
88 0 my $self = shift;
89 0 my %param = @_;
90  
91 0 $self->operation('/find/');
92  
93 0 ▶ $self->database($param{'database'}) if defined $param{'database'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"database"} 0 0 0
94 0 ▶ $self->organism($param{'organism'}) if defined $param{'organism'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"organism"} 0 0 0
95 0 ▶ $self->organism($param{'query'}) if defined $param{'query'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"query"} 0 0 0
96  
97 0 ▶ if ( $param{'database'} && $param{'query'} ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($param{'database'} and $param{'query'}) { } 0 0 0
elsif ($param{'organism'} and $param{'query'}) { } 0 0 0
elsif ($param{'database'} and $param{'organism'}) { } 0 0 0
Condition0%0/3
$param{"database"} and $param{"query"}
!ll&&!rl&&r
000
MC/DC0%0/2
$param{"database"} and $param{"query"}
$param{"database"} $param{"query"}
Truth table0%0/3
A and B
A= $param{"database"}B= $param{"query"}
ABresult
0X0
100
111
98
99 0 $self->client->GET($self->operation . $param{'database'} . "/" . $param{'query'});
100  
101 ▶ } elsif ( $param{'organism'} && $param{'query'}) {
Condition0%0/3
$param{"organism"} and $param{"query"}
!ll&&!rl&&r
000
MC/DC0%0/2
$param{"organism"} and $param{"query"}
$param{"organism"} $param{"query"}
Truth table0%0/3
A and B
A= $param{"organism"}B= $param{"query"}
ABresult
0X0
100
111
102  
103 0 $self->client->GET($self->operation . $param{'organism'} . "/" . $param{'query'});
104  
105 ▶ } elsif ( $param{'database'} && $param{'organism'}) {
Condition0%0/3
$param{"database"} and $param{"organism"}
!ll&&!rl&&r
000
MC/DC0%0/2
$param{"database"} and $param{"organism"}
$param{"database"} $param{"organism"}
Truth table0%0/3
A and B
A= $param{"database"}B= $param{"organism"}
ABresult
0X0
100
111
106
107 0 $self->client->GET($self->operation.$param{'database'}."/".$param{'organism'});
108  
109 };
110  
111 0 my @result = split(/\n/, $self->client->responseContent);
112 0 return @result;
113  
114 }
115  
116  
117 0 ▶sub id_convertion {
Subroutine id_convertion: not called CC=6 SCAR=37.4
Pod undocumented
118 0 my $self = shift;
119 0 my %param = @_;
120  
121 0 $self->operation('/conv/');
122  
123 0 ▶ $self->database($param{'target'}) if defined $param{'target'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"target"} 0 0 0
124 0 ▶ $self->organism($param{'source'}) if defined $param{'source'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"source"} 0 0 0
125  
126 0 ▶ if ( $param{'target'} && $param{'source'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($param{"target"} and $param{"source"}) 0 0 0
Condition0%0/3
$param{"target"} and $param{"source"}
!ll&&!rl&&r
000
MC/DC0%0/2
$param{"target"} and $param{"source"}
$param{"target"} $param{"source"}
Truth table0%0/3
A and B
A= $param{"target"}B= $param{"source"}
ABresult
0X0
100
111
127
128 0 $self->client->GET($self->operation.$param{'target'}."/".$param{'source'});
129  
130 }
131  
132 0 my @result = split(/\t/, $self->client->responseContent );
133  
134 0 for my $elem ( @result ) {
135
136 0 $elem =~ s/\n/\t/g;
137 }
138  
139 0 return @result;
140  
141 }
142  
143  
144 0 ▶sub data_retrieval {
Subroutine data_retrieval: not called CC=1 SCAR=6.9
Pod undocumented
145 0 my $self = shift;
146 0 my $param = @_;
147  
148 }
149  
150  
151 0 ▶sub linked_entries {
Subroutine linked_entries: not called CC=6 SCAR=37.4
Pod undocumented
152 0 my $self = shift;
153 0 my %param = @_;
154  
155 0 $self->operation('/link/');
156  
157 0 ▶ $self->database($param{'target'}) if defined $param{'target'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"target"} 0 0 0
158 0 ▶ $self->organism($param{'source'}) if defined $param{'source'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $param{"source"} 0 0 0
159  
160 0 ▶ if ( $param{'target'} && $param{'source'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($param{"target"} and $param{"source"}) 0 0 0
Condition0%0/3
$param{"target"} and $param{"source"}
!ll&&!rl&&r
000
MC/DC0%0/2
$param{"target"} and $param{"source"}
$param{"target"} $param{"source"}
Truth table0%0/3
A and B
A= $param{"target"}B= $param{"source"}
ABresult
0X0
100
111
161
162 0 $self->client->GET($self->operation.$param{'target'}."/".$param{'source'});
163  
164 }
165  
166 0 my @result = split(/\t/, $self->client->responseContent );
167  
168 0 for my $elem ( @result ) {
169
170 0 $elem =~ s/\n/\t/g;
171 }
172  
173 0 return @result;
174  
175 }
176  
177  
178  
179 1 1;
↑ Summary