1# -*-Perl-*- Test Harness script for Bioperl
2# $Id: SearchIO_infernal.t 14672 2008-04-22 21:42:50Z cjfields $
3
4use strict;
5use warnings;
6
7BEGIN {
8    use Bio::Root::Test;
9
10    test_begin(-tests => 496);
11
12    use_ok('Bio::SearchIO');
13}
14
15my ($in, $result, $iter, $hit, $hsp, $algorithm, $meta);
16
17### Infernal v. 1.1 ###
18{
19    # one query vs one database sequence report
20    $in = Bio::SearchIO->new(
21        -format  => 'infernal',
22        -file    => test_input_file('cmsearch_output.txt')
23    );
24    $result = $in->next_result;
25    isa_ok($result, 'Bio::Search::Result::ResultI');
26    is( ref($result), 'Bio::Search::Result::INFERNALResult', 'Check for the correct Result reference type');
27    is( $result->algorithm,         'CMSEARCH',    'Check algorithm' );
28    is( $result->algorithm_version, '1.1.1',       'Check cmsearch algorithm version' );
29    is( $result->cm_name,           'RF00174.cm',  'Check cm_name');
30    is( $result->database_name,     'NC_000913.fna','Check database_name' );
31    is( $result->database_entries,  1,              'Check database_entries' );
32    is( $result->database_letters,  9283304,        'Check database_letters' );
33    is( $result->query_name,        'Cobalamin',    'Check query_name' );
34    is( $result->query_length,      191,            'Check query_length' );
35    is( $result->query_accession,   'RF00174',      'Check query_accession' );
36    is( $result->query_description, '',             'Check query_description' );
37    is( $result->num_hits(),        2,              'Check num_hits' );
38
39    # 1st hit
40
41    $hit = $result->next_hit;
42    is( ref($hit), 'Bio::Search::Hit::ModelHit', 'Check for the correct hit reference type' );
43    is( $hit->algorithm, 'CMSEARCH', "Hit algorithm");
44    is( $hit->name,              'gi|556503834|ref|NC_000913.3|', 'Check hit name' );
45    is( $hit->description,       'Escherichia coli str. K-12 substr. MG1655, complete genome', 'Check hit description' );
46    is( $hit->length,             0,       'Check hit length' );
47    is( $hit->score,              98.2,    'Check hit score' );
48    is( $hit->bits,               98.2,    'Check hit bits' );
49    is( $hit->num_hsps,           1,       'Check number of HSPs' );
50    float_is( $hit->significance, 8.7e-16, 'Check hit significance' );
51    is($hit->rank,                1,       'Check hit rank' );
52
53    $hsp = $hit->next_hsp;
54    is( ref($hsp), 'Bio::Search::HSP::ModelHSP', 'Check for correct hsp reference type' );
55    isa_ok( $hsp, 'Bio::Search::HSP::HSPI' );
56    isa_ok( $hsp->get_aln, 'Bio::Align::AlignI' );
57    isa_ok( $hsp->hit,     'Bio::SeqFeature::Similarity', "Check for hsp hit isa seqfeature similarity" );
58
59    is( $hsp->hit->seq_id(),   'gi|556503834|ref|NC_000913.3|', 'Check for HSP hit seq_id' );
60    is( $hsp->query->seq_id(), 'Cobalamin', 'Check for HSP query seq_id' );
61    is( $hsp->start('query'),     1,       'Check hsp query start' );
62    is( $hsp->end('query'),       191,     'Check hsp query end' );
63    is( $hsp->start('hit'),       4163384, 'Check hsp hit start' );
64    is( $hsp->end('hit'),         4163574, 'Check hsp hit end' );
65    is( $hsp->score,              98.2,    'Check hsp score' );
66    is( $hsp->bits,               98.2,    'Check hsp bits' );
67    float_is( $hsp->significance, 8.7e-16, 'Check hsp evalue' );
68
69    is( $hsp->length('query'), 191, 'Check for hsp query length' );
70    is( $hsp->length('hit'),   191, 'Check for hsp hit length' );
71    is( $hsp->length,          207, 'Check for hsp total length' );
72    is( $hsp->gaps('query'),   16,   'Check for hsp query gaps' );
73    is( $hsp->gaps('hit'),     16,   'Check for hsp hit gaps' );
74    is( $hsp->gaps,            32,   'Check for hsp total gaps' );
75    is( $hsp->strand('hit'),      1,       'Check hsp hit strand' );
76
77    # 2nd hit
78
79    $hit = $result->next_hit;
80    is( $hit->name,              'gi|556503834|ref|NC_000913.3|',                 'Check hit name' );
81    is( $hit->description,       'Escherichia coli str. K-12 substr. MG1655, complete genome','Check hit description' );
82    is( $hit->score,              8.4,  'Check hit score' );
83    is( $hit->raw_score,          8.4, "Check hit raw_score");
84    is( $hit->bits,               8.4,    'Check hit bits' );
85    float_is( $hit->significance, 0.63, 'Check hit significance' );
86    is( $hit->length,             0,  'Check hit length' );
87    is($hit->rank, 2, "Hit rank");
88
89    $hsp = $hit->next_hsp;
90    is( $hsp->hit->seq_id(),   'gi|556503834|ref|NC_000913.3|', 'Check for hit seq_id' );
91    is( $hsp->query->seq_id(), 'Cobalamin', 'Check for query seq_id' );
92    is( $hsp->start('query'),     1,       'Check hsp query start' );
93    is( $hsp->end('query'),       191,     'Check hsp query end' );
94    is( $hsp->start('hit'),       4593356, 'Check hsp hit start' );
95    is( $hsp->end('hit'),         4593565, 'Check hsp hit end' );
96    is( $hsp->score,              8.4,     'Check hsp score' );
97    is( $hsp->bits,               8.4,     'Check hsp bits' );
98    float_is( $hsp->significance, 0.63,    'Check hsp evalue' );
99
100    is( $hsp->gaps('query'),   67,   'Check for hsp query gaps' );
101    is( $hsp->gaps('hit'),     48,   'Check for hsp hit gaps' );
102    is( $hsp->gaps,            115,   'Check for hsp total gaps' );
103    is( $hsp->strand('hit'),      1,       'Check hsp hit strand' );
104
105    is( $hsp->noncanonical_string,
106        '               v                                    v             v   v        v       v  v       vvvvvv     vvv    vvv                                   vvv      vvvvvvvvv                                              v  v                    v               ',
107        'Check for NC string');
108    is( $hsp->meta,
109        ':::::::::::::::[[[[[[,<<<____________>>>,,,,,(((,,,<<<<<_______>>>>>,,<<<____>>>,<<<---<<<<.------<<<<<<-----<<<-<<<<<<_____............................._>>>>>>--->>>>>>>>>----------....................................>>>>----.>>>,,,,)))]]]]]]:::::::::::::::',
110        'Check for CS string');
111    is( $hsp->query_string,
112        'uuaaauugaaacgaugauGGUuccccuuuaaagugaaggguuAAaaGGGAAcccGGUGaaAaUCCgggGCuGcCCCCgCaACuGUAAgcGg.agagcaccccccAauAaGCCACUggcccgcaa.............................gggccGGGAAGGCggggggaaggaaugac....................................cCgcgAGc.CaGGAGACCuGCCaucaguuuuugaaucucc',
113        'Check for query string');
114    is( $hsp->homology_string,
115        '  A AUU+A+++    :UGG  :C +U ++  G     G: +AA : GGAA:  G         C  :+  GCCCCCGC +C GU+A ::     GCA ++ ++ A   GCCA   G+C G                                                                                                  :: +AG+ C GGA AC : CCA:  + + + + AU    ',
116        'Check for homology string');
117    is( $hsp->hit_string,
118        'GGAGAUUAAUCUUUACGUGGG-UCGUUGAUCGG---CUGACGAACCAGGAAGAUGU-------ACGCCAGUGCCCCCGCUGCGGUGACGCAa-CCGCAGAUGAUUAGU-GCCA---GACGG---aaugagugggugguaucaacaauaaaacc-----------------------------aguaaugaucggcgcaaaagaggcgcagaugaagcuGGCAAAGUuCUGGAUACUGCCCACCGACGCAGUCAUGCGA',
119        'Check for hit string');
120    is( $hsp->posterior_string,
121        '*********************.88877554444...5777779*********9996.......7999********************88873.333333333333333.4544...33333...44566655444444444444444444444.............................566666666666666666666666677777777776788899966*******************************',
122        'Check for posterior probability string');
123
124    isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
125    isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
126    ($meta) = $hsp->feature1->get_tag_values('meta');
127    is($meta, ':::::::::::::::[[[[[[,<<<____________>>>,,,,,(((,,,<<<<<_______>>>>>,,<<<____>>>,<<<---<<<<.------<<<<<<-----<<<-<<<<<<_____............................._>>>>>>--->>>>>>>>>----------....................................>>>>----.>>>,,,,)))]]]]]]:::::::::::::::', "Check hsp feature1 get_tag_values");
128    ($meta) = $hsp->feature2->get_tag_values('meta');
129    is($meta, ':::::::::::::::[[[[[[,<<<____________>>>,,,,,(((,,,<<<<<_______>>>>>,,<<<____>>>,<<<---<<<<.------<<<<<<-----<<<-<<<<<<_____............................._>>>>>>--->>>>>>>>>----------....................................>>>>----.>>>,,,,)))]]]]]]:::::::::::::::', "Check hsp feature2 get_tag_values");
130
131    $result = $in->next_result;
132    is( $result, undef, 'Check for undefined result' );
133
134
135    # multi query vs multi sequence database report
136    $in = Bio::SearchIO->new(
137        -format  => 'infernal',
138        -file    => test_input_file('cmsearch.multi.out')
139    );
140      # 1st query
141    $result = $in->next_result;
142    is( $result->num_hits,   12, 'Check result num_hits - multi report');
143    is( $result->query_name, 'tRNA5', 'Check result query_name - multi report');
144    $hit = $result->next_hit;
145    is( $hit->length,        72, 'Check hit length - multi report' );
146
147      # 2nd query
148    $result = $in->next_result;
149    is( $result->num_hits,   1, 'Check result#2 num_hits - multi report');
150    is( $result->query_name, 'Cobalamin', 'Check result#2 query_name - multi report');
151    $hit = $result->next_hit;
152    is( $hit->length,        0, 'Check result#2 hit length - multi report' );
153    $hsp = $hit->next_hsp;
154    is( $hsp->strand('hit'), -1, 'Check result#2 hsp hit strand - multi report');
155
156
157    # report with no hits
158    $in = Bio::SearchIO->new(
159        -format  => 'infernal',
160        -file    => test_input_file('cmsearch.nohit.out')
161    );
162    $result = $in->next_result;
163    is( $result->cm_name, 'Cobalamin.c.cm', 'Check cm_name' );
164    $hit = $result->next_hit;
165    is( $hit, undef, 'Check for undefined hit' );
166
167}
168
169
170### Infernal v. 1.0 ####
171
172my $searchio = Bio::SearchIO->new( -format => 'infernal',
173                                -file   => test_input_file('test2.infernal'),
174                                -model => 'tRNAtest',
175                                -query_acc => 'RF01234',
176                                -query_desc => 'tRNA',
177                               );
178
179$result = $searchio->next_result;
180isa_ok($result, 'Bio::Search::Result::ResultI');
181is($result->algorithm, 'CMSEARCH', "Result");
182is($result->algorithm_reference, undef, "Result reference");
183is($result->algorithm_version, '1.0', "Result version");
184is($result->available_parameters, 0, "Result parameters");
185is($result->available_statistics, 0, "Result statistics");
186is($result->database_entries, '', "Result entries");
187is($result->database_letters, 600000, "Result letters");
188is($result->database_name, 'tosearch.300Kb.db',
189   "Result database_name");
190is($result->num_hits, 1, "Result num_hits");
191is($result->program_reference, undef, "Result program_reference");
192is($result->query_accession, 'RF01234', "Result query_accession");
193is($result->query_description, 'tRNA', "Result query_description");
194is($result->query_length, 72, "Result query_length");
195is($result->query_name, 'trna.5-1', "Result query_name");
196
197$hit = $result->next_hit;
198
199isa_ok($hit, 'Bio::Search::Hit::HitI');
200is($hit->ncbi_gi, '', "Hit GI");
201is($hit->accession, 'example', "Hit accession");
202is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
203is($hit->bits, '78.06', "Hit bits");
204is($hit->description, '', "Hit description"); # no hit descs yet
205is($hit->locus, '', "Hit locus");
206is($hit->n, 3, "Hit n");
207is($hit->name, 'example', "Hit name");
208is($hit->num_hsps, 3, "Hit num_hsps");
209
210# These Bio::Search::Hit::HitI methods are currently unimplemented in
211# Bio::Search::Hit::ModelHit; they may be integrated over time but will require
212# some reconfiguring for Model-based searches
213
214# these need to be replaced by dies_ok() or warnings_like()
215warning_like { $hit->length_aln() }
216    qr'length_aln not implemented for Model-based searches',
217    "Hit length_aln() not implemented";
218warning_like {$hit->num_unaligned_hit}
219    qr'num_unaligned_hit/num_unaligned_sbjct not implemented for Model-based searches',
220    "Hit num_unaligned_hit() not implemented";
221warning_like {$hit->num_unaligned_query}
222    qr'num_unaligned_query not implemented for Model-based searches',
223    "Hit num_unaligned_query() not implemented";
224warning_like {$hit->num_unaligned_sbjct}
225    qr'num_unaligned_hit/num_unaligned_sbjct not implemented for Model-based searches',
226    "Hit num_unaligned_sbjct() not implemented";
227warning_like {$hit->start}
228    qr'start not implemented for Model-based searches',
229    'Hit start not implemented';
230warning_like {$hit->end}
231    qr'end not implemented for Model-based searches',
232    'Hit end not implemented';
233warning_like {$hit->strand}
234    qr'strand not implemented for Model-based searches',
235    'Hit strand not implemented';
236warning_like {$hit->logical_length}
237    qr'logical_length not implemented for Model-based searches',
238    'Hit logical_length not implemented';
239warning_like {$hit->frac_aligned_hit}
240    qr'frac_aligned_hit not implemented for Model-based searches',
241    'Hit frac_aligned_hit not implemented';
242warning_like {$hit->frac_aligned_query}
243    qr'frac_aligned_query not implemented for Model-based searches',
244    'Hit frac_aligned_query not implemented';
245warning_like {$hit->frac_conserved}
246    qr'frac_conserved not implemented for Model-based searches',
247    'Hit frac_conserved not implemented';
248warning_like {$hit->frac_identical}
249    qr'frac_identical not implemented for Model-based searches',
250    'Hit frac_identical not implemented';
251warning_like {$hit->matches}
252    qr'matches not implemented for Model-based searches',
253    'Hit matches not implemented';
254warning_like {$hit->gaps}
255    qr'gaps not implemented for Model-based searches',
256    'Hit gaps not implemented';
257warning_like {$hit->frame}
258    qr'frame not implemented for Model-based searches',
259    'Hit frame not implemented';
260warning_like {$hit->range}
261    qr'range not implemented for Model-based searches',
262    'Hit range not implemented';
263warning_like {$hit->seq_inds}
264    qr'seq_inds not implemented for Model-based searches',
265    'Hit seq_inds not implemented';
266
267is($hit->length, 0, "Hit length");
268is($hit->overlap, 0, "Hit overlap");
269is($hit->query_length, 72, "Hit query_length");
270is($hit->rank, 1, "Hit rank");
271is($hit->raw_score, '78.06', "Hit raw_score");
272is($hit->score, '78.06', "Hit score");
273float_is($hit->p, '2.906e-26', "Hit p");
274float_is($hit->significance, '3.133e-21');
275
276$hsp = $hit->next_hsp;
277isa_ok($hsp, 'Bio::Search::HSP::HSPI');
278is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
279float_is($hsp->evalue, '3.133e-21');
280isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
281isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
282($meta) = $hsp->feature1->get_tag_values('meta');
283is($meta, '(((((((,,<<<<___.____>>>>,<<<<<_______>>>>>,,,,,<<<<<_______>>>>>))))))):');
284($meta) = $hsp->feature2->get_tag_values('meta');
285is($meta, '(((((((,,<<<<___.____>>>>,<<<<<_______>>>>>,,,,,<<<<<_______>>>>>))))))):');
286
287is($hsp->frame('query'), 0, "HSP frame");
288is($hsp->gaps, 1, "HSP gaps");
289is($hit->length, 0, "Hit length");
290isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
291isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
292is($hsp->hit_string,
293   'GCGGAUUUAGCUCAGUuGGGAGAGCGCCAGACUGAAGAUCUGGAGGUCCUGUGUUCGAUCCACAGAAUUCGCA',
294   "HSP hit_string");
295is($hsp->homology_string,
296   'GC::A::UAGC:CAGU GG AG:GCGCCAG:CUG+++A:CUGGAGGUCC:G:GUUCGAU C:C:G::U::GCA',
297   "HSP homology_string");
298is($hsp->hsp_group, undef, "HSP hsp_group");
299is($hsp->hsp_length, 73, "HSP hsp_length");
300is($hsp->length, 73, "HSP length");
301is($hsp->links, undef, "HSP links");
302is($hsp->n, 1, "HSP n");
303float_is($hsp->pvalue, 2.906e-26, "HSP pvalue");
304isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
305is($hsp->query_string,
306   'gCcgacAUaGcgcAgU.GGuAgcgCgccagccUgucAagcuggAGgUCCgggGUUCGAUuCcccGUgucgGca',
307   "HSP query_string");
308is($hsp->range, 72, "HSP range");
309is($hsp->rank, 1, "HSP rank");
310float_is($hsp->significance, 3.133e-21);
311is($hsp->end, 72, "HSP end");
312float_is($hsp->expect, '3.133e-21', "HSP expect");
313
314# These Bio::Search::HSP::HSPI methods are currently unimplemented in
315# Bio::Search::HSP::ModelHSP; they may be integrated over time but will require
316# some reconfiguring for Model-based searches
317
318warning_like {$hsp->seq_inds}
319    qr'seq_inds not implemented for Model-based searches',
320    'HSP seq_inds not implemented';
321warning_like {$hsp->matches}
322    qr'matches not implemented for Model-based searches',
323    'HSP matches not implemented';
324warning_like {$hsp->frac_conserved}
325    qr'frac_conserved not implemented for Model-based searches',
326    'HSP frac_conserved not implemented';
327warning_like {$hsp->frac_identical}
328    qr'frac_identical not implemented for Model-based searches',
329    'HSP frac_identical not implemented';
330warning_like {$hsp->num_conserved}
331    qr'num_conserved not implemented for Model-based searches',
332    'HSP num_conserved not implemented';
333warning_like {$hsp->num_identical}
334    qr'num_identical not implemented for Model-based searches',
335    'HSP num_identical not implemented';
336warning_like {$hsp->percent_identity}
337    qr'percent_identity not implemented for Model-based searches',
338    'HSP percent_identity not implemented';
339warning_like {$hsp->cigar_string}
340    qr'cigar_string not implemented for Model-based searches',
341    'HSP cigar_string not implemented';
342warning_like {$hsp->generate_cigar_string}
343    qr'generate_cigar_string not implemented for Model-based searches',
344    'HSP cigar_string not implemented';
345
346isa_ok($hsp->seq, 'Bio::LocatableSeq');
347is($hsp->seq_str,
348   'gCcgacAUaGcgcAgU.GGuAgcgCgccagccUgucAagcuggAGgUCCgggGUUCGAUuCcccGUgucgGca',
349   "HSP seq_str");
350is($hsp->start, 1, "HSP start");
351is($hsp->custom_score, undef, "HSP custom_score");
352is($hsp->meta,
353   '(((((((,,<<<<___.____>>>>,<<<<<_______>>>>>,,,,,<<<<<_______>>>>>))))))):',
354   "HSP meta");
355is($hsp->strand('hit'), 1, "HSP strand");
356
357$hsp = $hit->next_hsp;
358isa_ok($hsp, 'Bio::Search::HSP::HSPI');
359is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
360float_is($hsp->evalue, 0.6752);
361isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
362isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
363is($hsp->frame('query'), 0, "HSP frame");
364is($hsp->gaps, 4, "HSP gaps");
365# infernal can return alignment data
366isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
367isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
368is($hsp->hit_string,
369   'UCUGCUAUGGCGUAAUGGCCACGCGC----CCAUCAACAAAGAUAUC*[19]*UAACAGGA',
370   "HSP hit_string");
371is($hsp->homology_string,
372   ' C:G :AU+GCG:A+UGG  :CGCGC    C  UCAA +++GA +UC      U: C:G A',
373   "HSP homology_string");
374is($hsp->hsp_group, undef, "HSP hsp_group");
375is($hsp->hsp_length, 73, "HSP hsp_length");
376is($hsp->length, 73, "HSP length");
377is($hsp->links, undef, "HSP links");
378is($hsp->n, 1, "HSP n");
379float_is($hsp->pvalue, 6.263e-06, "HSP pvalue");
380isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
381is($hsp->query_string,
382   'gCcgacAUaGcgcAgUGGuAgcgCgccagccUgucAagcuggAGgUC*[17]*UgucgGca',
383   "HSP query_string");
384is($hsp->range, 72, "HSP range");
385is($hsp->rank, 2, "HSP rank");
386float_is($hsp->significance, 0.6752);
387is($hsp->end, 72, "HSP end");
388float_is($hsp->expect, 0.6752, "HSP expect");
389isa_ok($hsp->seq, 'Bio::LocatableSeq');
390# this should probably default to the hit string
391is($hsp->seq_str,
392   'gCcgacAUaGcgcAgUGGuAgcgCgccagccUgucAagcuggAGgUC*[17]*UgucgGca',
393   "HSP seq_str");
394is($hsp->start, 1, "HSP start");
395is($hsp->custom_score, undef, "HSP custom_score");
396is($hsp->meta,
397   '(((((((,,<<<<_______>>>>,<<<<<_______>>>>>,,,,,~~~~~~))))))):',
398   "HSP meta");
399is($hsp->strand('hit'), 1, "HSP strand");
400
401### Infernal pre-v. 1.0 ####
402
403$searchio = Bio::SearchIO->new( -format => 'infernal',
404                                -file   => test_input_file('test.infernal'),
405                                # version is reset to the correct one by parser
406                                -version => 0.7,
407                                -model => 'Purine',
408                                -query_acc => 'RF00167',
409                                -query_desc => 'Purine riboswitch',
410                                -database => 'b_sub.fas',
411                                -hsp_minscore => 40,
412                                -convert_meta => 0,
413                               );
414
415$result = $searchio->next_result;
416isa_ok($result, 'Bio::Search::Result::ResultI');
417$algorithm = $result->algorithm;
418is($result->algorithm, 'CMSEARCH', "Result $algorithm");
419is($result->algorithm_reference, undef, "Result $algorithm reference");
420is($result->algorithm_version, 0.7, "Result $algorithm version");
421is($result->available_parameters, 0, "Result parameters");
422is($result->available_statistics, 0, "Result statistics");
423is($result->database_entries, '', "Result entries");
424is($result->database_letters, '', "Result letters");
425is($result->database_name, 'b_sub.fas', "Result database_name");
426is($result->num_hits, 2, "Result num_hits");
427is($result->program_reference, undef, "Result program_reference");
428is($result->query_accession, 'RF00167', "Result query_accession");
429is($result->query_description, 'Purine riboswitch', "Result query_description");
430is($result->query_length, 102, "Result query_length");
431is($result->query_name, 'Purine', "Result query_name");
432
433$hit = $result->next_hit;
434
435isa_ok($hit, 'Bio::Search::Hit::HitI');
436is($hit->ncbi_gi, '2239287', "Hit GI");
437is($hit->accession, 'U51115.1', "Hit accession");
438is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
439is($hit->bits, 81.29, "Hit bits");
440is($hit->description, '', "Hit description"); # no hit descs yet
441is($hit->locus, 'BSU51115', "Hit locus");
442is($hit->n, 2, "Hit n");
443is($hit->name, 'gi|2239287|gb|U51115.1|BSU51115', "Hit name");
444is($hit->num_hsps, 2, "Hit num_hsps");
445
446# p() works but there are no evalues yet for Infernal output, so catch and check...
447warning_like {$hit->p}
448    qr'P-value not defined. Using significance\(\) instead',
449    "No p values";
450
451is($hit->length, 0, "Hit length");
452is($hit->overlap, 0, "Hit overlap");
453is($hit->query_length, 102, "Hit query_length");
454is($hit->rank, 1, "Hit rank");
455is($hit->raw_score, 81.29, "Hit raw_score");
456is($hit->score, 81.29, "Hit score");
457float_is($hit->significance, undef);
458
459$hsp = $hit->next_hsp;
460isa_ok($hsp, 'Bio::Search::HSP::HSPI');
461is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
462float_is($hsp->evalue, undef);
463isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
464isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
465($meta) = $hsp->feature1->get_tag_values('meta');
466is($meta, ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,)))).))))::::::::::::::');
467($meta) = $hsp->feature2->get_tag_values('meta');
468is($meta, ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,)))).))))::::::::::::::');
469
470is($hsp->frame('query'), 0, "HSP frame");
471is($hsp->gaps, 1, "HSP gaps");
472is($hit->length, 0, "Hit length");
473isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
474isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
475is($hsp->hit_string,
476   'CAUGAAAUCAAAACACGACCUCAUAUAAUCUUGGGAAUAUGGCCCAUAAGUUUCUACCCGGCAACCGUAAAUUGCCGGACUAUGcAGGGAAGUGAUCGAUAAA',
477   "HSP hit_string");
478is($hsp->homology_string,
479   ' A+ A+A+ AAAA A   :CUC:UAUAAU: :GGGAAUAUGGCCC: :AGUUUCUACC:GGCAACCGUAAAUUGCC:GACUA:G AG: AA + ++  +++++',
480   "HSP homology_string");
481is($hsp->hsp_group, undef, "HSP hsp_group");
482is($hsp->hsp_length, 103, "HSP hsp_length");
483is($hsp->length, 103, "HSP length");
484is($hsp->links, undef, "HSP links");
485is($hsp->n, 1, "HSP n");
486float_is($hsp->pvalue, undef, "HSP pvalue");
487isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
488is($hsp->query_string,
489   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcG.aGuaAauauuaaauauuu',
490   "HSP query_string");
491is($hsp->range, 102, "HSP range");
492is($hsp->rank, 1, "HSP rank");
493float_is($hsp->significance, undef);
494is($hsp->end, 102, "HSP end");
495float_is($hsp->expect, undef, "HSP expect");
496
497isa_ok($hsp->seq, 'Bio::LocatableSeq');
498is($hsp->seq_str,
499   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcG.aGuaAauauuaaauauuu',
500   "HSP seq_str");
501is($hsp->start, 1, "HSP start");
502is($hsp->custom_score, undef, "HSP custom_score");
503is($hsp->meta,
504   ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,)))).))))::::::::::::::',
505   "HSP meta");
506is($hsp->strand('hit'), 1, "HSP strand");
507
508$hsp = $hit->next_hsp;
509isa_ok($hsp, 'Bio::Search::HSP::HSPI');
510is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
511float_is($hsp->evalue, undef);
512isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
513isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
514is($hsp->frame('query'), 0, "HSP frame");
515is($hsp->gaps, 0, "HSP gaps");
516# infernal can return alignment data
517isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
518isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
519is($hsp->hit_string,
520   'AGAAAUCAAAUAAGAUGAAUUCGUAUAAUCGCGGGAAUAUGGCUCGCAAGUCUCUACCAAGCUACCGUAAAUGGCUUGACUACGUAAACAUUUCUUUCGUUU',
521   "HSP hit_string");
522is($hsp->homology_string,
523   'A AAAU AAA+AA A+   : CGUAUAAU::CG:GAAUAUGGC:CG::AGU UCUACCA:GC ACCGUAAAU GC:UGACUACG :   AU+U +++  UUU',
524   "HSP homology_string");
525is($hsp->hsp_group, undef, "HSP hsp_group");
526is($hsp->hsp_length, 103, "HSP hsp_length");
527is($hsp->length, 103, "HSP length");
528is($hsp->links, undef, "HSP links");
529is($hsp->n, 1, "HSP n");
530float_is($hsp->pvalue, undef, "HSP pvalue");
531isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
532is($hsp->query_string,
533   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
534   "HSP query_string");
535is($hsp->range, 102, "HSP range");
536is($hsp->rank, 2, "HSP rank");
537float_is($hsp->significance, undef);
538is($hsp->end, 102, "HSP end");
539float_is($hsp->expect, undef, "HSP expect");
540#is($hsp->matches, 2, "HSP matches");
541isa_ok($hsp->seq, 'Bio::LocatableSeq');
542# this should probably default to the hit string
543is($hsp->seq_str,
544   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
545   "HSP seq_str");
546is($hsp->start, 1, "HSP start");
547is($hsp->custom_score, undef, "HSP custom_score");
548is($hsp->meta,
549   ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
550   "HSP meta");
551is($hsp->strand('hit'), 1, "HSP strand");
552
553# one more hit...
554
555$hit = $result->next_hit;
556isa_ok($hit, 'Bio::Search::Hit::HitI');
557is($hit->accession, 'X83878.1', "Hit accession");
558is($hit->ncbi_gi, '633168', "Hit GI");
559is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
560is($hit->bits, 79.36, "Hit bits");
561is($hit->description, '', "Hit description"); # no hit descs yet
562is($hit->length, 0, "Hit length");
563is($hit->locus, '', "Hit locus");
564is($hit->n, 1, "Hit n");
565is($hit->name, 'gi|633168|emb|X83878.1|', "Hit name");
566is($hit->num_hsps, 1, "Hit num_hsps");
567is($hit->overlap, 0, "Hit overlap");
568is($hit->query_length, 102, "Hit query_length");
569is($hit->rank, 2, "Hit rank");
570is($hit->raw_score, 79.36, "Hit raw_score");
571is($hit->score, 79.36, "Hit score");
572float_is($hit->significance, undef);
573
574# one more HSP...
575
576$hsp = $hit->next_hsp;
577isa_ok($hsp, 'Bio::Search::HSP::HSPI');
578is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
579float_is($hsp->evalue, undef);
580isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
581isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
582is($hsp->frame('query'), 0, "HSP frame");
583is($hsp->gaps, 2, "HSP gaps");
584isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
585isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
586is($hsp->hit_string,
587   'UUACAAUAUAAUAGGAACACUCAUAUAAUCGCGUGGAUAUGGCACGCAAGUUUCUACCGGGCA-CCGUAAA-UGUCCGACUAUGGGUGAGCAAUGGAACCGC',
588   "HSP hit_string");
589is($hsp->homology_string,
590   '+ 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+    ',
591   "HSP homology_string");
592is($hsp->hsp_group, undef, "HSP hsp_group");
593is($hsp->hsp_length, 103, "HSP hsp_length");
594is($hsp->length, 103, "HSP length");
595is($hsp->links, undef, "HSP links");
596is($hsp->n, 1, "HSP n");
597isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
598is($hsp->query_string,
599   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
600   "HSP query_string");
601is($hsp->range, 102, "HSP range");
602is($hsp->rank, 1, "HSP rank");
603float_is($hsp->significance, undef);
604is($hsp->end, 102, "HSP end");
605float_is($hsp->expect, undef, "HSP expect");
606isa_ok($hsp->seq, 'Bio::LocatableSeq');
607is($hsp->seq_str,
608   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
609   "HSP seq_str");
610is($hsp->start, 1, "HSP start");
611is($hsp->custom_score, undef, "HSP custom_score");
612is($hsp->meta,
613   ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
614   "HSP meta");
615is($hsp->strand('hit'), 1, "HSP strand");
616
617my $symbols = {
618            '5-prime'        => '(',
619            '3-prime'        => ')',
620            'single-strand'  => ':',
621            'unknown'        => '?',
622            'gap'            => '-'
623             # may add more for quartets, triplets
624              };
625
626$searchio = Bio::SearchIO->new( -format => 'infernal',
627                                -file   => test_input_file('test.infernal'),
628                                # version is reset to the correct one by parser
629                                -version => 0.7,
630                                -model => 'Purine',
631                                -query_acc => 'RF00167',
632                                -query_desc => 'Purine riboswitch',
633                                -database => 'b_sub.fas',
634                                -hsp_minscore => 40,
635                                -convert_meta => 1,
636                                -symbols => $symbols,
637                               );
638
639$result = $searchio->next_result;
640$hit = $result->next_hit;
641$hsp = $hit->next_hsp;
642is($hsp->meta,
643   ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))-))))::::::::::::::',
644   "HSP meta gap bug");
645$hsp = $hit->next_hsp;
646is($hsp->meta,
647   ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))))))::::::::::::::',
648   "HSP meta");
649$hit = $result->next_hit;
650$hsp = $hit->next_hsp;
651is($hsp->meta,
652   ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))))))::::::::::::::',
653   "HSP meta");
654($meta) = $hsp->feature1->get_tag_values('meta');
655is($meta, ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))))))::::::::::::::');
656($meta) = $hsp->feature2->get_tag_values('meta');
657is($meta, ':::::::::::::::::((((((((:::(((((((:::::::)))))))::::::::(((((((:::::::)))))))::))))))))::::::::::::::');
658
659## Infernal 0.81 parsing ##
660
661$searchio = Bio::SearchIO->new( -format => 'infernal',
662                                -file   => test_input_file('purine_v081.infernal'),
663                                # version is reset to the correct one by parser
664                                -query_acc => 'RF00167',
665                                -query_desc => 'Purine riboswitch',
666                                -database => 'b_sub.fas',
667                                -convert_meta => 0,
668                               );
669
670$result = $searchio->next_result;
671
672isa_ok($result, 'Bio::Search::Result::ResultI');
673$algorithm = $result->algorithm;
674is($result->algorithm, 'CMSEARCH', "Result $algorithm");
675is($result->algorithm_reference, undef, "Result $algorithm reference");
676is($result->algorithm_version, 0.81, "Result $algorithm version");
677is($result->available_parameters, 0, "Result parameters");
678is($result->available_statistics, 0, "Result statistics");
679is($result->database_entries, '', "Result entries");
680is($result->database_letters, '', "Result letters");
681is($result->database_name, 'b_sub.fas', "Result database_name");
682is($result->num_hits, 3, "Result num_hits");
683is($result->program_reference, undef, "Result program_reference");
684is($result->query_accession, 'RF00167', "Result query_accession");
685is($result->query_description, 'Purine riboswitch', "Result query_description");
686is($result->query_length, 102, "Result query_length");
687is($result->query_name, 'Purine', "Result query_name");
688
689$hit = $result->next_hit;
690isa_ok($hit, 'Bio::Search::Hit::HitI');
691is($hit->ncbi_gi, '633168', "Hit GI");
692is($hit->accession, 'X83878.1', "Hit accession");
693is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
694is($hit->bits, 79.36, "Hit bits");
695is($hit->description, '', "Hit description"); # no hit descs yet
696is($hit->locus, '', "Hit locus");
697is($hit->n, 2, "Hit n");
698is($hit->name, 'gi|633168|emb|X83878.1|', "Hit name");
699is($hit->num_hsps, 2, "Hit num_hsps");
700
701# p() works but there are no evalues yet for Infernal output, so catch and check...
702warnings_like {$hit->p} qr'P-value not defined. Using significance\(\) instead',
703     "No p values";
704
705is($hit->length, 0, "Hit length");
706is($hit->overlap, 0, "Hit overlap");
707is($hit->query_length, 102, "Hit query_length");
708is($hit->rank, 1, "Hit rank");
709is($hit->raw_score, 79.36, "Hit raw_score");
710is($hit->score, 79.36, "Hit score");
711float_is($hit->significance, 1.945e-07);
712
713$hsp = $hit->next_hsp;
714isa_ok($hsp, 'Bio::Search::HSP::HSPI');
715is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
716float_is($hsp->evalue, 1.945e-07);
717isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
718isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
719($meta) = $hsp->feature1->get_tag_values('meta');
720is($meta, ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::');
721($meta) = $hsp->feature2->get_tag_values('meta');
722is($meta, ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::');
723
724is($hsp->frame('query'), 0, "HSP frame");
725is($hsp->gaps, 2, "HSP gaps");
726is($hit->length, 0, "Hit length");
727isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
728isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
729is($hsp->hit_string,
730   'UUACAAUAUAAUAGGAACACUCAUAUAAUCGCGUGGAUAUGGCACGCAAGUUUCUACCGGGCA-CCGUAAA-UGUCCGACUAUGGGUGAGCAAUGGAACCGC',
731   "HSP hit_string");
732is($hsp->homology_string,
733   '+ 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+    ',
734   "HSP homology_string");
735is($hsp->hsp_group, undef, "HSP hsp_group");
736is($hsp->hsp_length,102, "HSP hsp_length");
737is($hsp->length, 102, "HSP length");
738is($hsp->links, undef, "HSP links");
739is($hsp->n, 1, "HSP n");
740float_is($hsp->pvalue, 1.945e-07, "HSP pvalue");
741isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
742is($hsp->query_string,
743   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
744   "HSP query_string");
745is($hsp->range, 102, "HSP range");
746is($hsp->rank, 1, "HSP rank");
747float_is($hsp->significance, 1.945e-07);
748is($hsp->end, 102, "HSP end");
749float_is($hsp->expect, 1.945e-07, "HSP expect");
750
751isa_ok($hsp->seq, 'Bio::LocatableSeq');
752is($hsp->seq_str,
753   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
754   "HSP seq_str");
755is($hsp->start, 1, "HSP start");
756is($hsp->custom_score, undef, "HSP custom_score");
757is($hsp->meta,
758   ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
759   "HSP meta");
760is($hsp->strand('hit'), 1, "HSP strand");
761
762$hsp = $hit->next_hsp;
763isa_ok($hsp, 'Bio::Search::HSP::HSPI');
764is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
765float_is($hsp->evalue, 6.802);
766isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
767isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
768is($hsp->frame('query'), 0, "HSP frame");
769is($hsp->gaps, 4, "HSP gaps");
770# infernal can return alignment data
771isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
772isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
773is($hsp->hit_string,
774   'CGUGCGGUUCCAUUGCUCACCCAUA-GUCGGACAU-UUACGG-UGCCCGGUAGAAACUUGCGUGCCAUAUCCACGCGAUUaUAUGAGUGUUCCUAUUAUAUUG',
775   "HSP hit_string");
776is($hsp->homology_string,
777   '  +    +   A    +:AC C:UA  +::: ::   UA GG :: :::GU    AC: G::::CC UA  ::::C :   UA:G GU: +  U+++AUAUU ',
778   "HSP homology_string");
779is($hsp->hsp_group, undef, "HSP hsp_group");
780is($hsp->hsp_length, 102, "HSP hsp_length");
781is($hsp->length, 102, "HSP length");
782is($hsp->links, undef, "HSP links");
783is($hsp->n, 1, "HSP n");
784float_is($hsp->pvalue, 0.9989, "HSP pvalue");
785isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
786is($hsp->query_string,
787   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGAC.UAcGaGuaAauauuaaauauuu',
788   "HSP query_string");
789is($hsp->range, 102, "HSP range");
790is($hsp->rank, 2, "HSP rank");
791float_is($hsp->significance, 6.802);
792is($hsp->end, 102, "HSP end");
793float_is($hsp->expect, 6.802, "HSP expect");
794#is($hsp->matches, 2, "HSP matches");
795isa_ok($hsp->seq, 'Bio::LocatableSeq');
796# this should probably default to the hit string
797is($hsp->seq_str,
798   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGAC.UAcGaGuaAauauuaaauauuu',
799   "HSP seq_str");
800is($hsp->start, 1, "HSP start");
801is($hsp->custom_score, undef, "HSP custom_score");
802is($hsp->meta,
803   ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,.))))))))::::::::::::::',
804   "HSP meta");
805is($hsp->strand('hit'), -1, "HSP strand");
806
807# one more hit...
808
809$hit = $result->next_hit;
810isa_ok($hit, 'Bio::Search::Hit::HitI');
811is($hit->accession, 'U51115.1', "Hit accession");
812is($hit->ncbi_gi, '2239287', "Hit GI");
813is($hit->algorithm, 'CMSEARCH', "Hit algorithm");
814is($hit->bits, 81.29, "Hit bits");
815is($hit->description, '', "Hit description"); # no hit descs yet
816is($hit->length, 0, "Hit length");
817is($hit->locus, 'BSU51115', "Hit locus");
818is($hit->n, 11, "Hit n");
819is($hit->name, 'gi|2239287|gb|U51115.1|BSU51115', "Hit name");
820is($hit->num_hsps, 11, "Hit num_hsps");
821is($hit->overlap, 0, "Hit overlap");
822is($hit->query_length, 102, "Hit query_length");
823is($hit->rank, 2, "Hit rank");
824is($hit->raw_score, 81.29, "Hit raw_score");
825is($hit->score, 81.29, "Hit score");
826float_is($hit->significance, 1.259e-07);
827
828# one more HSP...
829
830$hsp = $hit->next_hsp;
831isa_ok($hsp, 'Bio::Search::HSP::HSPI');
832is($hsp->algorithm, 'CMSEARCH', "HSP algorithm");
833float_is($hsp->evalue, 1.259e-07);
834isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
835isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
836is($hsp->frame('query'), 0, "HSP frame");
837is($hsp->gaps, 0, "HSP gaps");
838isa_ok($hsp->get_aln, 'Bio::Align::AlignI');
839isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
840is($hsp->hit_string,
841   'AGAAAUCAAAUAAGAUGAAUUCGUAUAAUCGCGGGAAUAUGGCUCGCAAGUCUCUACCAAGCUACCGUAAAUGGCUUGACUACGUAAACAUUUCUUUCGUUU',
842   "HSP hit_string");
843is($hsp->homology_string,
844   'A AAAU AAA+AA A+   : CGUAUAAU::CG:GAAUAUGGC:CG::AGU UCUACCA:GC ACCGUAAAU GC:UGACUACG :   AU+U +++  UUU',
845   "HSP homology_string");
846is($hsp->hsp_group, undef, "HSP hsp_group");
847is($hsp->hsp_length, 102, "HSP hsp_length");
848is($hsp->length, 102, "HSP length");
849is($hsp->links, undef, "HSP links");
850is($hsp->n, 1, "HSP n");
851isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
852is($hsp->query_string,
853   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
854   "HSP query_string");
855is($hsp->range, 102, "HSP range");
856is($hsp->rank, 1, "HSP rank");
857float_is($hsp->significance, 1.259e-07);
858is($hsp->end, 102, "HSP end");
859float_is($hsp->expect, 1.259e-07, "HSP expect");
860isa_ok($hsp->seq, 'Bio::LocatableSeq');
861is($hsp->seq_str,
862   'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
863   "HSP seq_str");
864is($hsp->start, 1, "HSP start");
865is($hsp->custom_score, undef, "HSP custom_score");
866is($hsp->meta,
867   ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
868   "HSP meta");
869is($hsp->strand('hit'), 1, "HSP strand");
870