Bio-Community

 view release on metacpan or  search on metacpan

lib/Bio/Community/IO/Driver/qiime.pm  view on Meta::CPAN

  # biome_comparison_2013
  #OTU ID	soil	marine	freshwater	Consensus Lineage
  0	3	11	0	k__Bacteria;p__Cyanobacteria;c__;o__Chroococcales;f__;g__Synechococcus;s__
  1	10	24	0	k__Bacteria;p__TM6;c__;o__;f__;g__;s__
  2	0	230	110	k__Bacteria;p__Cyanobacteria;c__;o__Oscillatoriales;f__;g__Trichodesmium;s__Trichodesmium erythraeum
  3	0	30	80	k__Bacteria;p__Acidobacteria;c__Solibacteres;o__Solibacterales;f__Solibacteraceae;g__Candidatus Solibacter;s__

To be recognized, the last column must match the pattern *lineage* or *taxon*.

For each Bio::Community::Member $member generated from a QIIME file, $member->id()
contains the OTU ID, while $member->desc() holds the content of the consensus
lineage field.

B<Note>: QIIME also provides OTU tables summarized at the different taxonomic levels,
with relative abundance instead of counts:

  Taxon	soil	marine	freshwater
  k__Bacteria;p__Acidobacteria	0.0	0.1016949153	0.4210526316
  k__Bacteria;p__Cyanobacteria	0.2307692308	0.8169491525	0.5789473684
  k__Bacteria;p__TM6	0.7692307692	0.0813559322	0.0

These tables have to be read and written using the Bio::Community::IO::Driver::generic
module, B<not> with Bio::Community::IO::Driver::qiime.

=head1 CONSTRUCTOR

See L<Bio::Community::IO>.

=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.

=cut


package Bio::Community::IO::Driver::qiime;

use Moose;
use Method::Signatures;
use namespace::autoclean;
use Bio::Community::Member;

extends 'Bio::Community::IO';
with 'Bio::Community::Role::IO',
     'Bio::Community::Role::Table';


our $multiple_communities   =  1;      # format supports several communities per file
our $explicit_ids           =  1;      # IDs are explicitly recorded
#### sorting only effective for first community???
our $default_sort_members   =  0;      # unsorted
our $default_abundance_type = 'count'; # absolute count (positive integer)
our $default_missing_string =  0;      # empty members get a '0'


around BUILDARGS => func ($orig, $class, %args) {
   $args{-start_line} = 2;
   return $class->$orig(%args);
};


has '_line' => (
   is => 'rw',
   isa => 'PositiveInt',
   required => 0,
   init_arg => undef,
   default => 1,
   lazy => 1,
);


has '_col' => (
   is => 'rw',
   isa => 'PositiveInt',
   required => 0,
   init_arg => undef,
   default => 1,
   lazy => 1,
);


has '_skip_last_col' => (
   is => 'rw',
   isa => 'Bool',
   required => 0,
   init_arg => undef,
   default => 0,
   lazy => 1,
);


has '_members' => (
   is => 'rw',
   isa => 'ArrayRef', # ArrayRef[Bio::Community::Member] but keep it lean
   required => 0,
   init_arg => undef,
   default => sub { [] },
   lazy => 1,
   predicate => '_has_members',
);



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