Bio-Community

 view release on metacpan or  search on metacpan

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

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::IdConverter object
 Usage   : my $converter = Bio::Community::Tool::IdConverter->new(
              -metacommunity => $meta,
              -member_attr   => 'desc',
           );
           # or
           my $converter = Bio::Community::Tool::IdConverter->new(
              -metacommunity => $meta,
              -cluster_file  => '99_otu_map.txt',
           );
           # or
           my $converter = Bio::Community::Tool::IdConverter->new(
              -metacommunity => $meta,
              -blast_file    => 'blast_res.tab',
           );
           # or
           my $converter = Bio::Community::Tool::IdConverter->new(
              -metacommunity  => $meta,
              -taxassign_file => 'rep_set_tax_assignments.txt',
           );
 Args    : -metacommunity  : See metacommunity().
           And ones of:
           -member_attr    : See member_attr().
           -cluster_file   : See cluster_file().
           -blast_file     : See blast_file().
           -taxassign_file : See taxassign_file().
 Returns : a Bio::Community::Tools::IdConverter object

=cut


package Bio::Community::Tools::IdConverter;

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


extends 'Bio::Root::Root';


=head2 metacommunity

 Function: Get/set communities, given as metacommunity, to summarize.
 Usage   : my $meta = $converter->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,
   #lazy => 1,
   #default => undef,
   init_arg => '-metacommunity',
);


=head2 member_attr

 Function: Get / set whether member ID should be converted using the value of
           another attribute, e.g. the member's description. Replacing member ID
           by its description is useful when importing data from formats that do
           not explicitly represent member ID, e.g. from 'generic' to 'qiime'.
 Usage   : $converter->member_attr('id');
 Args    : member attribute, e.g. 'desc' (see C<Bio::Community::Member>)
 Returns : member attribute

=cut

has member_attr => (
   is => 'rw',
   isa => 'Maybe[Str]',
   required => 0,
   #lazy => 1,
   #default => undef,
   init_arg => '-member_attr',
   predicate => '_has_member_attr',
);


=head2 cluster_file

 Function: Get / set the tab-delimited file that defines the OTU clusters. The
           columns are: OTU ID, ID of the representative sequence, IDs of the
           other sequences in the OTU. For example:

               0	367523
               1	187144
               2	544886	544649
               3	310669
               4	355095	310677	347705	563209



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