Bio-Community

 view release on metacpan or  search on metacpan

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

  my $transformer = Bio::Community::Tools::Transformer->new(
     -metacommunity => $meta,
     -type          => 'hellinger',
  );

  my $transformed_meta = $summarizer->get_transformed_meta;

=head1 DESCRIPTION

This module takes a metacommunity and transform the count of the community
members it contains. Several transformation methods are available: identity,
binary, or hellinger.

=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::Tool::Transformer object
 Usage   : my $transformer = Bio::Community::Tool::Transformer->new( );
 Args    : -metacommunity: see metacommunity()
           -type         : see type()
 Returns : a new Bio::Community::Tools::Transformer object

=cut


package Bio::Community::Tools::Transformer;

use Moose;
use MooseX::NonMoose;
use MooseX::StrictConstructor;
use Method::Signatures;
use namespace::autoclean;
use Bio::Community::Meta;
use Scalar::Util;


extends 'Bio::Root::Root';


=head2 metacommunity

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

=cut

has metacommunity => (
   is => 'rw',
   isa => 'Maybe[Bio::Community::Meta]',
   required => 0,
   default => undef,
   lazy => 1,
   init_arg => '-metacommunity',
);


=head2 type

 Function: Get or set the type of transformation that is to be applied to member
           counts (not relative abundance):
            * identity  : Keep the counts as-is
            * binary    : Assign 1 if member is present, 0 if absent
            * relative  : Set count of member equal to its relative abundance (%)
            * chisquare : Chi-square transformation
            * chord     : Chord transformation
            * hellinger : Hellinger transformation
 Usage   : my $type = $transformer->type;
 Args    : identity, binary, relative, chisquare, chord, or hellinger
 Returns : identity, binary, relative, chisquare, chord, or hellinger

=cut

has type => (
   is => 'rw',
   isa => 'TransformationType',
   required => 0,
   default => 'identity',
   lazy => 1,
   init_arg => '-type',
);


=head2 get_transformed_meta

 Function: Calculate and return a transformed metacommunity.
 Usage   : my $meta = $transformer->get_transformed_meta;
 Args    : none
 Returns : a new Bio::Community::Meta object

=cut



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