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