Fix bug 253 testing for defined
[bioperl-live.git] / t / SearchIO / megablast.t
blobebd9c7b4bcf16d1a2079a584b1a128838c9adb0c
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: SearchIO_megablast.t 14995 2008-11-16 06:20:00Z cjfields $
4 use strict;
6 BEGIN {
7     use lib '.';
8     use Bio::Root::Test;
9     
10     test_begin(-tests => 31);
11     
12     use_ok('Bio::SearchIO');
15 my ($searchio, $result, $hit, $hsp);
17 # this is megablast output type 0 
18 my $in = Bio::SearchIO->new(-file          => test_input_file('503384.MEGABLAST.0'),
19                         -report_format => 0,
20                         -format        => 'megablast'); 
21 my $r = $in->next_result;
22 my @dcompare = ( 
23               ['Contig634', 7620, 7941, 1, 1, 321, -1],
24               ['Contig1853', 6406, 6620, 1, 1691, 1905, 1],  
25               ['Contig3700', 8723,9434, 1, 4083, 4794, -1],
26               ['Contig3997', 1282, 1704, 1, 1546, 1968,-1 ],
27               );
29 is($r->query_name, '503384');
31 while( my $hit = $r->next_hit ) {
32     my $d = shift @dcompare;
33     is($hit->name, shift @$d);
34     my $hsp = $hit->next_hsp;
35     is($hsp->query->start, shift @$d);
36     is($hsp->query->end, shift @$d);
37     is($hsp->query->strand, shift @$d);
38     is($hsp->hit->start, shift @$d);
39     is($hsp->hit->end, shift @$d);
40     is($hsp->hit->strand, shift @$d);
42 is(@dcompare, 0);