Used quoted strings in Bio::Species to avoid a 'Invalid [] range in regex' error...
[bioperl-live.git] / t / AlignIO / fasta.t
blob8ad9d452e4e2c50fe5477f5d30336aae47bdaff9
1 # -*-Perl-*- Test Harness script for Bioperl
3 use strict;
5 BEGIN {
6         use lib '.';
7     use Bio::Root::Test;
8     
9     test_begin(-tests => 10);
10         
11         use_ok('Bio::AlignIO::fasta');
14 my $DEBUG = test_debug();
16 my ($str,$aln,$strout,$status);
18 # FASTA
19 $str = Bio::AlignIO->new(
20                  -file => test_input_file("testaln.fasta"), 
21                  -format => 'fasta');
22 $aln = $str->next_aln();
23 isa_ok($aln,'Bio::Align::AlignI');
24 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431/1-318', 
25   "fasta input test ";
26 is ($aln->get_seq_by_pos(1)->description, 'DESCRIPTION HERE', 
27     "fasta input test for description");
28 is ($aln->get_seq_by_pos(11)->display_id, 'AK_YEAST',
29     "fasta input test for id");
31 is ($aln->get_seq_by_pos(2)->end, 318,
32     "fasta input test for end");
34 is ($aln->get_seq_by_pos(11)->description, 'A COMMENT FOR YEAST', 
35     "fasta input test for description");
37 $strout = Bio::AlignIO->new(
38    '-file' => ">".test_output_file(), 
39                               '-format' => 'fasta');
40 $status = $strout->write_aln($aln);
41 is $status, 1,"fasta output test";
43 my $in = Bio::AlignIO->newFh(
44    '-file'  => test_input_file("testaln.fasta"), 
45                                '-format' => 'fasta');
46 my $out = Bio::AlignIO->newFh(
47    '-file' => ">".test_output_file(), 
48                                 '-format' => 'pfam');
49 while ( $aln = <$in>) {
50     is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431/1-318',
51      "filehandle input test  ";
52     $status = print $out $aln;
53     last;
55 is $status, 1, "filehandle output test";