Bio-Community

 view release on metacpan or  search on metacpan

lib/Bio/Community/Meta.pm  view on Meta::CPAN

  print "   ".$meta->get_richness." species\n";
  print "   ".$meta->get_members_count." individuals\n";

=head1 DESCRIPTION

The Bio::Community::Meta module represent metacommunities, or groups of
communities. This object holds several Bio::Community objects, for example
tree communities found at different sites of a forest. Random access to any of
the communities is provided. However, the communities can also be accessed
sequentially, in the order they were given. This makes Bio::Community::Meta
capable of representing communities along a natural gradient.

=head1 AUTHOR

Florent Angly L<florent.angly@gmail.com>

=head1 SUPPORT AND BUGS

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, 
L<bioperl-l@bioperl.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:
L<https://redmine.open-bio.org/projects/bioperl/>

=head1 COPYRIGHT

Copyright 2011-2014 by Florent Angly <florent.angly@gmail.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.

=head1 APPENDIX

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

=head2 new

 Function: Create a new Bio::Community::Meta object
 Usage   : my $meta = Bio::Community::Meta->new( ... );
 Args    : -name               : See name()
           -communities        : See add_communities()
           -identify_members_by: See identify_members_by()
 Returns : A new Bio::Community::Meta object

=cut


package Bio::Community::Meta;

use Moose;
use MooseX::NonMoose;
use MooseX::StrictConstructor;
use Method::Signatures;
use namespace::autoclean;
use Tie::IxHash;
use Bio::Community;
use Bio::Community::Member;


extends 'Bio::Root::Root';


method BUILD ($args) {
   # Process -communities constructor
   my $communities = delete $args->{'-communities'};
   if ($communities) {
      $self->add_communities($communities);
   }
}


=head2 name

 Function: Get or set the name of the metacommunity
 Usage   : $meta->name('estuary_salinity_gradient');
           my $name = $meta->name();
 Args    : String for the name
 Returns : String for the name

=cut

has name => (
   is => 'rw',
   isa => 'Str',
   lazy => 1,
   default => '',
   init_arg => '-name',
);


=head2 identify_members_by

 Function: Get or set how members are handled.
           In the Bio::Community modules, members with the same ID are
           considered identical, no matter what their description or taxonomy is.
           If the communities added to the metacommunity come from different
           sources or files, the IDs of the members are unsafe because the same
           member in different communities will likely have a different ID and
           be interpreted as a different member, whereas different members may
           have the same ID and be counted as the same. To work around this, you
           can specify to look at the desc() of the members and give the same ID
           to members that have the same description.
 Usage   : $meta->identify_members_by('desc');
 Args    : String, either 'id' or 'desc'
 Returns : String, either 'id' (default) or 'desc'

=cut

has identify_members_by => (
   is => 'rw',
   isa => 'IdentifyMembersByType',
   lazy => 1,
   default => 'id',
   init_arg => '-identify_members_by',



( run in 0.667 second using v1.01-cache-2.11-cpan-39bf76dae61 )