View on
Florent Angly > Bio-Community-0.001000 > Bio::Community::IO::FormatGuesser



Annotate this POD


View/Report Bugs
Source   Latest Release: Bio-Community-0.001008


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:

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


Florent Angly

This module was inspired and based on the Bio::IO::GuessSeqFormat module written by Andreas Kähäri <> 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,, 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:


Copyright 2011,2012,2013 by the BioPerl Team

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)
syntax highlighting: