Bio::DB::SwissProt: move to its own distribution
[bioperl-live.git] / t / AlignIO / fasta.t
blob0b649d0fb9acd71712cfa33f380e9f280512f808
1 # -*-Perl-*- Test Harness script for Bioperl
3 use strict;
5 BEGIN {
6     use Bio::Root::Test;
7     
8     test_begin(-tests => 12);
9         
10         use_ok('Bio::AlignIO::fasta');
13 my $DEBUG = test_debug();
15 my ($str,$aln,$strout,$status);
17 # FASTA
18 $str = Bio::AlignIO->new(
19                  -file => test_input_file("testaln.fasta"), 
20                  -format => 'fasta');
21 $aln = $str->next_aln();
22 isa_ok($aln,'Bio::Align::AlignI');
23 is $aln->get_seq_by_pos(1)->display_id, 'AK1H_ECOLI/114-431', 
24   "fasta input test ";
25 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431/1-318', 
26   "fasta input test ";
27 is ($aln->get_seq_by_pos(1)->description, 'DESCRIPTION HERE', 
28     "fasta input test for description");
29 is ($aln->get_seq_by_pos(11)->display_id, 'AK_YEAST/134-472',
30     "fasta input test for id");
31 is $aln->get_seq_by_pos(11)->get_nse, 'AK_YEAST/134-472/134-472', 
32   "fasta input test, captures formatted start/end";
34 is ($aln->get_seq_by_pos(2)->end, 318,
35     "fasta input test for end");
37 is ($aln->get_seq_by_pos(11)->description, 'A COMMENT FOR YEAST', 
38     "fasta input test for description");
40 $strout = Bio::AlignIO->new(
41    '-file' => ">".test_output_file(), 
42                               '-format' => 'fasta');
43 $status = $strout->write_aln($aln);
44 is $status, 1,"fasta output test";
46 my $in = Bio::AlignIO->newFh(
47    '-file'  => test_input_file("testaln.fasta"), 
48                                '-format' => 'fasta');
49 my $out = Bio::AlignIO->newFh(
50    '-file' => ">".test_output_file(), 
51                                 '-format' => 'pfam');
52 while ( $aln = <$in>) {
53     is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431/1-318',
54      "filehandle input test  ";
55     $status = print $out $aln;
56     last;
58 is $status, 1, "filehandle output test";