Bio::Community::Tools::Sampler - Sample organisms according to their abundance
use Bio::Community::Tools::Sampler; # Sample members from a reference community my $sampler = Bio::Community::Tools::Sampler->new( -community => $ref_community ); my $member1 = $sampler->get_rand_member(); my $member2 = $sampler->get_rand_member(); # Or sample 100 members in one step my $rand_community = $sampler->get_rand_community( 100 );
Pick individuals at random (without replacement) from a community.
Note that the sampling is done based on relative abundances, and is hence affected by weights. If you need to sample based on counts instead, simply set $community->use_weights(0), before using Bio::Community::Tools::Sampler.
Florent Angly email@example.com
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, firstname.lastname@example.org, 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: https://redmine.open-bio.org/projects/bioperl/
Copyright 2011-2014 by Florent Angly <email@example.com>
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::Sampler object Usage : my $sampler = Bio::Community::Tool::Sampler->new( ); Args : -community: See community(). -seed : See set_seed(). Returns : a new Bio::Community::Tools::Sampler object
Function: Get or set the community to sample from. Usage : my $community = $sampler->community(); Args : a Bio::Community object Returns : a Bio::Community object
Usage : $sampler->set_seed(1234513451); Function: Get or set the seed used to pick the random members. Args : Positive integer Returns : Positive integer
Function: Get a random member from a community (sample with replacement). Usage : my $member = $sampler->get_rand_member(); Args : None Returns : A Bio::Community::Member object
Function: Create a community from random members of a community Usage : my $community = $sampler->get_rand_community(1000); Args : Number of members (positive integer) Returns : A Bio::Community object