Allow falling back to any strigified Bio::AnnotationI for 'gene_name'
[bioperl-live.git] / t / SeqIO / tinyseq.t
blob1eb55f151d29c881dd534f38509171b958d1bfda
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7     use lib '.';
8     use Bio::Root::Test;
9     
10     test_begin(-tests => 16,
11                            -requires_modules => [qw(XML::Parser::PerlSAX XML::Writer)]);
12         
13         use_ok('Bio::SeqIO::tinyseq');
16 my $file = test_input_file('test.tseq');
17 my $outfile = test_output_file();
19 my $instream = Bio::SeqIO->new( -file           => $file,
20                                 -format         => 'tinyseq' );
22 my $outstream = Bio::SeqIO->new( -file          => ">$outfile",
23                                  -format        => 'tinyseq' );
25 my $seq = $instream->next_seq;
26 ok(defined $seq);
27 ok(defined $seq->seq);
28 is($seq->length, 5830);
29 is($seq->accession_number,'NM_002253');
30 ok($seq->species);
31 is($seq->species->binomial, 'Homo sapiens');
32 is($seq->species->ncbi_taxid, 9606);   
33 $outstream->write_seq($seq);
34 undef $outstream;
36 ok(-s $outfile);
38 my $reread = Bio::SeqIO->new( -file             => $outfile,
39                               -format           => 'tinyseq' );
41 my $seq2 = $reread->next_seq;
43 ok($seq2);
44 ok($seq2->seq);
45 is($seq2->length, 5830);
46 is($seq2->accession_number, 'NM_002253');
47 ok($seq2->species);
48 is($seq2->species->binomial, 'Homo sapiens');
49 is($seq2->species->ncbi_taxid, 9606);