blib/lib/Bio/Community/IO/Driver/dummy.pm

filter: Statementstmt 46.1% 42 / 91 Branchbran 2.2% 1 / 44 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 60.8% 14 / 23 Podpod n/a totaltotal 30.3% 57 / 188 CC 29 SCAR 29.4
CC
29
Cov
28%
write_member
58.8
_write_metacommunity_init
22.2
_write_community_init
22.2
CRAP 18.9
« blib/lib/Bio/Community/Tools/ShrapnelCleaner.pm ↑ Summary blib/lib/Bio/Community/Tools/Sampler.pm »
1 # BioPerl module for Bio::Community::IO::Driver::dummy
2 #
3 # Please direct questions and support issues to <bioperl-l@bioperl.org>
4 #
5 # Copyright 2011-2014 Florent Angly <florent.angly@gmail.com>
6 #
7 # You may distribute this module under the same terms as perl itself
8  
9  
10 =head1 NAME
11  
12 Bio::Community::IO::Driver::dummy - Dummy driver (does nothing)
13  
14 =head1 SYNOPSIS
15  
16 my $in = Bio::Community::IO->new( -file => 'dummy_communities.txt', -format => 'dummy' );
17  
18 # See Bio::Community::IO for more information
19  
20 =head1 DESCRIPTION
21  
22 This module does nothing useful. Its sole purpose is to demonstrate the basic
23 way to create a driver for Bio::Community::IO.
24  
25 =head1 CONSTRUCTOR
26  
27 See L<Bio::Community::IO>.
28  
29 =head1 AUTHOR
30  
31 Florent Angly L<florent.angly@gmail.com>
32  
33 =head1 SUPPORT AND BUGS
34  
35 User feedback is an integral part of the evolution of this and other Bioperl
36 modules. Please direct usage questions or support issues to the mailing list,
37 L<bioperl-l@bioperl.org>, rather than to the module maintainer directly. Many
38 experienced and reponsive experts will be able look at the problem and quickly
39 address it. Please include a thorough description of the problem with code and
40 data examples if at all possible.
41  
42 If you have found a bug, please report it on the BioPerl bug tracking system
43 to help us keep track the bugs and their resolution:
44 L<https://redmine.open-bio.org/projects/bioperl/>
45  
46 =head1 COPYRIGHT
47  
48 Copyright 2011-2014 by Florent Angly <florent.angly@gmail.com>
49  
50 This library is free software; you can redistribute it and/or modify
51 it under the same terms as Perl itself, either Perl version 5.10.1 or,
52 at your option, any later version of Perl 5 you may have available.
53  
54 =cut
55  
56  
57 package Bio::Community::IO::Driver::dummy;
58  
59 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
61 1 ▶use Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 1 extends 'Bio::Community::IO';
64 1 with 'Bio::Community::Role::IO';
65  
66  
67 1 our $multiple_communities = 0; # the format supports one community per file
68 1 our $default_sort_members = 0; # members not sorted by abundance
69 1 our $default_abundance = 'count'; # report raw counts
70 1 our $default_missing_string = '-'; # empty members represented as '-'
71 1 our $explicit_ids = 0; # IDs are not explicitly recorded
72  
73  
74 1 has 'dummy' => (
75 is => 'rw',
76 isa => 'Str',
77 required => 0,
78 init_arg => undef,
79 );
80  
81  
82 # The methods that must be implemented by a driver are:
83 # For reading:
84 # _next_metacommunity_init(), _next_community_init(), next_member(), _next_community_finish(), _next_metacommunity_finish()
85 # For writing:
86 # _write_metacommunity_init(), _write_community_init(), write_member(), _write_community_finish(), write_metacommunity_finish()
87  
88  
89 1 ▶method _next_metacommunity_init () {
Subroutine BEGIN: called CC=1 SCAR=2.6
Subroutine _next_metacommunity_init: not called CC=2 SCAR=13.0
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 0 0
90 0 my $name = 'dummy community';
91 0 return $name;
92 }
93  
94 1 ▶method _next_community_init () {
Subroutine BEGIN: called CC=1 SCAR=2.6
Subroutine _next_community_init: not called CC=2 SCAR=13.0
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 0 0
95 0 my $name = 'dummy community';
96 0 return $name;
97 }
98  
99 1 ▶method next_member () {
Subroutine BEGIN: called CC=1 SCAR=2.6
Subroutine next_member: not called CC=2 SCAR=13.6
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 0 0
100 0 my ($member, $count);
101 # Somehow read and create a member here...
102 0 $self->_attach_weights($member);
103 0 return $member, $count;
104 }
105  
106 1 ▶method _next_community_finish () {
Subroutine BEGIN: called CC=1 SCAR=2.6
Subroutine _next_community_finish: not called CC=2 SCAR=12.4
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 0 0
107 0 return 1;
108 }
109  
110 1 ▶method _next_metacommunity_finish () {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _next_metacommunity_finish: called CC=2 SCAR=7.0
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 1 1
111 1 return 1;
112 }
113  
114  
115 1 ▶method _write_metacommunity_init (Bio::Community::Meta $meta) {
Subroutine BEGIN: called CC=1 SCAR=5.1
Subroutine _write_metacommunity_init: not called CC=5 SCAR=31.0
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Meta"))->check($meta) 0 0 0
if scalar @_ > 1 0 0 0
Condition0%0/3
$Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
l!l&&r!l&&!r
000
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
$Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} "Method::Signatures"->_make_constraint("Bio::Community::Meta")
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"}B= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
ABresult
1X1
011
000
116 0 return 1;
117 }
118  
119 1 ▶method _write_community_init (Bio::Community $community) {
Subroutine BEGIN: called CC=1 SCAR=5.1
Subroutine _write_community_init: not called CC=5 SCAR=31.0
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"Bio::Community"} ||= "Method::Signatures"->_make_constraint("Bio::Community"))->check($community) 0 0 0
if scalar @_ > 1 0 0 0
Condition0%0/3
$Method::Signatures::mutc{"cache"}{"Bio::Community"} ||= "Method::Signatures"->_make_constraint("Bio::Community")
l!l&&r!l&&!r
000
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Bio::Community"} ||= "Method::Signatures"->_make_constraint("Bio::Community")
$Method::Signatures::mutc{"cache"}{"Bio::Community"} "Method::Signatures"->_make_constraint("Bio::Community")
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community"}B= "Method::Signatures"->_make_constraint("Bio::Community")
ABresult
1X1
011
000
120 0 return 1;
121 }
122  
123 1 ▶method write_member (Bio::Community::Member $member, Count $count) {
Subroutine BEGIN: called CC=1 SCAR=5.8
Subroutine write_member: not called CC=8 SCAR=40.7
Branch: 5 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"Bio::Community::Member"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Member"))->check($member) 0 0 0
unless scalar @_ > 1 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"Count"} ||= "Method::Signatures"->_make_constraint("Count"))->check($count) 0 0 0
if scalar @_ > 2 0 0 0
Condition0%0/6
$Method::Signatures::mutc{"cache"}{"Bio::Community::Member"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Member")
l!l&&r!l&&!r
000
$Method::Signatures::mutc{"cache"}{"Count"} ||= "Method::Signatures"->_make_constraint("Count")
l!l&&r!l&&!r
000
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Bio::Community::Member"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Member")
$Method::Signatures::mutc{"cache"}{"Bio::Community::Member"} "Method::Signatures"->_make_constraint("Bio::Community::Member")
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Count"} ||= "Method::Signatures"->_make_constraint("Count")
$Method::Signatures::mutc{"cache"}{"Count"} "Method::Signatures"->_make_constraint("Count")
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community::Member"}B= "Method::Signatures"->_make_constraint("Bio::Community::Member")
ABresult
1X1
011
000
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Count"}B= "Method::Signatures"->_make_constraint("Count")
ABresult
1X1
011
000
124 0 return 1;
125 }
126  
127 1 ▶method _write_community_finish (Bio::Community $community) {
Subroutine BEGIN: called CC=1 SCAR=5.1
Subroutine _write_community_finish: not called CC=5 SCAR=31.0
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"Bio::Community"} ||= "Method::Signatures"->_make_constraint("Bio::Community"))->check($community) 0 0 0
if scalar @_ > 1 0 0 0
Condition0%0/3
$Method::Signatures::mutc{"cache"}{"Bio::Community"} ||= "Method::Signatures"->_make_constraint("Bio::Community")
l!l&&r!l&&!r
000
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Bio::Community"} ||= "Method::Signatures"->_make_constraint("Bio::Community")
$Method::Signatures::mutc{"cache"}{"Bio::Community"} "Method::Signatures"->_make_constraint("Bio::Community")
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community"}B= "Method::Signatures"->_make_constraint("Bio::Community")
ABresult
1X1
011
000
128 0 return 1;
129 }
130  
131 1 ▶method _write_metacommunity_finish (Bio::Community::Meta $meta) {
Subroutine BEGIN: called CC=1 SCAR=5.1
Subroutine _write_metacommunity_finish: not called CC=5 SCAR=31.0
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Meta"))->check($meta) 0 0 0
if scalar @_ > 1 0 0 0
Condition0%0/3
$Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
l!l&&r!l&&!r
000
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
$Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} "Method::Signatures"->_make_constraint("Bio::Community::Meta")
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"}B= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
ABresult
1X1
011
000
132 0 return 1;
133 }
134  
135 1 __PACKAGE__->meta->make_immutable;
136  
137 1 1;
« blib/lib/Bio/Community/Tools/ShrapnelCleaner.pm ↑ Summary blib/lib/Bio/Community/Tools/Sampler.pm »