1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: fasta.t 14971 2008-10-28 16:08:52Z cjfields $
10 test_begin(-tests => 10);
12 use_ok('Bio::AlignIO::fasta');
15 my $DEBUG = test_debug();
17 my ($str,$aln,$strout,$status);
20 $str = Bio::AlignIO->new(
21 -file => test_input_file("testaln.fasta"),
23 $aln = $str->next_aln();
24 isa_ok($aln,'Bio::Align::AlignI');
25 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431',
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',
30 "fasta input test for id");
32 is ($aln->get_seq_by_pos(2)->end, 318,
33 "fasta input test for end");
35 is ($aln->get_seq_by_pos(11)->description, 'A COMMENT FOR YEAST',
36 "fasta input test for description");
38 $strout = Bio::AlignIO->new(
39 '-file' => ">".test_output_file(),
40 '-format' => 'fasta');
41 $status = $strout->write_aln($aln);
42 is $status, 1,"fasta output test";
44 my $in = Bio::AlignIO->newFh(
45 '-file' => test_input_file("testaln.fasta"),
46 '-format' => 'fasta');
47 my $out = Bio::AlignIO->newFh(
48 '-file' => ">".test_output_file(),
50 while ( $aln = <$in>) {
51 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431',
52 "filehandle input test ";
53 $status = print $out $aln;
56 is $status, 1, "filehandle output test";