1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: xmfa.t 14971 2008-10-28 16:08:52Z cjfields $
9 test_begin(-tests => 30);
11 use_ok('Bio::AlignIO::xmfa');
14 my $DEBUG = test_debug(); # foo
16 my ($str,$aln,$strout,$status);
19 $str = Bio::AlignIO->new(
20 -file => test_input_file("testaln.xmfa"),
22 $aln = $str->next_aln();
23 isa_ok($aln,'Bio::Align::AlignI');
29 [ 'chrY/1-598', 1, 598, 1, 'chrY', undef],
32 [ 'chr17/5534-5000', 5000, 5534, -1, 'chr17', undef],
34 # 3:19000-19537 - chr7
35 [ 'chr7/19537-19000', 19000, 19537, -1, 'chr7', undef],
39 my $seq = $aln->get_seq_by_pos($pos);
40 my @seq_data = @{shift @test_data};
41 is $seq->get_nse, shift @seq_data, "xmfa input test ";
42 is $seq->start, shift @seq_data, "xmfa input test for start";
43 is $seq->end, shift @seq_data, "xmfa input test for end";
44 is $seq->strand, shift @seq_data, "xmfa strand test";
45 is $seq->display_id, shift @seq_data, "xmfa input test for id";
46 is $seq->description, shift @seq_data, "xmfa input test for id";
50 is $aln->score, 111, 'xmfa alignment score';
52 $aln = $str->next_aln();
53 isa_ok($aln,'Bio::Align::AlignI');
54 is $aln->get_seq_by_pos(1)->get_nse, 'chrY/1000-1059',
56 is $aln->get_seq_by_pos(1)->strand, 1,
58 is ($aln->get_seq_by_pos(2)->description, undef,
59 "xmfa input test for description");
60 is ($aln->get_seq_by_pos(3)->display_id, 'chr12',
61 "xmfa input test for id");
62 is ($aln->get_seq_by_pos(2)->start, 6000,
63 "xmfa input test for end");
64 is ($aln->get_seq_by_pos(1)->end, 1059,
65 "xmfa input test for end");
66 is ($aln->score, 11, 'xmfa alignment score');
68 $strout = Bio::AlignIO->new(
69 '-file' => ">".test_output_file(),
71 $status = $strout->write_aln($aln);
72 is $status, 1,"xmfa output test";