| 1 | # BioPerl module for Bio::Community::IO::Driver::generic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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::generic - Driver to read and write files in a generic tab-delimited site-by-species table format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | my $in = Bio::Community::IO->new( -file => 'gaas_communities.txt', -format => 'generic' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # See Bio::Community::IO for more information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | This Bio::Community::IO::Driver::generic driver reads and writes files in a generic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | format. Multiple communities can be written in a file to generate a site-by- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | species table (OTU table), in which the entries are tab-delimited. Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | Species site A site B | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | species 1 321 94 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | species 2 0 58 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | species 3 47 26 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | For each Bio::Community::Member $member generated from a generic site-by-species | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | file, $member->desc() contains the content of the species field. Since the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | generic format does not specify a member ID, one is automatically generated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | and can be retrieved using $member->id(). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | See L<Bio::Community::IO>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | Florent Angly L<florent.angly@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | =head1 SUPPORT AND BUGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | User feedback is an integral part of the evolution of this and other Bioperl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | modules. Please direct usage questions or support issues to the mailing list, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | L<bioperl-l@bioperl.org>, rather than to the module maintainer directly. Many | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | experienced and reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | address it. Please include a thorough description of the problem with code and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | If you have found a bug, please report it on the BioPerl bug tracking system | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | to help us keep track the bugs and their resolution: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | L<https://redmine.open-bio.org/projects/bioperl/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | Copyright 2011-2014 by Florent Angly <florent.angly@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | it under the same terms as Perl itself, either Perl version 5.10.1 or, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | package Bio::Community::IO::Driver::generic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 4 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | ▶ | use Method::Signatures; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 4 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 4 | ▶ | use Bio::Community::Member; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 4 | extends 'Bio::Community::IO'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 4 | with 'Bio::Community::Role::IO', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 'Bio::Community::Role::Table'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 4 | our $multiple_communities = 1; # format supports several communities per file | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 4 | our $explicit_ids = 0; # IDs are not explicitly recorded | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | #### sorting only effective for first community??? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 4 | our $default_sort_members = 0; # unsorted | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 4 | our $default_abundance_type = 'count'; # absolute count (positive integer) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 4 | our $default_missing_string = 0; # empty members get a '0' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 4 | has '_line' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | isa => 'PositiveInt', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 4 | has '_col' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | isa => 'PositiveInt', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | has '_members' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | isa => 'ArrayRef', # ArrayRef[Bio::Community::Member] but keep it lean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 4 | lazy => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | predicate => '_has_members', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | has '_id2line' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | isa => 'HashRef', # HashRef[String] but keep it lean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | ▶ | default => sub { {} }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 4 | lazy => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 4 | has '_write_desc' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | isa => 'Bool', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | default => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | predicate => '_has_write_desc', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 4 | ▶ | method _generate_members () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_generate_members: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # Make members from the first column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 13 | my @members; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 13 | my $col = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 13 | for my $line (2 .. $self->_get_max_line) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 41 | my $value = $self->_get_value($line, $col); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 41 | my $member = Bio::Community::Member->new( -desc => $value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 41 | $self->_attach_taxon($member, $value, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 41 | $self->_attach_weights($member); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 41 | push @members, $member; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 13 | $self->_members(\@members); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 4 | ▶ | method next_member () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
next_member: called CC=6 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 93 | my ($member, $count); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 93 | my $line = $self->_line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 93 | ▶ | while ( $line++ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # Get the abundance of the member (undef if out-of-bounds) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 122 | $count = $self->_get_value($line, $self->_col); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # No more members for this community. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 122 | ▶ | last if not defined $count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # Skip members with no abundance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 93 | ▶ | next if not $count; # e.g. '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 72 | ▶ | next if $count == 0; # e.g. 0.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # Get the member itself | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 64 | $member = $self->_members->[$line - 2]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 64 | $self->_line($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 64 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 93 | return $member, $count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 4 | ▶ | method _next_community_init () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_next_community_init: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # Go to start of next column and return name of new community. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 42 | my $col = $self->_col + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 42 | my $line = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 42 | my $name = $self->_get_value($line, $col); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 42 | $self->_col( $col ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 42 | $self->_line( $line ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 42 | return $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 4 | ▶ | method _next_community_finish () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_next_community_finish: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 29 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | ▶ | method _next_metacommunity_init () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_next_metacommunity_init: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 13 | $self->_generate_members(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 13 | my $name = ''; # no provision for metacommunity name in this format | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 13 | return $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 4 | ▶ | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 12 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 4 | ▶ | method write_member (Bio::Community::Member $member, Count $count) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
write_member: called CC=13 SCAR=27.3
Branch: 5 branches
Condition66%4/6
$Method::Signatures::mutc{"cache"}{"Bio::Community::Member"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Member")
$Method::Signatures::mutc{"cache"}{"Count"} ||= "Method::Signatures"->_make_constraint("Count")
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 table66%2/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community::Member"}B= "Method::Signatures"->_make_constraint("Bio::Community::Member")
Truth table66%2/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Count"}B= "Method::Signatures"->_make_constraint("Count")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 20 | my $id = $member->id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 20 | my $line = $self->_id2line->{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 20 | ▶ | if (not defined $line) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # Determine whether to write desc or id for all members | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 12 | ▶ | if (not $self->_has_write_desc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 4 | ▶ | if ( (defined $member->desc) && (not $member->desc eq '') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $member->desc and not $member->desc eq ""
MC/DC0%0/2
defined $member->desc and not $member->desc eq ""
defined $member->desc
not $member->desc eq ""
Truth table33%1/3
A and not(B)
A= defined $member->descB= not $member->desc eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 4 | $self->_write_desc(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->_write_desc(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # This member has not been written previously for another community | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 12 | $line = $self->_get_max_line + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 12 | ▶ | $self->_set_value( $line, 1, $self->_write_desc ? $member->desc : $member->id ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 12 | $self->_id2line->{$id} = $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 20 | $self->_set_value($line, $self->_col, $count); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 20 | $self->_line( $line + 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 20 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 4 | ▶ | method _write_community_init (Bio::Community $community) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.3
Subroutine
_write_community_init: called CC=5 SCAR=16.7
Branch: 3 branches
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Bio::Community"} ||= "Method::Signatures"->_make_constraint("Bio::Community")
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 table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community"}B= "Method::Signatures"->_make_constraint("Bio::Community")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # Write header for that community | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 9 | my $col = $self->_col + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 9 | my $line = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 9 | $self->_set_value($line, $col, $community->name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 9 | $self->_line( $line + 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 9 | $self->_col( $col ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 9 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 4 | ▶ | method _write_headers () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_write_headers: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 4 | $self->_set_value(1, 1, 'Species'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 4 | ▶ | method _write_community_finish (Bio::Community $community) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.3
Subroutine
_write_community_finish: called CC=5 SCAR=17.3
Branch: 3 branches
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Bio::Community"} ||= "Method::Signatures"->_make_constraint("Bio::Community")
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 table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community"}B= "Method::Signatures"->_make_constraint("Bio::Community")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 9 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 4 | ▶ | method _write_metacommunity_init (Bio::Community::Meta $meta) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.3
Subroutine
_write_metacommunity_init: called CC=5 SCAR=17.1
Branch: 3 branches
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
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 table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"}B= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 4 | $self->_write_headers; # write first column header | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 4 | ▶ | method _write_metacommunity_finish (Bio::Community::Meta $meta) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.3
Subroutine
_write_metacommunity_finish: called CC=5 SCAR=17.3
Branch: 3 branches
Condition33%1/3
$Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"} ||= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
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 table33%1/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bio::Community::Meta"}B= "Method::Signatures"->_make_constraint("Bio::Community::Meta")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 3 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||