View on
Florent Angly > Bio-Community > Bio::Community::Tools::Accumulator



Annotate this POD


View/Report Bugs


Bio::Community::Tools::Accumulator - Species accumulation curves


  use Bio::Community::Tools::Accumulator;

  # A collector curve 
  my $collector = Bio::Community::Tools::Accumulator->new(
     -metacommunity => $meta,
     -type          => 'collector',
  my $numbers = $collector->get_numbers;
  # or
  my $strings = $collector->get_strings;

  # A rarefaction curve, with custom parameters
  my $rarefaction = Bio::Community::Tools::Accumulator->new(
     -metacommunity   => $meta,
     -type            => 'rarefaction',
     -num_repetitions => 100,
     -num_ticks       => 8,
     -tick_spacing    => 'linear', 
     -alpha_types     => ['simpson', 'shannon'],
  my $numbers = $rarefaction->get_numbers;


This module takes a metacommunity and produces one of two types of species accumulation curves: a rarefaction curve or a collector curve.

In a rarefaction curve, an increasing number of randomly drawn members is sampled from the given communities and alpha diversity is calculated. In a collector curve, an increasing number of communities is randomly drawn and combined and their cumulative alpha diversity is determined.

The average alpha diversity for the different sampling sizes is reported either as array references or a tab-delimited string. Note that no plot is actually drawn.


Florent Angly


User feedback is an integral part of the evolution of this and other Bioperl modules. Please direct usage questions or support issues to the mailing list,, rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

If you have found a bug, please report it on the BioPerl bug tracking system to help us keep track the bugs and their resolution:


Copyright 2011-2014 by Florent Angly <>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.


The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _


 Function: Create a new Bio::Community::Tool::Accumulator object
 Usage   : my $accumulator = Bio::Community::Tool::Accumulator->new( );
 Args    : -metacommunity: see metacommunity()
           -type            : 'rarefaction' or 'collector'
           -num_repetitions : see num_repetitions()
           -num_ticks       : see num_ticks()
           -tick_spacing    : see tick_spacing()
           -alpha_types     : see alpha_types()
           -seed            : see set_seed()
 Returns : a new Bio::Community::Tools::Accumulator object


 Function: Get or set the metacommunity to normalize.
 Usage   : my $meta = $accumulator->metacommunity;
 Args    : A Bio::Community::Meta object
 Returns : A Bio::Community::Meta object


 Function: Get or set the type of accumulation curve to produce.
 Usage   : my $type = $accumulator->type;
 Args    : String of the accumulation type: 'rarefaction' (default) or 'collector'
 Returns : String of the accumulation type


 Function: Get or set the number of num_repetitions to do at each sampling depth.
 Usage   : my $num_repetitions = $accumulator->num_repetitions;
 Args    : positive integer for the number of repetitions
 Returns : positive integer for the number of repetitions


 Function: For rarefaction curves, get or set how many different numbers of
           individuals to sample, for the smallest community. This number may
           not always be honored because ticks have to be integer numbers.
 Usage   : my $num_ticks = $accumulator->num_ticks;
 Args    : positive integer for the number of ticks (default: 10)
 Returns : positive integer for the number of ticks


 Function: Get or set the type of spacing between the ticks of a rarefaction
 Usage   : my $tick_spacing = $accumulator->tick_spacing;
 Args    : String, either 'logarithmic' (default) or 'linear'
 Returns : String


 Function: Get or set the type of alpha diversity to calculate.
 Usage   : my $alphas = $accumulator->alpha_types;
 Args    : Arrayref of alpha diversity types (['observed'] by default).
           See C<type()> in L<Bio::Community::Alpha> for details.
 Returns : Arrayref of alpha diversity types.


 Function: Get or set verbose mode. This displays the number of ticks to use
           before the accumulation curve itself is computed.
 Usage   : $accumulator->verbose(1);
 Args    : 0 (default) or 1
 Returns : 0 or 1


 Function: Calculate the accumulation curve and return the numbers.
 Usage   : my $nums = $accumulator->get_numbers;
 Args    : none
 Returns : A structure containing the average alpha diversity of the communities
           for each tick value, for each requested alpha type:
              { alpha_type => [ [tick, alpha1, alpha2, ... ], ... ], ... }


 Function: Calculate the accumulation curves and return them as strings.
 Usage   : my $strings = $accumulator->get_strings;
 Args    : none
 Returns : A arrayref of strings, each of which represents the accumulation
           curve for a given alpha diversity type.
syntax highlighting: