Tools/EUtilities/Summary/DocSum.pm

filter: Statementstmt 79.5% 39 / 49 Branchbran 35.7% 5 / 14 Conditioncond 20.0% 1 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 81.8% 9 / 11 Podpod 100% 5 / 5 totaltotal 67.8% 59 / 87 CC 11 SCAR 15.6
CC
11
Cov
66%
rewind
12.0
_add_data
6.3
to_string
6.0
CRAP 4.8
« Tools/EUtilities/History.pm ↑ Summary Tools/EUtilities/Info/LinkInfo.pm »
1 package Bio::Tools::EUtilities::Summary::DocSum;
2 3 $Bio::Tools::EUtilities::Summary::DocSum::VERSION = '1.77';
3 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use base qw(Bio::Root::Root Bio::Tools::EUtilities::Summary::ItemContainerI);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Bio::Tools::EUtilities::Summary::Item;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # ABSTRACT: Data object for document summary data from esummary.
10 # AUTHOR: Chris Fields <cjfields@bioperl.org>
11 # OWNER: 2006-2013 Chris Fields
12 # LICENSE: Perl_5
13  
14  
15  
16 7 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod documented
17 7 my ($class, @args) = @_;
18 7 my $self = $class->SUPER::new(@args);
19 7 my ($type) = $self->_rearrange(['DATATYPE'],@args);
20 7 ▶ $type ||= 'docsum';
Condition50%1/2
$type ||= "docsum"
l!l
70
MC/DC0%0/1
$type ||= "docsum"
$type
Truth table50%1/2
A
A= $type
Aresult
11
00
21 7 $self->eutil('esummary');
22 7 $self->datatype($type);
23 7 return $self;
24 }
25  
26  
27 2 ▶sub get_ids {
Subroutine get_ids: called CC=2 SCAR=7.2
Pod documented
28 2 my $self = shift;
29 2 ▶ return wantarray ? $self->{'_id'} : [$self->{'_id'}];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 0 2
30 }
31  
32  
33 9 ▶sub get_id {
Subroutine get_id: called CC=1 SCAR=0.0
Pod documented
34 9 my $self = shift;
35 9 return $self->{'_id'};
36 }
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47 0 ▶sub rewind {
Subroutine rewind: not called CC=3 SCAR=24.8
Pod documented
48 0 my ($self, $request) = @_;
49 0 ▶ if ($request && $request eq 'all') {
Branch: 1 branch
BranchTrueFalseTotal
if ($request and $request eq "all") 0 0 0
Condition0%0/3
$request and $request eq "all"
!ll&&!rl&&r
000
MC/DC0%0/2
$request and $request eq "all"
$request $request eq "all"
Truth table0%0/3
A and B
A= $requestB= $request eq "all"
ABresult
0X0
100
111
50 0 map {$_->rewind('all') } $self->get_Items;
51 }
52 0 delete $self->{"_items_it"};
53 }
54  
55 # private EUtilDataI method
56  
57 7 ▶sub _add_data {
Subroutine _add_data: called CC=6 SCAR=18.5
58 7 my ($self, $data) = @_;
59 7 ▶ if ($data->{Item}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{"Item"}) 7 0 7
60 7 ▶ $self->{'_id'} = $data->{Id} if exists $data->{Id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $data->{"Id"} 7 0 7
61 7 for my $sd (@{ $data->{Item} } ) {
62 64 ▶ $sd->{Id} = $data->{Id} if exists $data->{Id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $data->{"Id"} 64 0 64
63 64 my $subdoc =
64 Bio::Tools::EUtilities::Summary::Item->new(-datatype => 'item',
65 -verbose => $self->verbose);
66 64 $subdoc->_add_data($sd);
67 64 push @{ $self->{'_items'} }, $subdoc;
68 }
69 }
70 7 ▶ $self->{'_id'} = $data->{Id} if exists $data->{Id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $data->{"Id"} 7 0 7
71 }
72  
73  
74 0 ▶sub to_string {
Subroutine to_string: not called CC=2 SCAR=17.9
Pod documented
75 0 my $self = shift;
76 0 my $string = sprintf("%-20s%s\n",'UID', ':'.$self->get_id);
77 0 ▶ while (my $item = $self->next_Item) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $item = $self->next_Item) 0 0 0
78 0 $string .= $item->to_string;
79 }
80 0 return $string;
81 }
82  
83 3 1;
84  
85 __END__
« Tools/EUtilities/History.pm ↑ Summary Tools/EUtilities/Info/LinkInfo.pm »