1 # -*-Perl-*- Test Harness script for Bioperl
8 test_begin(-tests => 12);
10 use_ok('Bio::AlignIO::fasta');
13 my $DEBUG = test_debug();
15 my ($str,$aln,$strout,$status);
18 $str = Bio::AlignIO->new(
19 -file => test_input_file("testaln.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',
25 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431/1-318',
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(),
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;
58 is $status, 1, "filehandle output test";