1
# $Id: GuessSeqFormat.pm,v 1.15.4.1 2006/10/02 23:10:32 sendu Exp $
1
# $Id: GuessSeqFormat.pm 11480 2007-06-14 14:16:21Z sendu $
2
2
#------------------------------------------------------------------
4
4
# BioPerl module Bio::Tools::GuessSeqFormat
19
19
# To guess the format of a flat file, given a filename:
20
my $guesser = new Bio::Tools::GuessSeqFormat( -file => $filename );
20
my $guesser = Bio::Tools::GuessSeqFormat->new( -file => $filename );
21
21
my $format = $guesser->guess;
23
23
# To guess the format from an already open filehandle:
24
my $guesser = new Bio::Tools::GuessSeqFormat( -fh => $filehandle );
24
my $guesser = Bio::Tools::GuessSeqFormat->new( -fh => $filehandle );
25
25
my $format = $guesser->guess;
26
26
# If the filehandle is seekable (STDIN isn't), it will be
27
27
# returned to its original position.
29
29
# To guess the format of one or several lines of text (with
30
30
# embedded newlines):
31
my $guesser = new Bio::Tools::GuessSeqFormat( -text => $linesoftext );
31
my $guesser = Bio::Tools::GuessSeqFormat->new( -text => $linesoftext );
32
32
my $format = $guesser->guess;
34
34
# To create a Bio::Tools::GuessSeqFormat object and set the
35
35
# filename, filehandle, or line to parse afterwards:
36
my $guesser = new Bio::Tools::GuessSeqFormat;
36
my $guesser = Bio::Tools::GuessSeqFormat->new();
37
37
$guesser->file($filename);
38
38
$guesser->fh($filehandle);
39
39
$guesser->text($linesoftext);
41
41
# To guess in one go, given e.g. a filename:
42
my $format = new Bio::Tools::GuessSeqFormat( -file => $filename )->guess;
42
my $format = Bio::Tools::GuessSeqFormat->new( -file => $filename )->guess;
478
478
if ($fmt->{test}($line, $lineno)) {
480
480
$fmt_string = $fmt->{fmt_string};
482
#FIXME#printf STDERR "%s: %s\n", $fmt_string, $line;
483
#FIXME#if $self->verbose > 0;