Florent Angly
and 1 contributors


Bio::Community::IO::FormatGuesser - Determine the format used by a community file


  use Bio::Community::IO::FormatGuesser;

  my $guesser = Bio::Community::IO::FormatGuesser->new(
     -file => 'file.txt',
  my $format = $guesser->guess;


Given a file containing one or several communities, try to guess the file format used by examining the file content (not by looking at the file name).

The guess() method will examine the data, line by line, until it finds a line that is specific to a format. If no conclusive guess can be made, undef is returned.

If the Bio::Community::IO::FormatGuesser object is given a filehandle which is seekable, it will be restored to its original position on return from the guess() method.


The following formats are currently supported:

  • generic (tab-delimited matrix, site-by-species table, QIIME summarized OTU tables, ...)

  • gaas

  • qiime

  • unifrac

  • biom

See the documentation for the corresponding IO drivers to read and write these formats in the Bio::Community::IO::* namespace.


Florent Angly florent.angly@gmail.com

This module was inspired and based on the Bio::IO::GuessSeqFormat module written by Andreas Kähäri <andreas.kahari@ebi.ac.uk> and contributors. Thanks to them!


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


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.


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


 Function: Create a new Bio::Community::IO::FormatGuesser object
 Usage   : my $guesser = Bio::Community::IO::FormatGuesser->new( );
 Args    : -text, -file or -fh. If more than one of these arguments was
           provided, only one is used: -text has precendence over -file, which
           has precedence over -fh.
 Returns : a new Bio::Community::IO::FormatGuesser object


 Usage   : my $file = $guesser->file;
 Function: Get or set the file from which to guess the format
 Args    : file path (string)
 Returns : file path (string)


 Usage   : my $fh = $guesser->fh;
 Function: Get or set the file handle from which to guess the format. 
 Args    : file handle
 Returns : file handle


 Usage   : my $text = $guesser->text;
 Function: Get or set the text from which to guess the format. In most, if not
           all cases, the first few lines of a text string should be enough to
           determine the format.
 Args    : text string
 Returns : text string


 Function: Guess the file format
 Usage   : my $format = $guesser->guess;
 Args    : format string (e.g. generic, qiime, etc)
 Returns : format string (e.g. generic, qiime, etc)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 71:

Non-ASCII character seen before =encoding in 'Kähäri'. Assuming UTF-8