1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 116,
11 -requires_module => 'Bio::Tools::RNAMotif');
13 use_ok('Bio::Tools::ERPIN');
14 use_ok('Bio::Tools::Infernal');
17 my $verbose = test_debug();
19 ### RNAMotif.pm tests ###
21 my $parser = Bio::Tools::RNAMotif->new(
23 -file => test_input_file('trna.strict.rnamotif'),
24 -motiftag => 'tRNA_gene',
28 while( my $gene = $parser->next_prediction ) {
34 is($genes[1]->display_name, 'tRNA','RNAMotif::display_name()');
35 is($genes[12]->seq_id, 'M33910','RNAMotif::seq_id()');
36 is($genes[6]->primary_tag, 'tRNA_gene','RNAMotif::primary_tag()');
37 is($genes[22]->start, 464,'RNAMotif::start()');
38 is($genes[8]->end, 585,'RNAMotif::end()');
39 is($genes[9]->strand, 1,'RNAMotif::strand()');
40 is(($genes[90]->get_tag_values('sequence'))[0],
41 'cggatt ta ttg ggcg taa a gggct cgtaggc ggctc'.
42 ' gtcgcgtccggtgtgaaagtc catc gcttaac ggtg gatctg cgcc',
43 "RNAMotif::get_tag_values('sequence')");
44 is(($genes[90]->get_tag_values('descfile'))[0], 'trna.strict.descr',
45 "RNAMotif::get_tag_values('descfile')");
46 is(($genes[4]->get_tag_values('descline'))[0],
47 'gi|173683|gb|M10671|ACSTRW Avian oncornavirus Trp-tRNA',
48 "RNAMotif::get_tag_values('descline')");
49 is(($genes[26]->get_tag_values('secstructure'))[0],
50 'h5 ss h5 ss h3 ss h5 ss h3 ss h5 ss h3 h3 ss',
51 "RNAMotif::get_tag_values('secstructure')");
52 is($genes[4]->score, '0.000','RNAMotif::score()');
53 is($genes[4]->source_tag, 'RNAMotif','RNAMotif::source_tag()');
57 $parser = Bio::Tools::RNAMotif->new(
59 -file => test_input_file('sprintf.rnamotif'),
61 -desctag => 'stem_loop');
63 while( my $gene = $parser->next_prediction ) {
67 is($genes[1]->display_name, 'stem_loop','RNAMotif::display_name()');
68 is($genes[12]->seq_id, 'M82700','RNAMotif::seq_id()');
69 is($genes[6]->primary_tag, 'term','RNAMotif::primary_tag()');
70 is($genes[22]->start, 141,'RNAMotif::start()');
71 is($genes[8]->end, 154,'RNAMotif::end()');
72 is($genes[9]->strand, -1,'RNAMotif::strand()');
73 is(($genes[90]->get_tag_values('sequence'))[0], 'ggggaag cttg cttcccc',
74 "RNAMotif::get_tag_values('sequence')");
75 is(($genes[84]->get_tag_values('descfile'))[0], 'sprintf.descr',
76 "RNAMotif::get_tag_values('descfile')");
77 is(($genes[4]->get_tag_values('descline'))[0],
78 'gi|173741|gb|M83548|AQF16SRRN Aquifex pyrophilus 16S ribosomal RNA (16S rRNA)',
79 "RNAMotif::get_tag_values('descline')");
80 is(($genes[26]->get_tag_values('secstructure'))[0], 'h5 ss h3',
81 "RNAMotif::get_Annotations('secstructure')");
82 is($genes[4]->score, '-12.100,5,gaaa','RNAMotif::score()');
83 is($genes[4]->source_tag, 'RNAMotif','RNAMotif::source_tag()');
85 ### ERPIN.pm tests ###
90 ['30260185','5181155','5181183',1,'CTTT.aacc--.CAACC.CCGTGA.GGTTG.a.GAAG',
91 'gi|30260185|gb|AE016879.1| Bacillus anthracis str. Ames, complete genome',
93 ['30260185','3709092','3709121',-1,'CTTT.taatt-.CAGTC.CTGTGA.GACCG.g.AAAG',
94 'gi|30260185|gb|AE016879.1| Bacillus anthracis str. Ames, complete genome',
96 ['30260185','3710524','3710553',-1,'TTTT.aaatg-.TAGTC.CTGTGA.GGCTG.c.CAAA',
97 'gi|30260185|gb|AE016879.1| Bacillus anthracis str. Ames, complete genome',
99 ['30260185','3711223','3711251',-1,'CTTT.aaca--.CAGCC.CCGTGA.GGTTG.a.GAAG',
100 'gi|30260185|gb|AE016879.1| Bacillus anthracis str. Ames, complete genome',
104 $parser = Bio::Tools::ERPIN->new(
105 -verbose => $verbose,
106 -file => test_input_file('testfile.erpin'),
107 -motiftag => 'protein_bind',
108 -desctag => 'pyrR_BL');
110 while( my $gene = $parser->next_prediction ) {
111 my @stats = @{ shift @erpinstats };
112 is($gene->display_name, 'pyrR_BL','ERPIN::display_name()');
113 is($gene->seq_id, shift @stats,'ERPIN::seq_id()');
114 is($gene->primary_tag, 'protein_bind','ERPIN::primary_tag()');
115 is($gene->start, shift @stats,'ERPIN::start()');
116 is($gene->end, shift @stats,'ERPIN::end()');
117 is($gene->strand, shift @stats,'ERPIN::strand()');
118 ($val) = $gene->get_tag_values('sequence');
119 is($val, shift @stats, "ERPIN::get_tag_values('sequence')");
120 eval {($val) = $gene->get_tag_values('descfile')}; # no descfile
121 like($@, qr(asking for tag value that does not exist descfile));
122 ($val) = $gene->get_tag_values('descline');
123 is($val, shift @stats, "ERPIN::get_tag_values('descline')");
124 eval {($val) = $gene->get_tag_values('secstructure')}; # no secstructure
125 like($@, qr(asking for tag value that does not exist secstructure));
126 is($gene->score, shift @stats,'ERPIN::score()');
127 is($gene->source_tag, 'ERPIN','ERPIN::source_tag()');
130 ### Infernal.pm tests ###
133 ['30260185','5181155','5181183',1,'CTTT.aacc--.CAACC.CCGTGA.GGTTG.a.GAAG',0,
134 'gi|30260185|gb|AE016879.1| Bacillus anthracis str. Ames, complete genome',
136 ['30260185','3709092','3709121',-1,'CTTT.taatt-.CAGTC.CTGTGA.GACCG.g.AAAG',0,
137 'gi|30260185|gb|AE016879.1| Bacillus anthracis str. Ames, complete genome',
139 ['30260185','3710524','3710553',-1,'TTTT.aaatg-.TAGTC.CTGTGA.GGCTG.c.CAAA',0,
140 'gi|30260185|gb|AE016879.1| Bacillus anthracis str. Ames, complete genome',
142 ['30260185','3711223','3711251',-1,'CTTT.aaca--.CAGCC.CCGTGA.GGTTG.a.GAAG',0,
143 'gi|30260185|gb|AE016879.1| Bacillus anthracis str. Ames, complete genome',
147 $parser = Bio::Tools::Infernal->new(
148 -file => test_input_file('test.infernal'),
149 -motiftag => 'misc_binding',
150 -desctag => 'Purine riboswitch',
155 my $gene = $parser->next_prediction;
156 # get query (model) data
157 is($gene->display_name, 'Purine riboswitch','Infernal::display_name()');
158 is($gene->seq_id, 'RF00167','Infernal::seq_id()');
159 is($gene->primary_tag, 'misc_binding','Infernal::primary_tag()');
160 is($gene->source_tag, 'Infernal 0.71','Infernal::source_tag()');
161 is($gene->start, '1','Infernal::start()');
162 is($gene->end, '102','Infernal::end()');
163 is($gene->strand, '0','Infernal::strand()');
164 is($gene->score, '78.40','Infernal::strand()');
167 is($gene->display_name, 'Purine riboswitch','Infernal::display_name()');
168 is($gene->seq_id, '2239287','Infernal::seq_id()');
169 is($gene->primary_tag, 'misc_binding','Infernal::primary_tag()');
170 is($gene->source_tag, 'Infernal 0.71','Infernal::source_tag()');
171 is($gene->start, '15589','Infernal::start()');
172 is($gene->end, '15691','Infernal::end()');
173 is($gene->strand, '1','Infernal::strand()');
174 is($gene->score, '78.40','Infernal::strand()');
175 ($val) = $gene->get_tag_values('model');
177 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcG.aGuaAauauuaaauauuu',
178 "Infernal::get_tag_values('model')");
179 ($val) = $gene->get_tag_values('midline');
181 ' A+ A+A+ AAAA A :CUC:UAUAAU: :GGGAAUAUGGCCC: :AGUUUCUACC:GGCAACCGUAAAUUGCC:GACUA:G AG: AA + ++ +++++',
182 "Infernal::get_tag_values('midline')");
183 ($val) = $gene->get_tag_values('hit');
185 'CAUGAAAUCAAAACACGACCUCAUAUAAUCUUGGGAAUAUGGCCCAUAAGUUUCUACCCGGCAACCGUAAAUUGCCGGACUAUGcAGGGAAGUGAUCGAUAAA',
186 "Infernal::get_tag_values('hit')");
187 ($val) = $gene->get_tag_values('secstructure');
189 ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,)))).))))::::::::::::::',
190 "Infernal::get_tag_values('secstructure')");
191 ($val) = $gene->get_tag_values('seq_name'),
192 is($val, 'gi|2239287|gb|U51115.1|BSU51115',
193 "Infernal::get_tag_values('seq_name')");
195 $gene = $parser->next_prediction;
196 # get query (model) data
197 is($gene->display_name, 'Purine riboswitch','Infernal::display_name()');
198 is($gene->seq_id, 'RF00167','Infernal::seq_id()');
199 is($gene->primary_tag, 'misc_binding','Infernal::primary_tag()');
200 is($gene->source_tag, 'Infernal 0.71','Infernal::source_tag()');
201 is($gene->start, '1','Infernal::start()');
202 is($gene->end, '102','Infernal::end()');
203 is($gene->strand, '0','Infernal::strand()');
204 is($gene->score, '81.29','Infernal::strand()');
206 $gene->invert; # switch to get hit data
207 is($gene->display_name, 'Purine riboswitch','Infernal::display_name()');
208 is($gene->seq_id, '2239287','Infernal::seq_id()');
209 is($gene->primary_tag, 'misc_binding','Infernal::primary_tag()');
210 is($gene->source_tag, 'Infernal 0.71','Infernal::source_tag()');
211 is($gene->start, '11655','Infernal::start()');
212 is($gene->end, '11756','Infernal::end()');
213 is($gene->strand, '1','Infernal::strand()');
214 is($gene->score, '81.29','Infernal::strand()');
215 ($val) = $gene->get_tag_values('model');
217 'aAaaauaaAaaaaaaaauaCuCgUAUAaucucgggAAUAUGGcccgagaGUuUCUACCaGgcaaCCGUAAAuugcCuGACUAcGaGuaAauauuaaauauuu',
218 "Infernal::get_tag_values('model')");
219 ($val) = $gene->get_tag_values('midline');
221 'A AAAU AAA+AA A+ : CGUAUAAU::CG:GAAUAUGGC:CG::AGU UCUACCA:GC ACCGUAAAU GC:UGACUACG : AU+U +++ UUU',
222 "Infernal::get_tag_values('midline')");
223 ($val) = $gene->get_tag_values('hit');
225 'AGAAAUCAAAUAAGAUGAAUUCGUAUAAUCGCGGGAAUAUGGCUCGCAAGUCUCUACCAAGCUACCGUAAAUGGCUUGACUACGUAAACAUUUCUUUCGUUU',
226 "Infernal::get_tag_values('hit')");
227 ($val) = $gene->get_tag_values('secstructure');
229 ':::::::::::::::::((((((((,,,<<<<<<<_______>>>>>>>,,,,,,,,<<<<<<<_______>>>>>>>,,))))))))::::::::::::::',
230 "Infernal::get_tag_values('secstructure')");
231 ($val) = $gene->get_tag_values('seq_name');
233 'gi|2239287|gb|U51115.1|BSU51115',
234 "Infernal::get_tag_values('seq_name')");