1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: SearchIO_rnamotif.t 14672 2008-04-22 21:42:50Z cjfields $
9 test_begin(-tests => 60);
11 use_ok('Bio::SearchIO');
14 my ($searchio, $result, $iter, $hit, $hsp, $algorithm, $meta);
20 $searchio = Bio::SearchIO->new( -format => 'rnamotif',
21 -file => test_input_file('trna.strict.rnamotif'),
22 -model => 'trna.descr',
24 -database => 'gbrna.fas',
28 $result = $searchio->next_result;
29 isa_ok($result, 'Bio::Search::Result::ResultI');
30 $algorithm = $result->algorithm;
31 is($result->algorithm, 'RNAMOTIF', "Result $algorithm");
32 is($result->algorithm_reference, undef, "Result $algorithm reference");
33 is($result->algorithm_version, '3.0.3', "Result $algorithm version");
34 is($result->database_entries, '', "Result entries");
35 is($result->database_letters, '', "Result letters");
36 is($result->database_name, 'gbrna.fas', "Result database_name");
37 is($result->num_hits, 28, "Result num_hits");
38 is($result->program_reference, undef, "Result program_reference");
39 is($result->query_accession, 'test', "Result query_accession");
40 is($result->query_description, 'h5 ss h5 ss h3 ss h5 ss h3 ss h5 ss h3 h3 ss', "Result query_description");
41 is($result->query_length, 0, "Result query_length");
42 is($result->query_name, 'trna.strict.descr', "Result query_name");
44 $hit = $result->next_hit;
45 isa_ok($hit, 'Bio::Search::Hit::HitI');
46 is($hit->accession, 'M10671', "Hit accession");
47 is($hit->ncbi_gi, '173683', "Hit GI");
48 is($hit->algorithm, 'RNAMOTIF', "Hit algorithm");
49 is($hit->description, 'Avian oncornavirus Trp-tRNA',
50 "Hit description"); # no hit descs yet
51 is($hit->length, 0, "Hit length");
52 is($hit->locus, 'ACSTRW', "Hit locus");
53 is($hit->n, 8, "Hit n");
54 is($hit->name, 'gi|173683|gb|M10671|ACSTRW', "Hit name");
55 is($hit->num_hsps, 8, "Hit num_hsps");
56 is($hit->overlap, 0, "Hit overlap");
57 is($hit->rank, 1, "Hit rank");
58 is($hit->raw_score, 0, "Hit raw_score");
59 is($hit->score, 0, "Hit score");
60 float_is($hit->significance, undef);
62 $hsp = $hit->next_hsp;
63 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
64 is($hsp->algorithm, 'RNAMOTIF', "HSP algorithm");
65 float_is($hsp->evalue, undef);
66 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
67 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
68 is($hsp->frame('query'), 0, "HSP frame");
69 is($hsp->gaps, 0, "HSP gaps");
71 # RNAMotif cannot build alignments
73 like($@, qr'Missing query string, can\'t build alignment','RNAMotif get_aln warning');
74 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
76 'gacctcgtggcgcaacggtagcgcgtctgactccagatcagaaggctgcgtgttcgaatcacgtcggggtcacca',
78 is($hsp->homology_string,
80 "HSP homology_string");
81 is($hsp->hsp_group, undef, "HSP hsp_group");
82 is($hsp->hsp_length, 75, "HSP hsp_length");
83 is($hsp->length, 75, "HSP length");
84 is($hsp->links, undef, "HSP links");
85 is($hsp->n, 1,"HSP n");
86 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
87 is($hsp->query_string,
90 is($hsp->range, 75, "HSP range");
91 is($hsp->rank, 1, "HSP rank");
92 float_is($hsp->significance, undef);
93 is($hsp->end, 75, "HSP end");
94 float_is($hsp->expect, undef, "HSP expect");
95 isa_ok($hsp->seq, 'Bio::LocatableSeq');
99 is($hsp->start, 1, "HSP start");
100 is($hsp->custom_score, undef, "HSP custom_score");
102 '<<<<<<<..<<<.........>>>.<<<<<.......>>>>>.......<<<<.......>>>>>>>>>>>....',
104 is($hsp->strand('hit'), 1, "HSP strand");
105 ($meta) = $hsp->feature1->get_tag_values('meta');
106 is($meta, '<<<<<<<..<<<.........>>>.<<<<<.......>>>>>.......<<<<.......>>>>>>>>>>>....');
107 ($meta) = $hsp->feature2->get_tag_values('meta');
108 is($meta, '<<<<<<<..<<<.........>>>.<<<<<.......>>>>>.......<<<<.......>>>>>>>>>>>....');