1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: Sim4.t 11525 2007-06-27 10:16:38Z sendu $
9 test_begin(-tests => 102);
11 use_ok('Bio::SearchIO');
14 # parse align format 0
15 my $parser = Bio::SearchIO->new(-format => 'sim4',
16 -file => test_input_file('crypto.sim4-0')
18 my $r = $parser->next_result;
19 is ($r->query_name, 'cn416');
20 is ($r->query_length, 630);
22 my $hit = $r->next_hit;
23 is ($hit->name, 'Contig147');
24 is ($hit->description, 'Contig147.fa');
25 is ($hit->length, 1086);
27 my $hsp = $hit->next_hsp;
28 is ($hsp->query->start, 36);
29 is ($hsp->query->end, 132);
30 is ($hsp->query->strand, 1);
31 is ($hsp->hit->start, 191);
32 is ($hsp->hit->end, 286);
33 is ($hsp->hit->strand, 1);
35 $hsp = $hit->next_hsp;
36 is ($hsp->query->start, 133);
37 is ($hsp->query->end, 191);
38 is ($hsp->query->strand, 1);
39 is ($hsp->hit->start, 343);
40 is ($hsp->hit->end, 401);
41 is ($hsp->hit->strand, 1);
43 # parse align format 3
44 $parser = Bio::SearchIO->new(-format => 'sim4',
45 -file => test_input_file('crypto.sim4-3')
47 $r = $parser->next_result;
48 is ($r->query_name, 'cn416');
49 is ($r->query_length, 630);
51 is ($hit->name, 'Contig147');
52 is ($hit->description, 'Contig147.fa');
53 is ($hit->length, 1086);
55 $hsp = $hit->next_hsp;
56 is ($hsp->query->start, 36);
57 is ($hsp->query->end, 132);
58 is ($hsp->query->strand, 1);
59 is ($hsp->hit->start, 191);
60 is ($hsp->hit->end, 286);
61 is ($hsp->hit->strand, 1);
63 $hsp = $hit->next_hsp;
64 is ($hsp->query->start, 133);
65 is ($hsp->query->end, 191);
66 is ($hsp->query->strand, 1);
67 is ($hsp->hit->start, 343);
68 is ($hsp->hit->end, 401);
69 is ($hsp->hit->strand, 1);
71 # parse align format 4
72 $parser = Bio::SearchIO->new(-format => 'sim4',
73 -file => test_input_file('crypto.sim4-4')
75 $r = $parser->next_result;
76 is ($r->query_name, 'cn416');
77 is ($r->query_length, 630);
80 is ($hit->name, 'Contig147');
81 is ($hit->length, 1086);
83 $hsp = $hit->next_hsp;
84 is ($hsp->query->start, 36);
85 is ($hsp->query->end, 132);
86 is ($hsp->query->strand, 1);
87 is ($hsp->hit->start, 191);
88 is ($hsp->hit->end, 286);
89 is ($hsp->hit->strand, 1);
91 $hsp = $hit->next_hsp;
92 is ($hsp->query->start, 133);
93 is ($hsp->query->end, 191);
94 is ($hsp->query->strand, 1);
95 is ($hsp->hit->start, 343);
96 is ($hsp->hit->end, 401);
97 is ($hsp->hit->strand, 1);
100 # do the other sim4 files
101 $parser = Bio::SearchIO->new(-format => 'sim4',
102 -file => test_input_file('sim4.rev')
104 $r = $parser->next_result;
105 is ($r->query_name, '/nfs/disk21/birney/prog/wise2/example/human.rev');
106 is ($r->query_length, 5368);
108 is ($hit->name, 'HSHNCPA1');
109 is ($hit->description, 'temp.cdna');
110 is ($hit->length, 1198);
112 $hsp = $hit->next_hsp;
113 is ($hsp->query->start, 486);
114 is ($hsp->query->end, 503);
115 is ($hsp->query->strand, 1);
116 is ($hsp->hit->start, 10);
117 is ($hsp->hit->end, 27);
118 is ($hsp->hit->strand, -1);
120 $hsp = $hit->next_hsp;
121 is ($hsp->query->start, 1048);
122 is ($hsp->query->end, 1117);
123 is ($hsp->query->strand, 1);
124 is ($hsp->hit->start, 194);
125 is ($hsp->hit->end, 265);
126 is ($hsp->hit->strand, -1);
128 # do the other sim4 files fwd
129 $parser = Bio::SearchIO->new(-format => 'sim4',
130 -file => test_input_file('sim4.for.for')
132 $r = $parser->next_result;
133 is ($r->query_name, 'human.genomic');
134 is ($r->query_length, 5368);
136 is ($hit->name, 'hs_est');
137 is ($hit->description, 'est.for');
138 is ($hit->length, 479);
140 $hsp = $hit->next_hsp;
141 is ($hsp->query->start, 695);
142 is ($hsp->query->end, 813);
143 is ($hsp->query->strand, 1);
144 is ($hsp->hit->start, 1);
145 is ($hsp->hit->end, 119);
146 is ($hsp->hit->strand, 1);
148 $hsp = $hit->next_hsp;
149 is ($hsp->query->start, 1377);
150 is ($hsp->query->end, 1500);
151 is ($hsp->query->strand, 1);
152 is ($hsp->hit->start, 120);
153 is ($hsp->hit->end, 243);
154 is ($hsp->hit->strand, 1);
156 # do the other sim4 files fwd rev
157 $parser = Bio::SearchIO->new(-format => 'sim4',
158 -file => test_input_file('sim4.for.rev')
160 $r = $parser->next_result;
161 is ($r->query_name, 'human.genomic');
162 is ($r->query_length, 5368);
164 is ($hit->name, 'REVCOMP');
165 is ($hit->description, 'hn_est.rev');
166 is ($hit->length, 479);
168 $hsp = $hit->next_hsp;
169 is ($hsp->query->start, 695);
170 is ($hsp->query->end, 813);
171 is ($hsp->query->strand, 1);
172 is ($hsp->hit->start, 1);
173 is ($hsp->hit->end, 119);
174 is ($hsp->hit->strand, -1);
176 $hsp = $hit->next_hsp;
177 is ($hsp->query->start, 1377);
178 is ($hsp->query->end, 1500);
179 is ($hsp->query->strand, 1);
180 is ($hsp->hit->start, 120);
181 is ($hsp->hit->end, 243);
182 is ($hsp->hit->strand, -1);