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