Tools/EUtilities/Summary/DocSum.pm

filter: Statementstmt 80.0% 40 / 50 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 68.1% 60 / 88 CC 11 SCAR 15.6
CC
11
Cov
67%
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 our $AUTHORITY = 'cpan:BIOPERLML';
3 3 $Bio::Tools::EUtilities::Summary::DocSum::VERSION = '1.74';
4 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use base qw(Bio::Root::Root Bio::Tools::EUtilities::Summary::ItemContainerI);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Bio::Tools::EUtilities::Summary::Item;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ABSTRACT: Data object for document summary data from esummary.
11 # AUTHOR: Chris Fields <cjfields@bioperl.org>
12 # OWNER: 2006-2013 Chris Fields
13 # LICENSE: Perl_5
14  
15  
16  
17 sub new {
18 7 ▶ my ($class, @args) = @_;
Subroutine new: called CC=2 SCAR=7.0
Pod documented
19 7 my $self = $class->SUPER::new(@args);
20 7 my ($type) = $self->_rearrange(['DATATYPE'],@args);
21 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
22 7 $self->eutil('esummary');
23 7 $self->datatype($type);
24 7 return $self;
25 }
26  
27  
28 sub get_ids {
29 2 ▶ my $self = shift;
Subroutine get_ids: called CC=2 SCAR=7.2
Pod documented
30 2 ▶ return wantarray ? $self->{'_id'} : [$self->{'_id'}];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 0 2
31 }
32  
33  
34 sub get_id {
35 9 ▶ my $self = shift;
Subroutine get_id: called CC=1 SCAR=0.0
Pod documented
36 9 return $self->{'_id'};
37 }
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48 sub rewind {
49 0 ▶ my ($self, $request) = @_;
Subroutine rewind: not called CC=3 SCAR=24.8
Pod documented
50 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
51 0 map {$_->rewind('all') } $self->get_Items;
52 }
53 0 delete $self->{"_items_it"};
54 }
55  
56 # private EUtilDataI method
57  
58 sub _add_data {
59 7 ▶ my ($self, $data) = @_;
Subroutine _add_data: called CC=6 SCAR=18.5
60 7 ▶ if ($data->{Item}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{"Item"}) 7 0 7
61 7 ▶ $self->{'_id'} = $data->{Id} if exists $data->{Id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $data->{"Id"} 7 0 7
62 7 for my $sd (@{ $data->{Item} } ) {
63 64 ▶ $sd->{Id} = $data->{Id} if exists $data->{Id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $data->{"Id"} 64 0 64
64 64 my $subdoc =
65 Bio::Tools::EUtilities::Summary::Item->new(-datatype => 'item',
66 -verbose => $self->verbose);
67 64 $subdoc->_add_data($sd);
68 64 push @{ $self->{'_items'} }, $subdoc;
69 }
70 }
71 7 ▶ $self->{'_id'} = $data->{Id} if exists $data->{Id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $data->{"Id"} 7 0 7
72 }
73  
74  
75 sub to_string {
76 0 ▶ my $self = shift;
Subroutine to_string: not called CC=2 SCAR=17.9
Pod documented
77 0 my $string = sprintf("%-20s%s\n",'UID', ':'.$self->get_id);
78 0 ▶ while (my $item = $self->next_Item) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $item = $self->next_Item) 0 0 0
79 0 $string .= $item->to_string;
80 }
81 0 return $string;
82 }
83  
84 3 1;
85  
86 __END__
« Tools/EUtilities/History.pm ↑ Summary Tools/EUtilities/Info/LinkInfo.pm »