| 1 | # BioPerl module for Bio::Community::Alpha | ||||||||||||||||||
| 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::Alpha - Calculate the alpha diversity of a community | ||||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | =head1 SYNOPSIS | ||||||||||||||||||
| 15 | |||||||||||||||||||
| 16 | use Bio::Community::Alpha; | ||||||||||||||||||
| 17 | |||||||||||||||||||
| 18 | my $alpha = Bio::Community::Alpha->new( -community => $community, | ||||||||||||||||||
| 19 | -type => 'observed' ); | ||||||||||||||||||
| 20 | my $richness = $alpha->get_alpha; | ||||||||||||||||||
| 21 | |||||||||||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||||||||||
| 23 | |||||||||||||||||||
| 24 | The Bio::Community::Alpha module calculates alpha diversity, i.e. the diversity | ||||||||||||||||||
| 25 | contained within a community. Higer alpha diversity values indicate more diverse | ||||||||||||||||||
| 26 | communities. | ||||||||||||||||||
| 27 | |||||||||||||||||||
| 28 | =head1 METRICS | ||||||||||||||||||
| 29 | |||||||||||||||||||
| 30 | This module calculates different types of alpha diversity: richness, evenness, | ||||||||||||||||||
| 31 | dominance and indices. Specifically, the following metrics are supported and | ||||||||||||||||||
| 32 | can be specified using the C<type()> method: | ||||||||||||||||||
| 33 | |||||||||||||||||||
| 34 | =head2 Richness | ||||||||||||||||||
| 35 | |||||||||||||||||||
| 36 | Richness is the estimated number of species in a community. Some of these metrics | ||||||||||||||||||
| 37 | base their estimate on species abundance data and need I<integer counts>. | ||||||||||||||||||
| 38 | |||||||||||||||||||
| 39 | =over | ||||||||||||||||||
| 40 | |||||||||||||||||||
| 41 | =item observed | ||||||||||||||||||
| 42 | |||||||||||||||||||
| 43 | Observed richness C<S>. | ||||||||||||||||||
| 44 | |||||||||||||||||||
| 45 | =item menhinick | ||||||||||||||||||
| 46 | |||||||||||||||||||
| 47 | Menhinick's richness C<S/sqrt(n)>, where C<n> is the total counts (observations). | ||||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | =item margalef | ||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | Margalef's richness C<(S-1)/ln(n)>. | ||||||||||||||||||
| 52 | |||||||||||||||||||
| 53 | =item chao1 | ||||||||||||||||||
| 54 | |||||||||||||||||||
| 55 | Bias-corrected chao1 richness, C<S+n1*(n1-1)/(2*(n2+1))>, where C<n1> and C<n2> | ||||||||||||||||||
| 56 | are the number of singletons and doubletons, respectively. Particularly useful | ||||||||||||||||||
| 57 | for data skewed by low-abundance species, e.g. microbial data. | ||||||||||||||||||
| 58 | |||||||||||||||||||
| 59 | =item ace | ||||||||||||||||||
| 60 | |||||||||||||||||||
| 61 | Abundance-based Coverage Estimator (ACE). | ||||||||||||||||||
| 62 | |||||||||||||||||||
| 63 | =item jack1 | ||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | First-order jackknife richness estimator, C<S+n1>. | ||||||||||||||||||
| 66 | |||||||||||||||||||
| 67 | =item jack2 | ||||||||||||||||||
| 68 | |||||||||||||||||||
| 69 | Second-order jackknife richness estimator, C<S+2*n1-n2>. | ||||||||||||||||||
| 70 | |||||||||||||||||||
| 71 | =back | ||||||||||||||||||
| 72 | |||||||||||||||||||
| 73 | =head2 Evenness | ||||||||||||||||||
| 74 | |||||||||||||||||||
| 75 | Evenness or equitability, represents how similar in abundance members of a | ||||||||||||||||||
| 76 | community are. | ||||||||||||||||||
| 77 | |||||||||||||||||||
| 78 | =over | ||||||||||||||||||
| 79 | |||||||||||||||||||
| 80 | =item buzas | ||||||||||||||||||
| 81 | |||||||||||||||||||
| 82 | Buzas & Gibson's (or Sheldon's) evenness, C<e^H/S>. Ranges from 0 to 1. | ||||||||||||||||||
| 83 | |||||||||||||||||||
| 84 | =item heip | ||||||||||||||||||
| 85 | |||||||||||||||||||
| 86 | Heip's evenness, C<(e^H-1)/(S-1)>. Ranges from 0 to 1. | ||||||||||||||||||
| 87 | |||||||||||||||||||
| 88 | =item shannon_e | ||||||||||||||||||
| 89 | |||||||||||||||||||
| 90 | Shannon's evenness, or the Shannon-Wiener index divided by the maximum | ||||||||||||||||||
| 91 | diversity possible in the community. Ranges from 0 to 1. | ||||||||||||||||||
| 92 | |||||||||||||||||||
| 93 | =item simpson_e | ||||||||||||||||||
| 94 | |||||||||||||||||||
| 95 | Simpson's evenness, or the Simpson's Index of Diversity divided by the maximum | ||||||||||||||||||
| 96 | diversity possible in the community. Ranges from 0 to 1. | ||||||||||||||||||
| 97 | |||||||||||||||||||
| 98 | =item brillouin_e | ||||||||||||||||||
| 99 | |||||||||||||||||||
| 100 | Brillouin's evenness, or the Brillouin's index divided by the maximum diversity | ||||||||||||||||||
| 101 | possible in the community. Ranges from 0 to 1. Note that the L<Math::GSL::SF> | ||||||||||||||||||
| 102 | module is needed to calculate this metric. | ||||||||||||||||||
| 103 | |||||||||||||||||||
| 104 | =item hill_e | ||||||||||||||||||
| 105 | |||||||||||||||||||
| 106 | Hill's C<E_2,1> evenness, i.e. Simpson's Reciprocal index divided by C<e^H>. | ||||||||||||||||||
| 107 | |||||||||||||||||||
| 108 | =item mcintosh_e | ||||||||||||||||||
| 109 | |||||||||||||||||||
| 110 | McIntosh's evenness. | ||||||||||||||||||
| 111 | |||||||||||||||||||
| 112 | =item camargo | ||||||||||||||||||
| 113 | |||||||||||||||||||
| 114 | Camargo's eveness. Ranges from 0 to 1. | ||||||||||||||||||
| 115 | |||||||||||||||||||
| 116 | =back | ||||||||||||||||||
| 117 | |||||||||||||||||||
| 118 | =head2 Dominance | ||||||||||||||||||
| 119 | |||||||||||||||||||
| 120 | Dominance has the opposite meaning of evenness. It is not strictly speaking a | ||||||||||||||||||
| 121 | diversity metrics since the higher the dominance, the lower the diversity. | ||||||||||||||||||
| 122 | |||||||||||||||||||
| 123 | =over | ||||||||||||||||||
| 124 | |||||||||||||||||||
| 125 | =item simpson_d | ||||||||||||||||||
| 126 | |||||||||||||||||||
| 127 | Simpson's Dominance Index C<D>. Ranges from 0 to 1. | ||||||||||||||||||
| 128 | |||||||||||||||||||
| 129 | =item berger | ||||||||||||||||||
| 130 | |||||||||||||||||||
| 131 | Berger-Parker dominance, i.e. the proportion of the most abundant species. | ||||||||||||||||||
| 132 | Ranges from 0 to 1. | ||||||||||||||||||
| 133 | |||||||||||||||||||
| 134 | =back | ||||||||||||||||||
| 135 | |||||||||||||||||||
| 136 | =head2 Indices | ||||||||||||||||||
| 137 | |||||||||||||||||||
| 138 | Indices (accounting for species abundance): | ||||||||||||||||||
| 139 | |||||||||||||||||||
| 140 | =over | ||||||||||||||||||
| 141 | |||||||||||||||||||
| 142 | =item shannon | ||||||||||||||||||
| 143 | |||||||||||||||||||
| 144 | Shannon-Wiener index C<H>. Emphasizes richness and ranges from 0 to infinity. | ||||||||||||||||||
| 145 | |||||||||||||||||||
| 146 | =item simpson | ||||||||||||||||||
| 147 | |||||||||||||||||||
| 148 | Simpson's Index of Diversity C<1-D> (or Gini-Simpson index), where C<D> is | ||||||||||||||||||
| 149 | Simpson's dominance index. C<1-D> is the probability that two individuals taken | ||||||||||||||||||
| 150 | randomly are not from the same species. Emphasizes evenness and ranges from 0 | ||||||||||||||||||
| 151 | to 1. | ||||||||||||||||||
| 152 | |||||||||||||||||||
| 153 | =item simpson_r | ||||||||||||||||||
| 154 | |||||||||||||||||||
| 155 | Simpson's Reciprocal Index C<1/D>. Ranges from 1 to infinity. | ||||||||||||||||||
| 156 | |||||||||||||||||||
| 157 | =item brillouin | ||||||||||||||||||
| 158 | |||||||||||||||||||
| 159 | Brillouin's index, appropriate for small, completely censused communities. | ||||||||||||||||||
| 160 | Based on counts, not relative abundance. Note that the L<Math::GSL::SF> module | ||||||||||||||||||
| 161 | is needed to calculate this metric. | ||||||||||||||||||
| 162 | |||||||||||||||||||
| 163 | =item hill | ||||||||||||||||||
| 164 | |||||||||||||||||||
| 165 | Hill's C<N_inf> index, the inverse of the Berger-Parker dominance. Ranges from | ||||||||||||||||||
| 166 | 1 to infinity. | ||||||||||||||||||
| 167 | |||||||||||||||||||
| 168 | =item mcintosh | ||||||||||||||||||
| 169 | |||||||||||||||||||
| 170 | McIntosh's index. Based on counts, not relative abundance. | ||||||||||||||||||
| 171 | |||||||||||||||||||
| 172 | =back | ||||||||||||||||||
| 173 | |||||||||||||||||||
| 174 | =head1 AUTHOR | ||||||||||||||||||
| 175 | |||||||||||||||||||
| 176 | Florent Angly L<florent.angly@gmail.com> | ||||||||||||||||||
| 177 | |||||||||||||||||||
| 178 | =head1 SUPPORT AND BUGS | ||||||||||||||||||
| 179 | |||||||||||||||||||
| 180 | User feedback is an integral part of the evolution of this and other Bioperl | ||||||||||||||||||
| 181 | modules. Please direct usage questions or support issues to the mailing list, | ||||||||||||||||||
| 182 | L<bioperl-l@bioperl.org>, rather than to the module maintainer directly. Many | ||||||||||||||||||
| 183 | experienced and reponsive experts will be able look at the problem and quickly | ||||||||||||||||||
| 184 | address it. Please include a thorough description of the problem with code and | ||||||||||||||||||
| 185 | data examples if at all possible. | ||||||||||||||||||
| 186 | |||||||||||||||||||
| 187 | If you have found a bug, please report it on the BioPerl bug tracking system | ||||||||||||||||||
| 188 | to help us keep track the bugs and their resolution: | ||||||||||||||||||
| 189 | L<https://redmine.open-bio.org/projects/bioperl/> | ||||||||||||||||||
| 190 | |||||||||||||||||||
| 191 | =head1 COPYRIGHT | ||||||||||||||||||
| 192 | |||||||||||||||||||
| 193 | Copyright 2011-2014 by Florent Angly <florent.angly@gmail.com> | ||||||||||||||||||
| 194 | |||||||||||||||||||
| 195 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||
| 196 | it under the same terms as Perl itself, either Perl version 5.10.1 or, | ||||||||||||||||||
| 197 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||
| 198 | |||||||||||||||||||
| 199 | =head1 APPENDIX | ||||||||||||||||||
| 200 | |||||||||||||||||||
| 201 | The rest of the documentation details each of the object | ||||||||||||||||||
| 202 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||
| 203 | |||||||||||||||||||
| 204 | =head2 new | ||||||||||||||||||
| 205 | |||||||||||||||||||
| 206 | Function: Create a new Bio::Community::Alpha object | ||||||||||||||||||
| 207 | Usage : my $alpha = Bio::Community::Alpha->new( ... ); | ||||||||||||||||||
| 208 | Args : -community : See community(). | ||||||||||||||||||
| 209 | -type : See type(). | ||||||||||||||||||
| 210 | Returns : a new Bio::Community::Alpha object | ||||||||||||||||||
| 211 | |||||||||||||||||||
| 212 | =cut | ||||||||||||||||||
| 213 | |||||||||||||||||||
| 214 | |||||||||||||||||||
| 215 | package Bio::Community::Alpha; | ||||||||||||||||||
| 216 | |||||||||||||||||||
| 217 | 3 | ▶ | use Moose; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 218 | 3 | ▶ | use MooseX::NonMoose; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 219 | 3 | ▶ | use MooseX::StrictConstructor; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 220 | 3 | ▶ | use Method::Signatures; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 221 | 3 | ▶ | use namespace::autoclean; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 222 | 3 | ▶ | use List::Util qw(max); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 223 | |||||||||||||||||||
| 224 | 3 | extends 'Bio::Root::Root'; | |||||||||||||||||
| 225 | |||||||||||||||||||
| 226 | |||||||||||||||||||
| 227 | =head2 community | ||||||||||||||||||
| 228 | |||||||||||||||||||
| 229 | Function: Get or set the community to process. | ||||||||||||||||||
| 230 | Usage : my $community = $alpha->community(); | ||||||||||||||||||
| 231 | Args : A Bio::Community object | ||||||||||||||||||
| 232 | Returns : A Bio::Community object | ||||||||||||||||||
| 233 | |||||||||||||||||||
| 234 | =cut | ||||||||||||||||||
| 235 | |||||||||||||||||||
| 236 | 3 | has community => ( | |||||||||||||||||
| 237 | is => 'ro', | ||||||||||||||||||
| 238 | isa => 'Bio::Community', | ||||||||||||||||||
| 239 | required => 1, | ||||||||||||||||||
| 240 | lazy => 0, | ||||||||||||||||||
| 241 | init_arg => '-community', | ||||||||||||||||||
| 242 | ); | ||||||||||||||||||
| 243 | |||||||||||||||||||
| 244 | |||||||||||||||||||
| 245 | =head2 type | ||||||||||||||||||
| 246 | |||||||||||||||||||
| 247 | Function: Get or set the type of alpha diversity metric to measure. | ||||||||||||||||||
| 248 | Usage : my $type = $alpha->type; | ||||||||||||||||||
| 249 | Args : String of the desired alpha diversity type ('observed' by default). | ||||||||||||||||||
| 250 | See L</METRICS> for details. | ||||||||||||||||||
| 251 | Returns : String of the desired alpha diversity type. | ||||||||||||||||||
| 252 | |||||||||||||||||||
| 253 | =cut | ||||||||||||||||||
| 254 | |||||||||||||||||||
| 255 | 3 | has type => ( | |||||||||||||||||
| 256 | is => 'rw', | ||||||||||||||||||
| 257 | isa => 'AlphaType', | ||||||||||||||||||
| 258 | required => 0, | ||||||||||||||||||
| 259 | lazy => 1, | ||||||||||||||||||
| 260 | default => 'observed', | ||||||||||||||||||
| 261 | init_arg => '-type', | ||||||||||||||||||
| 262 | ); | ||||||||||||||||||
| 263 | |||||||||||||||||||
| 264 | |||||||||||||||||||
| 265 | =head2 get_alpha | ||||||||||||||||||
| 266 | |||||||||||||||||||
| 267 | Function: Calculate the alpha diversity of a community. | ||||||||||||||||||
| 268 | Usage : my $metric = $alpha->get_alpha; | ||||||||||||||||||
| 269 | Args : None | ||||||||||||||||||
| 270 | Returns : A number for the alpha diversity measurement. Undef is returned in | ||||||||||||||||||
| 271 | special cases, e.g. when measuring the evenness or dominance in a | ||||||||||||||||||
| 272 | community with no members. | ||||||||||||||||||
| 273 | |||||||||||||||||||
| 274 | =cut | ||||||||||||||||||
| 275 | |||||||||||||||||||
| 276 | 3 | ▶ | method get_alpha () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
get_alpha: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||
| 277 | 160 | my $metric = '_'.$self->type; | |||||||||||||||||
| 278 | 160 | return $self->$metric(); | |||||||||||||||||
| 279 | }; | ||||||||||||||||||
| 280 | |||||||||||||||||||
| 281 | |||||||||||||||||||
| 282 | 3 | ▶ | method _observed () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_observed: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||
| 283 | # Calculate the observed richness | ||||||||||||||||||
| 284 | 11 | return $self->community->get_richness; | |||||||||||||||||
| 285 | } | ||||||||||||||||||
| 286 | |||||||||||||||||||
| 287 | |||||||||||||||||||
| 288 | 3 | ▶ | method _menhinick () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_menhinick: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 289 | # Calculate the Menhinick richness | ||||||||||||||||||
| 290 | 11 | my $community = $self->community; | |||||||||||||||||
| 291 | 11 | my $counts = $community->get_members_count; | |||||||||||||||||
| 292 | 11 | ▶ | return $counts > 0 ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 293 | $community->get_richness / sqrt($counts) : | ||||||||||||||||||
| 294 | 0; | ||||||||||||||||||
| 295 | } | ||||||||||||||||||
| 296 | |||||||||||||||||||
| 297 | |||||||||||||||||||
| 298 | 3 | ▶ | method _margalef () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_margalef: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 299 | # Calculate the Margalef richness | ||||||||||||||||||
| 300 | 8 | my $community = $self->community; | |||||||||||||||||
| 301 | 8 | my $counts = $community->get_members_count; | |||||||||||||||||
| 302 | 8 | ▶ | return $counts > 1 ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 303 | ($community->get_richness - 1) / log($counts) : | ||||||||||||||||||
| 304 | 0; | ||||||||||||||||||
| 305 | } | ||||||||||||||||||
| 306 | |||||||||||||||||||
| 307 | |||||||||||||||||||
| 308 | 3 | ▶ | method _chao1 () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_chao1: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||
| 309 | # Calculate Chao's bias-corrected chao1 richness | ||||||||||||||||||
| 310 | # We use the bias-corrected version because it is always defined, even if | ||||||||||||||||||
| 311 | # there are no doubletons, contrary to the non-bias corrected version | ||||||||||||||||||
| 312 | # http://www.uvm.edu/~ngotelli/manuscriptpdfs/Chapter%204.pdf page 40 | ||||||||||||||||||
| 313 | 10 | my $community = $self->community; | |||||||||||||||||
| 314 | 10 | my ($n1, $n2) = $self->__calc_xtons($community); | |||||||||||||||||
| 315 | 9 | return $community->get_richness + ($n1*($n1-1)) / (2*($n2+1)); | |||||||||||||||||
| 316 | } | ||||||||||||||||||
| 317 | |||||||||||||||||||
| 318 | |||||||||||||||||||
| 319 | 3 | ▶ | method __calc_xtons ($community) { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
__calc_xtons: called CC=7 SCAR=19.5
Branch: 2 branches
| |||||||||||||||||||
| 320 | # Return the number of singleton and doubletons in the given community | ||||||||||||||||||
| 321 | 24 | my ($n1, $n2) = (0, 0); | |||||||||||||||||
| 322 | 24 | ▶ | while (my $member = $community->next_member('_alpha_calc_xtons')) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 323 | 39 | my $c = $community->get_count($member); | |||||||||||||||||
| 324 | 39 | ▶ | if ($c == 1) { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 325 | 13 | $n1++; | |||||||||||||||||
| 326 | } elsif ($c == 2) { | ||||||||||||||||||
| 327 | 6 | $n2++; | |||||||||||||||||
| 328 | } elsif ( $c != int($c) ) { | ||||||||||||||||||
| 329 | 1 | $self->throw("Got count $c but can only compute metric '".$self->type. | |||||||||||||||||
| 330 | "' on integer abundance data"); | ||||||||||||||||||
| 331 | } | ||||||||||||||||||
| 332 | } | ||||||||||||||||||
| 333 | 23 | return $n1, $n2; | |||||||||||||||||
| 334 | } | ||||||||||||||||||
| 335 | |||||||||||||||||||
| 336 | |||||||||||||||||||
| 337 | 3 | ▶ | method _ace () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_ace: called CC=8 SCAR=20.8
Branch: 1 branch
| |||||||||||||||||||
| 338 | # Calculate abundance-based coverage estimator (ACE) richness. | ||||||||||||||||||
| 339 | # http://www.ncbi.nlm.nih.gov/pmc/articles/PMC93182/ | ||||||||||||||||||
| 340 | 7 | my $d = 0; | |||||||||||||||||
| 341 | 7 | my $community = $self->community; | |||||||||||||||||
| 342 | 7 | ▶ | if ($community->get_richness > 0) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 343 | 6 | my $thresh = 10; | |||||||||||||||||
| 344 | 6 | my @F = (0) x $thresh; # number of singletons, doubletons, tripletons, ... 10-tons | |||||||||||||||||
| 345 | 6 | my ($s_rare, $s_abund) = (0, 0); # number of rare, and abundant (>10) species | |||||||||||||||||
| 346 | 6 | my $n_rare = 0; | |||||||||||||||||
| 347 | 6 | ▶ | while (my $member = $community->next_member('_alpha_ace')) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 348 | 12 | my $c = $community->get_count($member); | |||||||||||||||||
| 349 | 12 | ▶ | if ($c > $thresh) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 350 | 3 | $s_abund++; | |||||||||||||||||
| 351 | } else { | ||||||||||||||||||
| 352 | 9 | $s_rare++; | |||||||||||||||||
| 353 | 9 | ▶ | if ( $c != int($c) ) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 354 | 0 | $self->throw("Got count $c but can only compute ace on integer numbers"); | |||||||||||||||||
| 355 | } else { | ||||||||||||||||||
| 356 | 9 | $F[$c-1]++; | |||||||||||||||||
| 357 | } | ||||||||||||||||||
| 358 | 9 | $n_rare += $c; | |||||||||||||||||
| 359 | } | ||||||||||||||||||
| 360 | } | ||||||||||||||||||
| 361 | 6 | ▶ | if ($n_rare == $F[0]) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 362 | # ACE is not defined when all rare species are singletons. | ||||||||||||||||||
| 363 | # Fall back to chao1 (advised by Anne Chao, implemented in EstimateS) | ||||||||||||||||||
| 364 | 2 | $d = $self->_chao1(); | |||||||||||||||||
| 365 | } else { | ||||||||||||||||||
| 366 | 4 | my $tmp_sum = 0; | |||||||||||||||||
| 367 | 4 | for my $k (2 .. $thresh) { | |||||||||||||||||
| 368 | 36 | $tmp_sum += $k * ($k-1) * $F[$k-1]; | |||||||||||||||||
| 369 | } | ||||||||||||||||||
| 370 | 4 | my $C = 1 - $F[0]/$n_rare; | |||||||||||||||||
| 371 | 4 | my $gamma = ($s_rare * $tmp_sum) / ($C * $n_rare * ($n_rare-1)) - 1; | |||||||||||||||||
| 372 | 4 | $gamma = max($gamma, 0); | |||||||||||||||||
| 373 | 4 | $d = $s_abund + $s_rare/$C + $F[0]*$gamma/$C; | |||||||||||||||||
| 374 | } | ||||||||||||||||||
| 375 | } | ||||||||||||||||||
| 376 | 7 | return $d; | |||||||||||||||||
| 377 | } | ||||||||||||||||||
| 378 | |||||||||||||||||||
| 379 | |||||||||||||||||||
| 380 | 3 | ▶ | method _jack1 () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_jack1: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||
| 381 | # Calculate first-order jackknife richness estimator. | ||||||||||||||||||
| 382 | # http://www.uvm.edu/~ngotelli/manuscriptpdfs/Chapter%204.pdf page 41 | ||||||||||||||||||
| 383 | 7 | my $community = $self->community; | |||||||||||||||||
| 384 | 7 | my ($n1, $n2) = $self->__calc_xtons($community); | |||||||||||||||||
| 385 | 7 | return $community->get_richness + $n1; | |||||||||||||||||
| 386 | } | ||||||||||||||||||
| 387 | |||||||||||||||||||
| 388 | |||||||||||||||||||
| 389 | 3 | ▶ | method _jack2 () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_jack2: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||
| 390 | # Calculate second-order jackknife richness estimator. | ||||||||||||||||||
| 391 | # http://www.uvm.edu/~ngotelli/manuscriptpdfs/Chapter%204.pdf page 41 | ||||||||||||||||||
| 392 | 7 | my $community = $self->community; | |||||||||||||||||
| 393 | 7 | my ($n1, $n2) = $self->__calc_xtons($community); | |||||||||||||||||
| 394 | 7 | return $community->get_richness + 2 * $n1 - $n2; | |||||||||||||||||
| 395 | } | ||||||||||||||||||
| 396 | |||||||||||||||||||
| 397 | |||||||||||||||||||
| 398 | 3 | ▶ | method _buzas () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_buzas: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 399 | # Calculate Buzas and Gibson's evenness | ||||||||||||||||||
| 400 | # http://folk.uio.no/ohammer/past/diversity.html | ||||||||||||||||||
| 401 | 7 | my $richness = $self->community->get_richness; | |||||||||||||||||
| 402 | 7 | ▶ | return $richness > 0 ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 403 | exp($self->_shannon) / $richness : | ||||||||||||||||||
| 404 | undef; | ||||||||||||||||||
| 405 | } | ||||||||||||||||||
| 406 | |||||||||||||||||||
| 407 | |||||||||||||||||||
| 408 | 3 | ▶ | method _heip () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_heip: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 409 | # Calculate Heip's evenness | ||||||||||||||||||
| 410 | # http://www.pisces-conservaton.com/sdrhelp/index.html?heip.htm | ||||||||||||||||||
| 411 | 8 | my $richness = $self->community->get_richness; | |||||||||||||||||
| 412 | 8 | ▶ | return $richness > 1 ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 413 | (exp($self->_shannon) - 1) / ($richness - 1) : | ||||||||||||||||||
| 414 | undef; | ||||||||||||||||||
| 415 | } | ||||||||||||||||||
| 416 | |||||||||||||||||||
| 417 | |||||||||||||||||||
| 418 | 3 | ▶ | method _shannon_e () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_shannon_e: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||
| 419 | # Calculate Shannon's evenness | ||||||||||||||||||
| 420 | 7 | my $e = undef; | |||||||||||||||||
| 421 | 7 | my $community = $self->community; | |||||||||||||||||
| 422 | 7 | my $richness = $community->get_richness; | |||||||||||||||||
| 423 | 7 | ▶ | if ($richness > 0) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 424 | 6 | $e = 0; | |||||||||||||||||
| 425 | 6 | ▶ | if ($richness > 1) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 426 | 3 | $e = $self->_shannon / log($richness); | |||||||||||||||||
| 427 | } | ||||||||||||||||||
| 428 | } | ||||||||||||||||||
| 429 | 7 | return $e; | |||||||||||||||||
| 430 | } | ||||||||||||||||||
| 431 | |||||||||||||||||||
| 432 | |||||||||||||||||||
| 433 | 3 | ▶ | method _simpson_e () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_simpson_e: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||
| 434 | # Calculate Simpson's evenness | ||||||||||||||||||
| 435 | 7 | my $e = undef; | |||||||||||||||||
| 436 | 7 | my $richness = $self->community->get_richness; | |||||||||||||||||
| 437 | 7 | ▶ | if ($richness > 0) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 438 | 6 | $e = 0; | |||||||||||||||||
| 439 | 6 | ▶ | if ($richness > 1) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 440 | 3 | $e = $self->_simpson / (1 - 1/$richness); | |||||||||||||||||
| 441 | } | ||||||||||||||||||
| 442 | } | ||||||||||||||||||
| 443 | 7 | return $e; | |||||||||||||||||
| 444 | } | ||||||||||||||||||
| 445 | |||||||||||||||||||
| 446 | |||||||||||||||||||
| 447 | 3 | ▶ | method _hill_e () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_hill_e: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 448 | # Calculate Hill's E_2,1 evenness | ||||||||||||||||||
| 449 | # http://www.wcsmalaysia.org/analysis/diversityIndexMenagerie.htm#Hill | ||||||||||||||||||
| 450 | 7 | ▶ | return $self->community->get_richness > 0 ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 451 | $self->_simpson_r / exp($self->_shannon) : | ||||||||||||||||||
| 452 | undef; | ||||||||||||||||||
| 453 | } | ||||||||||||||||||
| 454 | |||||||||||||||||||
| 455 | |||||||||||||||||||
| 456 | 3 | ▶ | method _brillouin_e () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_brillouin_e: called CC=5 SCAR=24.3
Branch: 1 branch
| |||||||||||||||||||
| 457 | # Calculate Brillouin's evenness | ||||||||||||||||||
| 458 | # http://www.wcsmalaysia.org/analysis/diversityIndexMenagerie.htm#Brillouin | ||||||||||||||||||
| 459 | # We replaced the factorial function by its generalization, the gamma | ||||||||||||||||||
| 460 | # function, to be able to handle decimal numbers. | ||||||||||||||||||
| 461 | 1 | my $b = undef; | |||||||||||||||||
| 462 | 1 | my $community = $self->community; | |||||||||||||||||
| 463 | 1 | my $S = $community->get_richness; | |||||||||||||||||
| 464 | 1 | ▶ | if ($S > 0) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 465 | 0 | $b = 0; | |||||||||||||||||
| 466 | 0 | ▶ | if ($S > 1) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 467 | 0 | ▶ | if (not eval { require Math::GSL::SF }) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 468 | 0 | $self->throw("Need module Math::GSL::SF to calculate brillouin_e\n$@"); | |||||||||||||||||
| 469 | } | ||||||||||||||||||
| 470 | 0 | my $N = $community->get_members_count; | |||||||||||||||||
| 471 | 0 | my $n = int( $N / $S ); | |||||||||||||||||
| 472 | 0 | my $r = $N - $S * $n; | |||||||||||||||||
| 473 | 0 | my $tmp1 = Math::GSL::SF::gsl_sf_lngamma($N ); | |||||||||||||||||
| 474 | 0 | my $tmp2 = $r * Math::GSL::SF::gsl_sf_lngamma($n+1); | |||||||||||||||||
| 475 | 0 | my $tmp3 = ($S-$r) * Math::GSL::SF::gsl_sf_lngamma($n ); | |||||||||||||||||
| 476 | 0 | my $bmax = ($tmp1 - $tmp2 - $tmp3) / $N; | |||||||||||||||||
| 477 | 0 | $b = $self->_brillouin / $bmax; | |||||||||||||||||
| 478 | } | ||||||||||||||||||
| 479 | } | ||||||||||||||||||
| 480 | 1 | return $b; | |||||||||||||||||
| 481 | } | ||||||||||||||||||
| 482 | |||||||||||||||||||
| 483 | |||||||||||||||||||
| 484 | 3 | ▶ | method _mcintosh_e () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_mcintosh_e: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||
| 485 | # Calculate McIntosh's evenness | ||||||||||||||||||
| 486 | 7 | my $d = undef; | |||||||||||||||||
| 487 | 7 | my $community = $self->community; | |||||||||||||||||
| 488 | 7 | my $S = $community->get_richness; | |||||||||||||||||
| 489 | 7 | ▶ | if ($S > 0) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 490 | 6 | my $U = 0; | |||||||||||||||||
| 491 | 6 | ▶ | while (my $member = $community->next_member('_alpha_mcintosh_e')) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 492 | 12 | my $c = $community->get_count($member); | |||||||||||||||||
| 493 | 12 | $U += $c**2; | |||||||||||||||||
| 494 | } | ||||||||||||||||||
| 495 | 6 | $U = sqrt($U); | |||||||||||||||||
| 496 | 6 | my $N = $community->get_members_count; | |||||||||||||||||
| 497 | 6 | $d = $U / sqrt( ($N-$S+1)**2 + $S - 1 ); | |||||||||||||||||
| 498 | } | ||||||||||||||||||
| 499 | 7 | return $d; | |||||||||||||||||
| 500 | } | ||||||||||||||||||
| 501 | |||||||||||||||||||
| 502 | |||||||||||||||||||
| 503 | 3 | ▶ | method _camargo () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_camargo: called CC=5 SCAR=16.1
Branch: 1 branch
| |||||||||||||||||||
| 504 | # Calculate Camargo's evenness | ||||||||||||||||||
| 505 | # http://www.pisces-conservation.com/sdrhelp/index.html?camargo.htm | ||||||||||||||||||
| 506 | 7 | my $d = undef; | |||||||||||||||||
| 507 | 7 | my $community = $self->community; | |||||||||||||||||
| 508 | 7 | my $S = $community->get_richness; | |||||||||||||||||
| 509 | 7 | ▶ | if ($S > 0) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 510 | 6 | my @p = map { $community->get_rel_ab($_) / 100 } @{$community->get_all_members}; | |||||||||||||||||
| 511 | 6 | $d = 0; | |||||||||||||||||
| 512 | 6 | for my $i (1 .. $S) { | |||||||||||||||||
| 513 | 12 | for my $j ($i+1 .. $S) { | |||||||||||||||||
| 514 | 10 | $d += abs($p[$i-1] - $p[$j-1]) / $S; | |||||||||||||||||
| 515 | } | ||||||||||||||||||
| 516 | } | ||||||||||||||||||
| 517 | 6 | $d = 1 - $d; | |||||||||||||||||
| 518 | } | ||||||||||||||||||
| 519 | 7 | return $d; | |||||||||||||||||
| 520 | } | ||||||||||||||||||
| 521 | |||||||||||||||||||
| 522 | |||||||||||||||||||
| 523 | 3 | ▶ | method _shannon () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_shannon: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 524 | # Calculate the Shannon-Wiener index | ||||||||||||||||||
| 525 | 27 | my $d = 0; | |||||||||||||||||
| 526 | 27 | my $community = $self->community; | |||||||||||||||||
| 527 | 27 | ▶ | while (my $member = $community->next_member('_alpha_shannon')) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 528 | 60 | my $p = $community->get_rel_ab($member) / 100; | |||||||||||||||||
| 529 | 60 | $d += $p * log($p); | |||||||||||||||||
| 530 | } | ||||||||||||||||||
| 531 | 27 | return -$d; | |||||||||||||||||
| 532 | } | ||||||||||||||||||
| 533 | |||||||||||||||||||
| 534 | |||||||||||||||||||
| 535 | 3 | ▶ | method _simpson () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_simpson: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 536 | # Calculate Simpson's Index of Diversity (1-D) | ||||||||||||||||||
| 537 | 10 | my $richness = $self->community->get_richness; | |||||||||||||||||
| 538 | 10 | ▶ | return $richness > 0 ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 539 | 1 - $self->_simpson_d : | ||||||||||||||||||
| 540 | 0; | ||||||||||||||||||
| 541 | } | ||||||||||||||||||
| 542 | |||||||||||||||||||
| 543 | |||||||||||||||||||
| 544 | 3 | ▶ | method _simpson_r () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_simpson_r: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 545 | # Calculate Simpson's Reciprocal Index (1/D) | ||||||||||||||||||
| 546 | 13 | my $richness = $self->community->get_richness; | |||||||||||||||||
| 547 | 13 | ▶ | return $richness > 0 ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 548 | 1 / $self->_simpson_d : | ||||||||||||||||||
| 549 | 0; | ||||||||||||||||||
| 550 | } | ||||||||||||||||||
| 551 | |||||||||||||||||||
| 552 | |||||||||||||||||||
| 553 | 3 | ▶ | method _brillouin () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
_brillouin: not called CC=5 SCAR=32.0
Branch: 1 branch
| |||||||||||||||||||
| 554 | # Calculate Brillouin's index of diversity | ||||||||||||||||||
| 555 | # http://www.wcsmalaysia.org/analysis/diversityIndexMenagerie.htm#Brillouin | ||||||||||||||||||
| 556 | # Use the Math::BigFloat module because i) it has a function to calculate | ||||||||||||||||||
| 557 | # factorial, and ii) it can use Math::BigInt::GMP C-bindings to be faster | ||||||||||||||||||
| 558 | 0 | my $d = 0; | |||||||||||||||||
| 559 | 0 | my $community = $self->community; | |||||||||||||||||
| 560 | 0 | my $N = $community->get_members_count; | |||||||||||||||||
| 561 | 0 | ▶ | if ($N > 0) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 562 | 0 | ▶ | if (not eval { require Math::GSL::SF }) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 563 | 0 | $self->throw("Need module Math::GSL::SF to calculate brillouin_e\n$@"); | |||||||||||||||||
| 564 | } | ||||||||||||||||||
| 565 | 0 | my $sum = 0; | |||||||||||||||||
| 566 | 0 | ▶ | while (my $member = $community->next_member('_alpha_brillouin')) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 567 | 0 | my $c = $community->get_count($member); | |||||||||||||||||
| 568 | 0 | $sum += Math::GSL::SF::gsl_sf_lngamma($c); | |||||||||||||||||
| 569 | } | ||||||||||||||||||
| 570 | 0 | $d = ( Math::GSL::SF::gsl_sf_lngamma($N) - $sum ) / $N; | |||||||||||||||||
| 571 | } | ||||||||||||||||||
| 572 | 0 | return $d; | |||||||||||||||||
| 573 | } | ||||||||||||||||||
| 574 | |||||||||||||||||||
| 575 | |||||||||||||||||||
| 576 | 3 | ▶ | method _hill () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_hill: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 577 | # Calculate Hill's N_inf index of diversity | ||||||||||||||||||
| 578 | # http://www.wcsmalaysia.org/analysis/diversityIndexMenagerie.htm#Hill | ||||||||||||||||||
| 579 | 7 | my $richness = $self->community->get_richness; | |||||||||||||||||
| 580 | 7 | ▶ | return $richness > 0 ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 581 | 1 / $self->_berger : | ||||||||||||||||||
| 582 | 0; | ||||||||||||||||||
| 583 | } | ||||||||||||||||||
| 584 | |||||||||||||||||||
| 585 | |||||||||||||||||||
| 586 | 3 | ▶ | method _mcintosh () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_mcintosh: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||
| 587 | # Calculate McIntosh's index of diversity | ||||||||||||||||||
| 588 | # http://www.pisces-conservation.com/sdrhelp/index.html?mcintoshd.htm | ||||||||||||||||||
| 589 | 7 | my $d = 0; | |||||||||||||||||
| 590 | 7 | my $community = $self->community; | |||||||||||||||||
| 591 | 7 | my $N = $community->get_members_count; | |||||||||||||||||
| 592 | 7 | ▶ | if ($N > 1) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 593 | 5 | my $U = 0; | |||||||||||||||||
| 594 | 5 | ▶ | while (my $member = $community->next_member('_alpha_mcintosh')) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 595 | 11 | my $c = $community->get_count($member); | |||||||||||||||||
| 596 | 11 | $U += $c**2; | |||||||||||||||||
| 597 | } | ||||||||||||||||||
| 598 | 5 | $U = sqrt($U); | |||||||||||||||||
| 599 | 5 | $d = ($N - $U) / ($N - sqrt($N)); | |||||||||||||||||
| 600 | } | ||||||||||||||||||
| 601 | 7 | return $d; | |||||||||||||||||
| 602 | } | ||||||||||||||||||
| 603 | |||||||||||||||||||
| 604 | |||||||||||||||||||
| 605 | 3 | ▶ | method _simpson_d () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_simpson_d: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||
| 606 | # Calculate Simpson's Dominance Index (D) | ||||||||||||||||||
| 607 | 28 | my $d = undef; | |||||||||||||||||
| 608 | 28 | my $community = $self->community; | |||||||||||||||||
| 609 | 28 | ▶ | if ($community->get_richness > 0) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 610 | 27 | ▶ | while (my $member = $community->next_member('_alpha_simpson_d')) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 611 | 57 | my $p = $community->get_rel_ab($member) / 100; | |||||||||||||||||
| 612 | 57 | $d += $p**2; | |||||||||||||||||
| 613 | } | ||||||||||||||||||
| 614 | } | ||||||||||||||||||
| 615 | 28 | return $d; | |||||||||||||||||
| 616 | } | ||||||||||||||||||
| 617 | |||||||||||||||||||
| 618 | |||||||||||||||||||
| 619 | 3 | ▶ | method _berger () { | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_berger: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||
| 620 | # Calculate Berger-Parker's dominance | ||||||||||||||||||
| 621 | 13 | my $community = $self->community; | |||||||||||||||||
| 622 | 13 | my $member = $community->get_member_by_rank(1); | |||||||||||||||||
| 623 | 13 | ▶ | return defined $member ? | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 624 | $community->get_rel_ab($member) / 100 : | ||||||||||||||||||
| 625 | undef; | ||||||||||||||||||
| 626 | } | ||||||||||||||||||
| 627 | |||||||||||||||||||
| 628 | |||||||||||||||||||
| 629 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||
| 630 | |||||||||||||||||||
| 631 | 3 | 1; | |||||||||||||||||