1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 495);
12 use_ok('Bio::SearchIO');
15 my ($searchio, $result,$iter,$hit,$hsp, $algorithm, $meta);
19 $searchio = Bio::SearchIO->new( -format => 'infernal',
20 -file => test_input_file('test.infernal'),
21 # version is reset to the correct one by parser
24 -query_acc => 'RF00167',
25 -query_desc => 'Purine riboswitch',
26 -database => 'b_sub.fas',
32 $result = $searchio->next_result;
33 isa_ok($result, 'Bio::Search::Result::ResultI');
34 $algorithm = $result->algorithm;
35 is($result->algorithm, 'CMSEARCH', "Result $algorithm");
36 is($result->algorithm_reference, undef, "Result $algorithm reference");
37 is($result->algorithm_version, 0.7, "Result $algorithm version");
38 is($result->available_parameters, 0, "Result parameters");
39 is($result->available_statistics, 0, "Result statistics");
40 is($result->database_entries, '', "Result entries");
41 is($result->database_letters, '', "Result letters");
42 is($result->database_name, 'b_sub.fas', "Result database_name");
43 is($result->num_hits, 2, "Result num_hits");
44 is($result->program_reference, undef, "Result program_reference");
45 is($result->query_accession, 'RF00167', "Result query_accession");
46 is($result->query_description, 'Purine riboswitch', "Result query_description");
47 is($result->query_length, 102, "Result query_length");
48 is($result->query_name, 'Purine', "Result query_name");
50 $hit = $result->next_hit;
51 isa_ok($hit, 'Bio::Search::Hit::HitI');
52 is($hit->ncbi_gi, '2239287', "Hit GI");
53 is($hit->accession, 'U51115.1', "Hit accession");
54 is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
55 is($hit->bits, 81.29, "Hit bits");
56 is($hit->description, '', "Hit description"); # no hit descs yet
57 is($hit->locus, 'BSU51115', "Hit locus");
58 is($hit->n, 2, "Hit n");
59 is($hit->name, 'gi|2239287|gb|U51115.1|BSU51115', "Hit name");
60 is($hit->num_hsps, 2, "Hit num_hsps");
62 # These Bio::Search::Hit::HitI methods are currently unimplemented in
63 # Bio::Search::Hit::ModelHit; they may be integrated over time but will require
64 # some reconfiguring for Model-based searches
66 eval { $hit->length_aln() };
67 like($@, qr'length_aln not implemented for Model-based searches',
68 "Hit length_aln() not implemented");
69 eval {$hit->num_unaligned_hit};
70 like($@, qr'num_unaligned_hit/num_unaligned_sbjct not implemented for Model-based searches',
71 "Hit num_unaligned_hit() not implemented");
72 eval {$hit->num_unaligned_query};
73 like($@, qr'num_unaligned_query not implemented for Model-based searches',
74 "Hit num_unaligned_query() not implemented");
75 eval {$hit->num_unaligned_sbjct};
76 like($@, qr'num_unaligned_hit/num_unaligned_sbjct not implemented for Model-based searches',
77 "Hit num_unaligned_sbjct() not implemented");
79 like($@, qr'start not implemented for Model-based searches','Hit start not implemented');
81 like($@, qr'end not implemented for Model-based searches','Hit end not implemented');
83 like($@, qr'strand not implemented for Model-based searches','Hit strand not implemented');
84 eval {$hit->logical_length};
85 like($@, qr'logical_length not implemented for Model-based searches','Hit logical_length not implemented');
86 eval {$hit->frac_aligned_hit};
87 like($@, qr'frac_aligned_hit not implemented for Model-based searches','Hit frac_aligned_hit not implemented');
88 eval{$hit->frac_aligned_query};
89 like($@, qr'frac_aligned_query not implemented for Model-based searches','Hit frac_aligned_query not implemented');
90 eval {$hit->frac_conserved};
91 like($@, qr'frac_conserved not implemented for Model-based searches','Hit frac_conserved not implemented');
92 eval{$hit->frac_identical};
93 like($@, qr'frac_identical not implemented for Model-based searches','Hit frac_identical not implemented');
95 like($@, qr'matches not implemented for Model-based searches','Hit matches not implemented');
97 like($@, qr'gaps not implemented for Model-based searches','Hit gaps not implemented');
99 like($@, qr'frame not implemented for Model-based searches','Hit frame not implemented');
101 like($@, qr'range not implemented for Model-based searches','Hit range not implemented');
102 eval {$hit->seq_inds};
103 like($@, qr'seq_inds not implemented for Model-based searches','Hit seq_inds not implemented');
105 # p() works but there are no evalues yet for Infernal output, so catch and check...
107 like($@, qr'P-value not defined. Using expect\(\) instead',
110 is($hit->length, 0, "Hit length");
111 is($hit->overlap, 0, "Hit overlap");
112 is($hit->query_length, 102, "Hit query_length");
113 is($hit->rank, 1, "Hit rank");
114 is($hit->raw_score, 81.29, "Hit raw_score");
115 is($hit->score, 81.29, "Hit score");
116 is($hit->significance, undef, "Hit significance");
118 $hsp = $hit->next_hsp;
119 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
120 is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
121 is($hsp->evalue, undef, "HSP evalue");
122 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
123 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
124 ($meta) = $hsp->feature1->get_tag_values('meta');
125 is($meta, ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,)))).))))::::::::::::::');
126 ($meta) = $hsp->feature2->get_tag_values('meta');
127 is($meta, ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,)))).))))::::::::::::::');
129 is($hsp->frame('query'), 0, "HSP frame");
130 is($hsp->gaps, 0, "HSP gaps");
131 is($hit->length, 0, "Hit length");
132 isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
133 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
135 'CAUGAAAUCAAAACACGACCUCAUAUAAUCUUGGGAAUAUGGCCCAUAAGUUUCUACCCGGCAACCGUAAAUUGCCGGACUAUGcAGGGAAGUGAUCGAUAAA',
137 is($hsp->homology_string,
138 ' A+ A+A+ AAAA A :CUC:UAUAAU: :GGGAAUAUGGCCC: :AGUUUCUACC:GGCAACCGUAAAUUGCC:GACUA:G AG: AA + ++ +++++',
139 "HSP homology_string");
140 is($hsp->hsp_group, undef, "HSP hsp_group");
141 is($hsp->hsp_length, 103, "HSP hsp_length");
142 is($hsp->length, 103, "HSP length");
143 is($hsp->links, undef, "HSP links");
144 is($hsp->n, '', "HSP n");
145 is($hsp->pvalue, undef, "HSP pvalue");
146 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
147 is($hsp->query_string,
148 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcG.aGuaAauauuaaauauuu',
150 is($hsp->range, 102, "HSP range");
151 is($hsp->rank, 1, "HSP rank");
152 is($hsp->seq_inds, 67, "HSP seq_inds");
153 is($hsp->significance, undef, "HSP significance");
154 is($hsp->end, 102, "HSP end");
155 is($hsp->expect, undef, "HSP expect");
157 # These Bio::Search::HSP::HSPI methods are currently unimplemented in
158 # Bio::Search::HSP::ModelHSP; they may be integrated over time but will require
159 # some reconfiguring for Model-based searches
161 eval {$hsp->matches};
162 like($@, qr'matches not implemented for Model-based searches','HSP matches not implemented');
163 eval {$hsp->frac_conserved};
164 like($@, qr'frac_conserved not implemented for Model-based searches','HSP frac_conserved not implemented');
165 eval {$hsp->frac_identical};
166 like($@, qr'frac_identical not implemented for Model-based searches','HSP frac_identical not implemented');
167 eval {$hsp->num_conserved};
168 like($@, qr'num_conserved not implemented for Model-based searches','HSP num_conserved not implemented');
169 eval {$hsp->num_identical};
170 like($@, qr'num_identical not implemented for Model-based searches','HSP num_identical not implemented');
171 eval {$hsp->percent_identity};
172 like($@, qr'percent_identity not implemented for Model-based searches','HSP percent_identity not implemented');
173 eval {$hsp->cigar_string};
174 like($@, qr'cigar_string not implemented for Model-based searches','HSP cigar_string not implemented');
175 eval {$hsp->generate_cigar_string};
176 like($@, qr'generate_cigar_string not implemented for Model-based searches','HSP cigar_string not implemented');
178 isa_ok($hsp->seq, 'Bio::LocatableSeq');
180 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcG.aGuaAauauuaaauauuu',
182 is($hsp->start, 1, "HSP start");
183 is($hsp->custom_score, undef, "HSP custom_score");
185 ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,)))).))))::::::::::::::',
187 is($hsp->strand('hit'), 1, "HSP strand");
189 $hsp = $hit->next_hsp;
190 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
191 is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
192 is($hsp->evalue, undef, "HSP evalue");
193 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
194 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
195 is($hsp->frame('query'), 0, "HSP frame");
196 is($hsp->gaps, 0, "HSP gaps");
197 # infernal can return alignment data
198 isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
199 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
201 'AGAAAUCAAAUAAGAUGAAUUCGUAUAAUCGCGGGAAUAUGGCUCGCAAGUCUCUACCAAGCUACCGUAAAUGGCUUGACUACGUAAACAUUUCUUUCGUUU',
203 is($hsp->homology_string,
204 'A AAAU AAA+AA A+ : CGUAUAAU::CG:GAAUAUGGC:CG::AGU UCUACCA:GC ACCGUAAAU GC:UGACUACG : AU+U +++ UUU',
205 "HSP homology_string");
206 is($hsp->hsp_group, undef, "HSP hsp_group");
207 is($hsp->hsp_length, 103, "HSP hsp_length");
208 is($hsp->length, 103, "HSP length");
209 is($hsp->links, undef, "HSP links");
210 is($hsp->n, '', "HSP n");
211 is($hsp->pvalue, undef, "HSP pvalue");
212 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
213 is($hsp->query_string,
214 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
216 is($hsp->range, 102, "HSP range");
217 is($hsp->rank, 2, "HSP rank");
218 is($hsp->seq_inds, 69, "HSP seq_inds");
219 is($hsp->significance, undef, "HSP significance");
220 is($hsp->end, 102, "HSP end");
221 is($hsp->expect, undef, "HSP expect");
222 #is($hsp->matches, 2, "HSP matches");
223 isa_ok($hsp->seq, 'Bio::LocatableSeq');
224 # this should probably default to the hit string
226 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
228 is($hsp->start, 1, "HSP start");
229 is($hsp->custom_score, undef, "HSP custom_score");
231 ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
233 is($hsp->strand('hit'), 1, "HSP strand");
237 $hit = $result->next_hit;
238 isa_ok($hit, 'Bio::Search::Hit::HitI');
239 is($hit->accession, 'X83878.1', "Hit accession");
240 is($hit->ncbi_gi, '633168', "Hit GI");
241 is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
242 is($hit->bits, 79.36, "Hit bits");
243 is($hit->description, '', "Hit description"); # no hit descs yet
244 is($hit->length, 0, "Hit length");
245 is($hit->locus, '', "Hit locus");
246 is($hit->n, 1, "Hit n");
247 is($hit->name, 'gi|633168|emb|X83878.1|', "Hit name");
248 is($hit->num_hsps, 1, "Hit num_hsps");
249 is($hit->overlap, 0, "Hit overlap");
250 is($hit->query_length, 102, "Hit query_length");
251 is($hit->rank, 2, "Hit rank");
252 is($hit->raw_score, 79.36, "Hit raw_score");
253 is($hit->score, 79.36, "Hit score");
254 is($hit->significance, undef, "Hit significance");
258 $hsp = $hit->next_hsp;
259 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
260 is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
261 is($hsp->evalue, undef, "HSP evalue");
262 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
263 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
264 is($hsp->frame('query'), 0, "HSP frame");
265 is($hsp->gaps, 2, "HSP gaps");
266 isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
267 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
269 'UUACAAUAUAAUAGGAACACUCAUAUAAUCGCGUGGAUAUGGCACGCAAGUUUCUACCGGGCA-CCGUAAA-UGUCCGACUAUGGGUGAGCAAUGGAACCGC',
271 is($hsp->homology_string,
272 '+ A A++A AA A AA:AC+C:UAUAAU::CG:G AUAUGGC:CG::AGUUUCUACC:G CA CCGUAAA UG C:GACUA:G+GU:A A+U A+ ',
273 "HSP homology_string");
274 is($hsp->hsp_group, undef, "HSP hsp_group");
275 is($hsp->hsp_length, 103, "HSP hsp_length");
276 is($hsp->length, 103, "HSP length");
277 is($hsp->links, undef, "HSP links");
278 is($hsp->n, '', "HSP n");
279 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
280 is($hsp->query_string,
281 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
283 is($hsp->range, 102, "HSP range");
284 is($hsp->rank, 1, "HSP rank");
285 is($hsp->seq_inds, 64, "HSP seq_inds");
286 is($hsp->significance, undef, "HSP significance");
287 is($hsp->end, 102, "HSP end");
288 is($hsp->expect, undef, "HSP expect");
289 isa_ok($hsp->seq, 'Bio::LocatableSeq');
291 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
293 is($hsp->start, 1, "HSP start");
294 is($hsp->custom_score, undef, "HSP custom_score");
296 ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
298 is($hsp->strand('hit'), 1, "HSP strand");
303 'single-strand' => ':',
306 # may add more for quartets, triplets
309 $searchio = Bio::SearchIO->new( -format => 'infernal',
310 -file => test_input_file('test.infernal'),
311 # version is reset to the correct one by parser
314 -query_acc => 'RF00167',
315 -query_desc => 'Purine riboswitch',
316 -database => 'b_sub.fas',
322 $result = $searchio->next_result;
323 $hit = $result->next_hit;
324 $hsp = $hit->next_hsp;
326 ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))-))))::::::::::::::',
328 $hsp = $hit->next_hsp;
330 ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))))))::::::::::::::',
332 $hit = $result->next_hit;
333 $hsp = $hit->next_hsp;
335 ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))))))::::::::::::::',
337 ($meta) = $hsp->feature1->get_tag_values('meta');
338 is($meta, ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))))))::::::::::::::');
339 ($meta) = $hsp->feature2->get_tag_values('meta');
340 is($meta, ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))))))::::::::::::::');
342 ## Infernal 0.81 parsing ##
344 $searchio = Bio::SearchIO->new( -format => 'infernal',
345 -file => test_input_file('purine_v081.infernal'),
346 # version is reset to the correct one by parser
347 -query_acc => 'RF00167',
348 -query_desc => 'Purine riboswitch',
349 -database => 'b_sub.fas',
354 $result = $searchio->next_result;
356 isa_ok($result, 'Bio::Search::Result::ResultI');
357 $algorithm = $result->algorithm;
358 is($result->algorithm, 'CMSEARCH', "Result $algorithm");
359 is($result->algorithm_reference, undef, "Result $algorithm reference");
360 is($result->algorithm_version, 0.81, "Result $algorithm version");
361 is($result->available_parameters, 0, "Result parameters");
362 is($result->available_statistics, 0, "Result statistics");
363 is($result->database_entries, '', "Result entries");
364 is($result->database_letters, '', "Result letters");
365 is($result->database_name, 'b_sub.fas', "Result database_name");
366 is($result->num_hits, 3, "Result num_hits");
367 is($result->program_reference, undef, "Result program_reference");
368 is($result->query_accession, 'RF00167', "Result query_accession");
369 is($result->query_description, 'Purine riboswitch', "Result query_description");
370 is($result->query_length, 102, "Result query_length");
371 is($result->query_name, 'Purine', "Result query_name");
373 $hit = $result->next_hit;
374 isa_ok($hit, 'Bio::Search::Hit::HitI');
375 is($hit->ncbi_gi, '633168', "Hit GI");
376 is($hit->accession, 'X83878.1', "Hit accession");
377 is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
378 is($hit->bits, 79.36, "Hit bits");
379 is($hit->description, '', "Hit description"); # no hit descs yet
380 is($hit->locus, '', "Hit locus");
381 is($hit->n, 2, "Hit n");
382 is($hit->name, 'gi|633168|emb|X83878.1|', "Hit name");
383 is($hit->num_hsps, 2, "Hit num_hsps");
385 # These Bio::Search::Hit::HitI methods are currently unimplemented in
386 # Bio::Search::Hit::ModelHit; they may be integrated over time but will require
387 # some reconfiguring for Model-based searches
389 eval { $hit->length_aln() };
390 like($@, qr'length_aln not implemented for Model-based searches',
391 "Hit length_aln() not implemented");
392 eval {$hit->num_unaligned_hit};
393 like($@, qr'num_unaligned_hit/num_unaligned_sbjct not implemented for Model-based searches',
394 "Hit num_unaligned_hit() not implemented");
395 eval {$hit->num_unaligned_query};
396 like($@, qr'num_unaligned_query not implemented for Model-based searches',
397 "Hit num_unaligned_query() not implemented");
398 eval {$hit->num_unaligned_sbjct};
399 like($@, qr'num_unaligned_hit/num_unaligned_sbjct not implemented for Model-based searches',
400 "Hit num_unaligned_sbjct() not implemented");
402 like($@, qr'start not implemented for Model-based searches','Hit start not implemented');
404 like($@, qr'end not implemented for Model-based searches','Hit end not implemented');
406 like($@, qr'strand not implemented for Model-based searches','Hit strand not implemented');
407 eval {$hit->logical_length};
408 like($@, qr'logical_length not implemented for Model-based searches','Hit logical_length not implemented');
409 eval {$hit->frac_aligned_hit};
410 like($@, qr'frac_aligned_hit not implemented for Model-based searches','Hit frac_aligned_hit not implemented');
411 eval{$hit->frac_aligned_query};
412 like($@, qr'frac_aligned_query not implemented for Model-based searches','Hit frac_aligned_query not implemented');
413 eval {$hit->frac_conserved};
414 like($@, qr'frac_conserved not implemented for Model-based searches','Hit frac_conserved not implemented');
415 eval{$hit->frac_identical};
416 like($@, qr'frac_identical not implemented for Model-based searches','Hit frac_identical not implemented');
418 like($@, qr'matches not implemented for Model-based searches','Hit matches not implemented');
420 like($@, qr'gaps not implemented for Model-based searches','Hit gaps not implemented');
422 like($@, qr'frame not implemented for Model-based searches','Hit frame not implemented');
424 like($@, qr'range not implemented for Model-based searches','Hit range not implemented');
425 eval {$hit->seq_inds};
426 like($@, qr'seq_inds not implemented for Model-based searches','Hit seq_inds not implemented');
428 # p() works but there are no evalues yet for Infernal output, so catch and check...
430 like($@, qr'P-value not defined. Using expect\(\) instead',
433 is($hit->length, 0, "Hit length");
434 is($hit->overlap, 0, "Hit overlap");
435 is($hit->query_length, 102, "Hit query_length");
436 is($hit->rank, 1, "Hit rank");
437 is($hit->raw_score, 79.36, "Hit raw_score");
438 is($hit->score, 79.36, "Hit score");
439 is($hit->significance, 1.945e-07, "Hit significance");
441 $hsp = $hit->next_hsp;
442 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
443 is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
444 is($hsp->evalue, 1.945e-07, "HSP evalue");
445 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
446 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
447 ($meta) = $hsp->feature1->get_tag_values('meta');
448 is($meta, ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::');
449 ($meta) = $hsp->feature2->get_tag_values('meta');
450 is($meta, ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::');
452 is($hsp->frame('query'), 0, "HSP frame");
453 is($hsp->gaps, 2, "HSP gaps");
454 is($hit->length, 0, "Hit length");
455 isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
456 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
458 'UUACAAUAUAAUAGGAACACUCAUAUAAUCGCGUGGAUAUGGCACGCAAGUUUCUACCGGGCA-CCGUAAA-UGUCCGACUAUGGGUGAGCAAUGGAACCGC',
460 is($hsp->homology_string,
461 '+ A A++A AA A AA:AC+C:UAUAAU::CG:G AUAUGGC:CG::AGUUUCUACC:G CA CCGUAAA UG C:GACUA:G+GU:A A+U A+ ',
462 "HSP homology_string");
463 is($hsp->hsp_group, undef, "HSP hsp_group");
464 is($hsp->hsp_length,102, "HSP hsp_length");
465 is($hsp->length, 102, "HSP length");
466 is($hsp->links, undef, "HSP links");
467 is($hsp->n, '', "HSP n");
468 is($hsp->pvalue, 1.945e-07, "HSP pvalue");
469 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
470 is($hsp->query_string,
471 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
473 is($hsp->range, 102, "HSP range");
474 is($hsp->rank, 1, "HSP rank");
475 is($hsp->seq_inds, 64, "HSP seq_inds");
476 is($hsp->significance, 1.945e-07, "HSP significance");
477 is($hsp->end, 102, "HSP end");
478 is($hsp->expect, 1.945e-07, "HSP expect");
480 # These Bio::Search::HSP::HSPI methods are currently unimplemented in
481 # Bio::Search::HSP::ModelHSP; they may be integrated over time but will require
482 # some reconfiguring for Model-based searches
484 eval {$hsp->matches};
485 like($@, qr'matches not implemented for Model-based searches','HSP matches not implemented');
486 eval {$hsp->frac_conserved};
487 like($@, qr'frac_conserved not implemented for Model-based searches','HSP frac_conserved not implemented');
488 eval {$hsp->frac_identical};
489 like($@, qr'frac_identical not implemented for Model-based searches','HSP frac_identical not implemented');
490 eval {$hsp->num_conserved};
491 like($@, qr'num_conserved not implemented for Model-based searches','HSP num_conserved not implemented');
492 eval {$hsp->num_identical};
493 like($@, qr'num_identical not implemented for Model-based searches','HSP num_identical not implemented');
494 eval {$hsp->percent_identity};
495 like($@, qr'percent_identity not implemented for Model-based searches','HSP percent_identity not implemented');
496 eval {$hsp->cigar_string};
497 like($@, qr'cigar_string not implemented for Model-based searches','HSP cigar_string not implemented');
498 eval {$hsp->generate_cigar_string};
499 like($@, qr'generate_cigar_string not implemented for Model-based searches','HSP cigar_string not implemented');
501 isa_ok($hsp->seq, 'Bio::LocatableSeq');
503 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
505 is($hsp->start, 1, "HSP start");
506 is($hsp->custom_score, undef, "HSP custom_score");
508 ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
510 is($hsp->strand('hit'), 1, "HSP strand");
512 $hsp = $hit->next_hsp;
513 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
514 is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
515 is($hsp->evalue, 6.802, "HSP evalue");
516 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
517 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
518 is($hsp->frame('query'), 0, "HSP frame");
519 is($hsp->gaps, 3, "HSP gaps");
520 # infernal can return alignment data
521 isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
522 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
524 'CGUGCGGUUCCAUUGCUCACCCAUA-GUCGGACAU-UUACGG-UGCCCGGUAGAAACUUGCGUGCCAUAUCCACGCGAUUaUAUGAGUGUUCCUAUUAUAUUG',
526 is($hsp->homology_string,
527 ' + + A +:AC C:UA +::: :: UA GG :: :::GU AC: G::::CC UA ::::C : UA:G GU: + U+++AUAUU ',
528 "HSP homology_string");
529 is($hsp->hsp_group, undef, "HSP hsp_group");
530 is($hsp->hsp_length, 102, "HSP hsp_length");
531 is($hsp->length, 102, "HSP length");
532 is($hsp->links, undef, "HSP links");
533 is($hsp->n, '', "HSP n");
534 is($hsp->pvalue, 0.9989, "HSP pvalue");
535 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
536 is($hsp->query_string,
537 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGAC.UAcGaGuaAauauuaaauauuu',
539 is($hsp->range, 102, "HSP range");
540 is($hsp->rank, 2, "HSP rank");
541 is($hsp->seq_inds, 31, "HSP seq_inds");
542 is($hsp->significance, 6.802, "HSP significance");
543 is($hsp->end, 102, "HSP end");
544 is($hsp->expect, 6.802, "HSP expect");
545 #is($hsp->matches, 2, "HSP matches");
546 isa_ok($hsp->seq, 'Bio::LocatableSeq');
547 # this should probably default to the hit string
549 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGAC.UAcGaGuaAauauuaaauauuu',
551 is($hsp->start, 1, "HSP start");
552 is($hsp->custom_score, undef, "HSP custom_score");
554 ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,.))))))))::::::::::::::',
556 is($hsp->strand('hit'), -1, "HSP strand");
560 $hit = $result->next_hit;
561 isa_ok($hit, 'Bio::Search::Hit::HitI');
562 is($hit->accession, 'U51115.1', "Hit accession");
563 is($hit->ncbi_gi, '2239287', "Hit GI");
564 is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
565 is($hit->bits, 81.29, "Hit bits");
566 is($hit->description, '', "Hit description"); # no hit descs yet
567 is($hit->length, 0, "Hit length");
568 is($hit->locus, 'BSU51115', "Hit locus");
569 is($hit->n, 11, "Hit n");
570 is($hit->name, 'gi|2239287|gb|U51115.1|BSU51115', "Hit name");
571 is($hit->num_hsps, 11, "Hit num_hsps");
572 is($hit->overlap, 0, "Hit overlap");
573 is($hit->query_length, 102, "Hit query_length");
574 is($hit->rank, 2, "Hit rank");
575 is($hit->raw_score, 81.29, "Hit raw_score");
576 is($hit->score, 81.29, "Hit score");
577 is($hit->significance, 1.259e-07, "Hit significance");
581 $hsp = $hit->next_hsp;
582 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
583 is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
584 is($hsp->evalue, 1.259e-07, "HSP evalue");
585 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
586 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
587 is($hsp->frame('query'), 0, "HSP frame");
588 is($hsp->gaps, 0, "HSP gaps");
589 isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
590 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
592 'AGAAAUCAAAUAAGAUGAAUUCGUAUAAUCGCGGGAAUAUGGCUCGCAAGUCUCUACCAAGCUACCGUAAAUGGCUUGACUACGUAAACAUUUCUUUCGUUU',
594 is($hsp->homology_string,
595 'A AAAU AAA+AA A+ : CGUAUAAU::CG:GAAUAUGGC:CG::AGU UCUACCA:GC ACCGUAAAU GC:UGACUACG : AU+U +++ UUU',
596 "HSP homology_string");
597 is($hsp->hsp_group, undef, "HSP hsp_group");
598 is($hsp->hsp_length, 102, "HSP hsp_length");
599 is($hsp->length, 102, "HSP length");
600 is($hsp->links, undef, "HSP links");
601 is($hsp->n, '', "HSP n");
602 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
603 is($hsp->query_string,
604 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
606 is($hsp->range, 102, "HSP range");
607 is($hsp->rank, 1, "HSP rank");
608 is($hsp->seq_inds, 69, "HSP seq_inds");
609 is($hsp->significance, 1.259e-07, "HSP significance");
610 is($hsp->end, 102, "HSP end");
611 is($hsp->expect, 1.259e-07, "HSP expect");
612 isa_ok($hsp->seq, 'Bio::LocatableSeq');
614 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
616 is($hsp->start, 1, "HSP start");
617 is($hsp->custom_score, undef, "HSP custom_score");
619 ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
621 is($hsp->strand('hit'), 1, "HSP strand");
627 $searchio = Bio::SearchIO->new( -format => 'rnamotif',
628 -file => test_input_file('trna.strict.rnamotif'),
629 -model => 'trna.descr',
630 -query_acc => 'test',
631 -database => 'gbrna.fas',
635 $result = $searchio->next_result;
636 isa_ok($result, 'Bio::Search::Result::ResultI');
637 $algorithm = $result->algorithm;
638 is($result->algorithm, 'RNAMOTIF', "Result $algorithm");
639 is($result->algorithm_reference, undef, "Result $algorithm reference");
640 is($result->algorithm_version, '3.0.3', "Result $algorithm version");
641 is($result->database_entries, '', "Result entries");
642 is($result->database_letters, '', "Result letters");
643 is($result->database_name, 'gbrna.fas', "Result database_name");
644 is($result->num_hits, 28, "Result num_hits");
645 is($result->program_reference, undef, "Result program_reference");
646 is($result->query_accession, 'test', "Result query_accession");
647 is($result->query_description, 'h5 ss h5 ss h3 ss h5 ss h3 ss h5 ss h3 h3 ss', "Result query_description");
648 is($result->query_length, 0, "Result query_length");
649 is($result->query_name, 'trna.strict.descr', "Result query_name");
651 $hit = $result->next_hit;
652 isa_ok($hit, 'Bio::Search::Hit::HitI');
653 is($hit->accession, 'M10671', "Hit accession");
654 is($hit->ncbi_gi, '173683', "Hit GI");
655 is($hit->algorithm, 'RNAMOTIF', "Hit algorithm");
656 is($hit->description, 'Avian oncornavirus Trp-tRNA',
657 "Hit description"); # no hit descs yet
658 is($hit->length, 0, "Hit length");
659 is($hit->locus, 'ACSTRW', "Hit locus");
660 is($hit->n, 8, "Hit n");
661 is($hit->name, 'gi|173683|gb|M10671|ACSTRW', "Hit name");
662 is($hit->num_hsps, 8, "Hit num_hsps");
663 is($hit->overlap, 0, "Hit overlap");
664 is($hit->rank, 1, "Hit rank");
665 is($hit->raw_score, 0, "Hit raw_score");
666 is($hit->score, 0, "Hit score");
667 is($hit->significance, undef, "Hit significance");
669 $hsp = $hit->next_hsp;
670 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
671 is($hsp->algorithm, 'RNAMOTIF', "HSP algorithm");
672 is($hsp->evalue, undef, "HSP evalue");
673 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
674 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
675 is($hsp->frame('query'), 0, "HSP frame");
676 is($hsp->gaps, 0, "HSP gaps");
678 # RNAMotif cannot build alignments
680 like($@, qr'Missing query string, can\'t build alignment','RNAMotif get_aln warning');
681 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
683 'gacctcgtggcgcaacggtagcgcgtctgactccagatcagaaggctgcgtgttcgaatcacgtcggggtcacca',
685 is($hsp->homology_string,
687 "HSP homology_string");
688 is($hsp->hsp_group, undef, "HSP hsp_group");
689 is($hsp->hsp_length, 75, "HSP hsp_length");
690 is($hsp->length, 75, "HSP length");
691 is($hsp->links, undef, "HSP links");
692 is($hsp->n, '',"HSP n");
693 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
694 is($hsp->query_string,
697 is($hsp->range, 75, "HSP range");
698 is($hsp->rank, 1, "HSP rank");
699 is($hsp->significance, undef, "HSP significance");
700 is($hsp->end, 75, "HSP end");
701 is($hsp->expect, undef, "HSP expect");
702 isa_ok($hsp->seq, 'Bio::LocatableSeq');
706 is($hsp->start, 1, "HSP start");
707 is($hsp->custom_score, undef, "HSP custom_score");
709 '<<<<<<<..<<<.........>>>.<<<<<.......>>>>>.......<<<<.......>>>>>>>>>>>....',
711 is($hsp->strand('hit'), 1, "HSP strand");
712 ($meta) = $hsp->feature1->get_tag_values('meta');
713 is($meta, '<<<<<<<..<<<.........>>>.<<<<<.......>>>>>.......<<<<.......>>>>>>>>>>>....');
714 ($meta) = $hsp->feature2->get_tag_values('meta');
715 is($meta, '<<<<<<<..<<<.........>>>.<<<<<.......>>>>>.......<<<<.......>>>>>>>>>>>....');
719 $searchio = Bio::SearchIO->new( -format => 'erpin',
720 -file => test_input_file('testfile.erpin'),
721 -model => 'stem-loop',
722 -query_acc => 'test',
726 $result = $searchio->next_result;
727 isa_ok($result, 'Bio::Search::Result::ResultI');
728 $algorithm = $result->algorithm;
729 is($result->algorithm, 'ERPIN', "Result $algorithm");
730 is($result->algorithm_reference, undef, "Result $algorithm reference");
731 is($result->algorithm_version, 5.5, "Result $algorithm version");
732 is($result->available_parameters, 2, "Result parameters");
733 is($result->available_statistics, 1, "Result statistics");
734 is($result->database_entries, '', "Result entries");
735 is($result->database_letters, '', "Result letters");
736 is($result->database_name, 'AE016879.fna', "Result database_name");
737 is($result->num_hits, 1, "Result num_hits");
738 is($result->program_reference, undef, "Result program_reference");
739 is($result->query_accession, 'test', "Result query_accession");
740 is($result->query_description, '40 sequences of length 43', "Result query_description");
741 is($result->query_name, '/home/Administrator/pyrR.epn', "Result query_name");
743 $hit = $result->next_hit;
744 isa_ok($hit, 'Bio::Search::Hit::HitI');
745 is($hit->accession, 'AE016879.1', "Hit accession");
746 is($hit->ncbi_gi, '30260185', "Hit GI");
747 is($hit->algorithm, 'ERPIN', "Hit algorithm");
748 is($hit->bits, 31.64, "Hit bits");
749 is($hit->description, 'Bacillus anthracis str. Ames, complete genome',
750 "Hit description"); # no hit descs yet
751 is($hit->length, 0, "Hit length");
752 is($hit->locus, '', "Hit locus");
753 is($hit->n, 4, "Hit n");
754 is($hit->name, 'gi|30260185|gb|AE016879.1|', "Hit name");
755 is($hit->num_hsps, 4, "Hit num_hsps");
756 is($hit->overlap, 0, "Hit overlap");
757 is($hit->query_length, undef, "Hit query_length");
758 is($hit->rank, 1, "Hit rank");
759 is($hit->raw_score, 31.64, "Hit raw_score");
760 is($hit->score, 31.64, "Hit score");
761 is($hit->significance, '4.44e-06', "Hit significance");
763 $hsp = $hit->next_hsp;
764 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
765 is($hsp->algorithm, 'ERPIN', "HSP algorithm");
766 is($hsp->evalue, '1.68e-05', "HSP evalue");
767 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
768 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
769 is($hsp->frame('query'), 0, "HSP frame");
770 is($hsp->gaps, 2, "HSP gaps");
771 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
773 'CTTT.aacc--.CAACC.CCGTGA.GGTTG.a.GAAG',
775 is($hsp->homology_string,
777 "HSP homology_string");
778 is($hsp->hsp_group, undef, "HSP hsp_group");
779 is($hsp->hsp_length, 37, "HSP hsp_length");
780 is($hsp->length, 37, "HSP length");
781 is($hsp->links, undef, "HSP links");
782 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
783 is($hsp->query_string,
786 is($hsp->range, 37, "HSP range");
787 is($hsp->rank, 1, "HSP rank");
788 is($hsp->significance, '1.68e-05', "HSP significance");
789 is($hsp->expect, '1.68e-05', "HSP expect");
790 isa_ok($hsp->seq, 'Bio::LocatableSeq');
794 is($hsp->start, 1, "HSP start");
795 is($hsp->custom_score, undef, "HSP custom_score");
796 is($hsp->meta, undef, "HSP meta");
797 is($hsp->meta, undef);
798 is($hsp->meta, undef);
799 is($hsp->strand('hit'), 1, "HSP strand");
800 is($hsp->meta, undef);
801 is($hsp->meta, undef);
803 # ERPIN lacks sequence for query, will spit back a warning..
805 like($@, qr'Missing query string, can\'t build alignment','ERPIN get_aln warning');
807 $hsp = $hit->next_hsp;
808 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
809 is($hsp->algorithm, 'ERPIN', "HSP algorithm");
810 is($hsp->evalue, '5.61e-05', "HSP evalue");
811 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
812 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
813 is($hsp->frame('query'), 0, "HSP frame");
814 is($hsp->gaps, 1, "HSP gaps");
815 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
817 'CTTT.taatt-.CAGTC.CTGTGA.GACCG.g.AAAG',
819 is($hsp->homology_string,
821 "HSP homology_string");
822 is($hsp->query_string,
825 is($hsp->hsp_group, undef, "HSP hsp_group");
826 is($hsp->hsp_length, 37, "HSP hsp_length");
827 is($hsp->length, 37, "HSP length");
828 is($hsp->links, undef, "HSP links");
829 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity');
830 is($hsp->range, 37, "HSP range");
831 is($hsp->rank, 2, "HSP rank");
832 is($hsp->significance, '5.61e-05', "HSP significance");
833 is($hsp->end, 37, "HSP end");
834 is($hsp->expect, '5.61e-05', "HSP expect");
835 isa_ok($hsp->seq, 'Bio::LocatableSeq');
836 is($hsp->seq_str, '', "HSP seq_str");
837 is($hsp->start, 1, "HSP start");
838 is($hsp->custom_score, undef, "HSP custom_score");
839 is($hsp->meta, undef);
840 is($hsp->meta, undef);
841 is($hsp->strand('hit'), -1, "HSP strand");