1 # -*-Perl-*- Test Harness script for Bioperl
11 test_begin(-tests => 49);
14 use_ok('Bio::AlignIO');
15 use_ok('Bio::Tools::GuessSeqFormat');
18 my @seqformats = qw{ ace embl fasta gcg genbank mase
19 pfam pir raw swiss tab game};
22 my $verbose = test_debug();
29 my %no_seqio_module = map {$_=>1} qw {gcgblast gcgfasta mase pfam};
31 my $guessed_format = Bio::Tools::GuessSeqFormat->new
32 (-file => test_input_file('test.waba'))->guess;
33 is $guessed_format, undef ;
38 my $input = Bio::SeqIO->new
39 (-file=>test_input_file('test.waba'));
40 $seq = $input->next_seq();
47 foreach $format (@seqformats) {
49 if ($format eq 'game') {
50 test_skip(-tests => 2, -requires_modules => [qw(XML::Writer XML::Parser::PerlSAX)]);
53 my $guessed_format = Bio::Tools::GuessSeqFormat->new
54 (-file => test_input_file("test.$format"),
58 is $guessed_format, $format, "Guessed:$format";
59 next if $no_seqio_module{$format};
62 my $input = Bio::SeqIO->new
63 (-file=>test_input_file("test.$format"));
64 $seq = $input->next_seq();
67 my $implemented = $format eq 'ace' ? 'Bio::PrimarySeqI' : 'Bio::SeqI';
69 isa_ok $seq, $implemented;
79 @seqformats = qw{ aln:clustalw fasta mase msf nexus pfam phylip
80 prodom stockholm}; # not selex (same as pfam, mainly)
82 my %no_alignio_module = map {$_=>1} qw {};
84 foreach my $ext (@seqformats) {
86 ($ext, $format) = split /:/, $ext;
87 my $guesser = Bio::Tools::GuessSeqFormat->new
88 (-file => test_input_file("testaln.$ext"));
90 ok $guesser->guess(), $format;
92 next if $no_alignio_module{$format};
95 my $input = Bio::AlignIO->new
96 (-file=>test_input_file("testaln.$ext"));
97 $seq = $input->next_aln();
100 isa_ok $seq, 'Bio::Align::AlignI';
109 test_skip(-tests => 3, -requires_modules => [qw(IO::String)]);
111 my $string = ">test1 no comment
112 agtgctagctagctagctagct
117 my $stringfh = new IO::String($string);
119 my $seqio = Bio::SeqIO->new(-fh => $stringfh);
120 while( my $seq = $seqio->next_seq ) {
121 ok $seq->id =~ /test/;
128 ok new Bio::Tools::GuessSeqFormat( -text => $string )->guess, 'fasta';