Bio-Community
view release on metacpan or search on metacpan
lib/Bio/Community/IO/FormatGuesser.pm view on Meta::CPAN
=item *
biom
=back
See the documentation for the corresponding IO drivers to read and write these
formats in the Bio::Community::IO::* namespace.
=head1 AUTHOR
Florent Angly L<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!
=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::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
=cut
package Bio::Community::IO::FormatGuesser;
use Moose;
use MooseX::NonMoose;
use MooseX::StrictConstructor;
use Method::Signatures;
use namespace::autoclean;
extends 'Bio::Root::Root';
my %formats = (
biom => \&_possibly_biom ,
gaas => \&_possibly_gaas ,
unifrac => \&_possibly_unifrac ,
generic => \&_possibly_generic ,
qiime => \&_possibly_qiime ,
);
my $real_re = qr/^(?:(?i)(?:[+-]?)(?:(?=[.]?[0123456789])(?:[0123456789]*)(?:(?:[.])(?:[0123456789]{0,}))?)(?:(?:[E])(?:(?:[+-]?)(?:[0123456789]+))|))$/;
# regular expression to match a real number, taken from Regexp::Common
=head2 file
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)
=cut
has 'file' => (
is => 'rw',
isa => 'Str',
required => 0,
lazy => 1,
default => undef,
init_arg => '-file',
predicate => '_has_file',
);
=head2 fh
Usage : my $fh = $guesser->fh;
Function: Get or set the file handle from which to guess the format.
Args : file handle
Returns : file handle
=cut
has 'fh' => (
is => 'rw',
isa => 'FileHandle',
required => 0,
lazy => 1,
default => undef,
init_arg => '-fh',
predicate => '_has_fh',
);
=head2 text
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
( run in 0.544 second using v1.01-cache-2.11-cpan-39bf76dae61 )