1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: UCSCParsers.t 11525 2007-06-27 10:16:38Z sendu $
9 test_begin(-tests => 53);
11 use_ok('Bio::SearchIO');
14 my $pslparser = Bio::SearchIO->new(-format => 'psl',
15 -file => test_input_file('sbay_c545-yeast.BLASTZ.PSL'));
17 my $result = $pslparser->next_result;
18 is($result->query_name, 'I');
19 is($result->query_length, 230203);
21 my $hit = $result->next_hit;
22 is($hit->name, 'sbay_c545');
23 is($hit->length, 28791);
24 my $hsp = $hit->next_hsp;
25 is($hsp->query->start,139871);
26 is($hsp->query->end,141472);
27 is($hsp->query->length, 1602);
28 is($hsp->query->strand, 1);
29 is($hsp->hit->strand, 1);
30 my $q_gapblocks = $hsp->gap_blocks('query');
31 is(scalar @$q_gapblocks, 24);
32 is($q_gapblocks->[0]->[1],45);
33 is($q_gapblocks->[1]->[1],10);
34 is($q_gapblocks->[1]->[0],139921);
36 $hsp = $hit->next_hsp;
37 $hsp = $hit->next_hsp;
38 is($hsp->hit->start,27302);
39 is($hsp->hit->end,27468);
40 is($hsp->hit->length,167);
41 is($hsp->query->start, 123814);
42 is($hsp->query->end, 123972);
43 is($hsp->query->length, 159);
44 is($hsp->query->strand,-1);
46 $q_gapblocks = $hsp->gap_blocks('query');
47 is(scalar @$q_gapblocks, 4);
48 is($q_gapblocks->[0]->[1],116);
49 is($q_gapblocks->[1]->[1],4);
50 is($q_gapblocks->[1]->[0],123856);
52 #-----------------------------------
54 $pslparser = Bio::SearchIO->new(-format => 'psl',
55 -file => test_input_file('blat.psLayout3'));
57 $result = $pslparser->next_result;
58 is($result->query_name, 'sequence_10');
59 is($result->query_length, 1775);
61 $hit = $result->next_hit;
62 is($hit->name, 'sequence_10');
63 is($hit->length, 1775);
64 $hsp = $hit->next_hsp;
65 is($hsp->query->start,1);
66 is($hsp->query->end,1775);
67 is($hsp->query->length,1775);
68 is($hsp->query->strand,1);
69 is($hsp->hit->strand,1);
70 $q_gapblocks = $hsp->gap_blocks('query');
71 is(scalar @$q_gapblocks, 1);
72 is($q_gapblocks->[0]->[1],1775);
73 is($q_gapblocks->[1]->[1],undef);
74 is($q_gapblocks->[1]->[0],undef);
76 $hsp = $hit->next_hsp;
77 is($hsp->hit->start,841);
78 is($hsp->hit->end,1244);
79 is($hsp->query->start, 841);
80 is($hsp->query->end, 1244);
81 is($hsp->query->length, 404);
82 is($hsp->query->strand,-1);
83 is($hsp->hit->strand,1);
85 $q_gapblocks = $hsp->gap_blocks('query');
86 is(scalar @$q_gapblocks, 4);
87 is($q_gapblocks->[0]->[1],14);
88 is($q_gapblocks->[1]->[1],21);
89 is($q_gapblocks->[1]->[0],1152);
92 is( $hit->next_hsp, undef, 'next_hsp should be undef');
93 is( $result->next_hit, undef, 'next_hit should be undef');
95 local $TODO = "next_result should really return undef, not empty string";
96 is( $pslparser->next_result, undef, 'next_result should be undef');
101 my $searchio = Bio::SearchIO->new(
103 -file => test_input_file('headerless.psl'),
106 lives_ok { my $result = $searchio->next_result };