Tools/EUtilities/Summary/DocSum.pm

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