1 # -*-Perl-*- Test Harness script for Bioperl
9 test_begin(-tests => 12);
11 use_ok('Bio::AlignIO::fasta');
14 my $DEBUG = test_debug();
16 my ($str,$aln,$strout,$status);
19 $str = Bio::AlignIO->new(
20 -file => test_input_file("testaln.fasta"),
22 $aln = $str->next_aln();
23 isa_ok($aln,'Bio::Align::AlignI');
24 is $aln->get_seq_by_pos(1)->display_id, 'AK1H_ECOLI/114-431',
26 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431/1-318',
28 is ($aln->get_seq_by_pos(1)->description, 'DESCRIPTION HERE',
29 "fasta input test for description");
30 is ($aln->get_seq_by_pos(11)->display_id, 'AK_YEAST/134-472',
31 "fasta input test for id");
32 is $aln->get_seq_by_pos(11)->get_nse, 'AK_YEAST/134-472/134-472',
33 "fasta input test, captures formatted start/end";
35 is ($aln->get_seq_by_pos(2)->end, 318,
36 "fasta input test for end");
38 is ($aln->get_seq_by_pos(11)->description, 'A COMMENT FOR YEAST',
39 "fasta input test for description");
41 $strout = Bio::AlignIO->new(
42 '-file' => ">".test_output_file(),
43 '-format' => 'fasta');
44 $status = $strout->write_aln($aln);
45 is $status, 1,"fasta output test";
47 my $in = Bio::AlignIO->newFh(
48 '-file' => test_input_file("testaln.fasta"),
49 '-format' => 'fasta');
50 my $out = Bio::AlignIO->newFh(
51 '-file' => ">".test_output_file(),
53 while ( $aln = <$in>) {
54 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431/1-318',
55 "filehandle input test ";
56 $status = print $out $aln;
59 is $status, 1, "filehandle output test";