1 # This is -*-Perl-*- code
5 my $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
7 eval { require Test::More; };
14 use_ok('Bio::SimpleAlign');
15 use_ok('Bio::AlignIO');
16 use_ok('Bio::Root::IO');
19 unlink(Bio::Root::IO->catfile("t","data","testout2.pfam"),
20 Bio::Root::IO->catfile("t","data","testout.selex"),
21 Bio::Root::IO->catfile("t","data","testout.pfam"),
22 Bio::Root::IO->catfile("t","data","testout.msf"),
23 Bio::Root::IO->catfile("t","data","testout.fasta"),
24 Bio::Root::IO->catfile("t","data","testout.clustal"),
25 Bio::Root::IO->catfile("t","data","testout.phylip"),
26 Bio::Root::IO->catfile("t","data","testout.nexus"),
27 Bio::Root::IO->catfile("t","data","testout.mega"),
28 Bio::Root::IO->catfile("t","data","testout.po"),
29 Bio::Root::IO->catfile("t","data","testout.largemultifasta")
33 my ($str,$aln,$strout,$status);
36 $str = new Bio::AlignIO (
37 '-file' => Bio::Root::IO->catfile("t","data","testaln.psi"),
39 isa_ok($str,'Bio::AlignIO');
40 $aln = $str->next_aln();
41 isa_ok($aln,'Bio::Align::AlignI');
42 is($aln->get_seq_by_pos(1)->get_nse, 'QUERY/1-798');
43 is($aln->no_sequences, 56);
45 # STOCKHOLM (multiple concatenated files, as Pfam flatfile)
46 $str = new Bio::AlignIO (
47 '-file' => Bio::Root::IO->catfile("t","data","testaln.stockholm"),
48 '-format' => 'stockholm');
49 isa_ok($str,'Bio::AlignIO');
50 $aln = $str->next_aln();
51 isa_ok($aln,'Bio::Align::AlignI');
52 is($aln->get_seq_by_pos(1)->get_nse, '1433_LYCES/9-246');
53 $aln = $str->next_aln();
54 isa_ok($aln,'Bio::Align::AlignI');
55 is($aln->get_seq_by_pos(1)->get_nse, '1433_LYCES/9-246');
56 $aln = $str->next_aln();
57 isa_ok($aln,'Bio::Align::AlignI');
58 is($aln->get_seq_by_pos(1)->get_nse, '1433_LYCES/9-246');
62 $str = Bio::AlignIO->new(
63 '-file' => Bio::Root::IO->catfile("t","data","testaln.pfam"));
64 isa_ok($str,'Bio::AlignIO');
65 $aln = $str->next_aln();
66 isa_ok($aln,'Bio::Align::AlignI');
67 is($aln->get_seq_by_pos(1)->get_nse, '1433_LYCES/9-246');
69 $strout = Bio::AlignIO->new(
70 '-file' => ">".Bio::Root::IO->catfile("t","data","testout.pfam"),
72 $status = $strout->write_aln($aln);
73 is($status, 1, " failed pfam output test");
77 $str = Bio::AlignIO->new(
78 '-file' => Bio::Root::IO->catfile("t","data","humor.maf"));
79 $aln = $str->next_aln();
80 isa_ok($aln,'Bio::Align::AlignI');
81 is $aln->get_seq_by_pos(1)->get_nse, 'NM_006987/1-5000', " failed maf input test";
82 is $aln->get_seq_by_pos(1)->strand, '-';
85 $str = Bio::AlignIO->new(
86 '-file' => Bio::Root::IO->catfile("t","data","testaln.msf"));
87 $aln = $str->next_aln();
88 isa_ok($aln,'Bio::Align::AlignI');
89 is $aln->get_seq_by_pos(1)->get_nse, '1433_LYCES/9-246', " failed msf input test";
91 $strout = Bio::AlignIO->new(
92 '-file' => ">".Bio::Root::IO->catfile("t","data","testout.msf"),
94 $status = $strout->write_aln($aln);
95 is $status, 1, " failed msf output test";
99 $str = Bio::AlignIO->new(
100 -file => Bio::Root::IO->catfile("t","data","testaln.fasta"),
102 $aln = $str->next_aln();
103 isa_ok($aln,'Bio::Align::AlignI');
104 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431',
105 " failed fasta input test ";
106 is ($aln->get_seq_by_pos(1)->description, 'DESCRIPTION HERE',
107 " failed fasta input test for description");
108 is ($aln->get_seq_by_pos(11)->display_id, 'AK_YEAST',
109 " failed fasta input test for id");
111 is ($aln->get_seq_by_pos(2)->end, 318,
112 " failed fasta input test for end");
114 is ($aln->get_seq_by_pos(11)->description, 'A COMMENT FOR YEAST',
115 " failed fasta input test for description");
117 $strout = Bio::AlignIO->new(
118 '-file' => ">".Bio::Root::IO->catfile("t","data","testout.fasta"),
119 '-format' => 'fasta');
120 $status = $strout->write_aln($aln);
121 is $status, 1," failed fasta output test";
123 my $in = Bio::AlignIO->newFh(
124 '-file' => Bio::Root::IO->catfile("t","data","testaln.fasta"),
125 '-format' => 'fasta');
126 my $out = Bio::AlignIO->newFh(
127 '-file' => ">".Bio::Root::IO->catfile("t","data","testout2.pfam"),
128 '-format' => 'pfam');
129 while ( $aln = <$in>) {
130 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431',
131 " failed filehandle input test ";
132 $status = print $out $aln;
135 is $status, 1, " failed filehandle output test";
139 $str = Bio::AlignIO->new(
140 '-file' => Bio::Root::IO->catfile("t","data","testaln.selex"),
141 '-format' => 'selex');
142 $aln = $str->next_aln();
143 isa_ok($aln,'Bio::Align::AlignI');
144 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/114-431', " failed selex format test ";
146 $strout = Bio::AlignIO->new(
147 '-file' => ">".Bio::Root::IO->catfile("t","data","testout.selex"),
148 '-format' => 'selex');
149 $status = $strout->write_aln($aln);
150 is $status, 1, " failed selex output test";
154 $str = Bio::AlignIO->new(
155 '-file' => Bio::Root::IO->catfile("t","data","testaln.mase"),
156 '-format' => 'mase');
157 $aln = $str->next_aln();
158 isa_ok($aln,'Bio::Align::AlignI');
159 is $aln->get_seq_by_pos(1)->get_nse, 'AK1H_ECOLI/1-318', " failed mase input test ";
163 $str = Bio::AlignIO->new(
164 '-file' => Bio::Root::IO->catfile("t","data","testaln.prodom"),
165 '-format' => 'prodom');
166 $aln = $str->next_aln();
167 isa_ok($aln,'Bio::Align::AlignI');
168 is $aln->get_seq_by_pos(1)->get_nse, 'P04777/1-33', " failed prodom input test ";
172 $strout = Bio::AlignIO->new(
173 '-file' => ">".Bio::Root::IO->catfile("t","data","testout.clustal"),
174 '-format' => 'clustalw');
175 $status = $strout->write_aln($aln);
176 is $status, 1, " failed clustalw (.aln) output test";
178 $str = Bio::AlignIO->new(
179 '-file'=> Bio::Root::IO->catfile("t","data","testout.clustal"),
180 '-format' => 'clustalw');
181 $aln = $str->next_aln($aln);
182 isa_ok($aln,'Bio::Align::AlignI');
183 is $aln->get_seq_by_pos(1)->get_nse, 'P04777/1-33', " failed clustalw (.aln) input test";
184 my $io = Bio::AlignIO->new(
185 -file => Bio::Root::IO->catfile("t","data","testaln.aln") );
186 $aln = $io->next_aln();
187 isa_ok($aln,'Bio::Align::AlignI');
188 is $aln->consensus_string, 'MNEGEHQIKLDELFEKLLRARKIFKNKDVLRHSWEPKDLPHRHEQIEALAQILVPVLRGETMKIIFCGHHACELGEDRGTKGFVIDELKDVDEDRNGKVDVIEINCEHMDTHYRVLPNIAKLFDDCTGIGVPMHGGPTDEVTAKLKQVIDMKERFVIIVLDEIDKLVKKSGDEVLYSLTRINTELKRAKVSVIGISNDLKFKEYLDPRVLSSLSEEEVVFPPYDANQLRDILTQRAEEAFYPGVLDEGVIPLCAALAAREHGDARKALDLLRVAGEIAEREGASKVTEKHVWKAQEKIEQDMMEEVIKTLPLQSKVLLYAIVLLDENGDLPANTGDVYAVYRELCEYIDLEPLTQRRISDLINELDMLGIINAKVVSKGRYGRTKEIRLMVTSYKIRNVLRYDYSIQPLLTISLKSEQRRLI', " failed clustalw consensus_string test";
192 $str = Bio::AlignIO->new(
193 '-file' => Bio::Root::IO->catfile("t","data","bl2seq.out"),
194 '-format' => 'bl2seq',
195 '-report_type' => 'blastp');
196 $aln = $str->next_aln();
197 isa_ok($aln,'Bio::Align::AlignI');
198 is $aln->get_seq_by_pos(2)->get_nse, 'ALEU_HORVU/60-360',
199 "failed BLAST bl2seq format test";
203 $str = Bio::AlignIO->new(
204 '-file' => Bio::Root::IO->catfile("t","data","testaln.phylip"),
205 '-format' => 'phylip');
206 isa_ok($str,'Bio::AlignIO');
207 $aln = $str->next_aln();
208 isa_ok($aln,'Bio::Align::AlignI');
209 is $aln->get_seq_by_pos(1)->get_nse, 'Homo_sapie/1-45';
211 $strout = Bio::AlignIO->new(
212 '-file' => ">".Bio::Root::IO->catfile("t","data","testout.phylip"),
213 '-format' => 'phylip');
214 $status = $strout->write_aln($aln);
215 is $status, 1, " failed phylip output test";
218 # METAFASTA (tests 37-39)
219 print STDERR "Better Metafasta tests needed\n" if $DEBUG;
220 $io = Bio::AlignIO->new(-verbose => -1,
221 -file => Bio::Root::IO->catfile("t","data","testaln.metafasta"));
222 $aln = $io->next_aln;
223 isa_ok($aln,'Bio::Align::AlignI');
224 is $aln->consensus_string,'CDEFHIJKLMNOPQRSTUVWXYZ', " failed consensus_string on metafasta";
225 is $aln->symbol_chars,'23'," failed symbol_chars() using metafasta";
228 $str = Bio::AlignIO->new(
229 '-file' => Bio::Root::IO->catfile("t","data","testaln.nexus"),
230 '-format' => 'nexus');
231 isa_ok($str,'Bio::AlignIO');
232 $aln = $str->next_aln();
233 isa_ok($aln,'Bio::Align::AlignI');
234 is $aln->get_seq_by_pos(1)->get_nse, 'Homo_sapiens/1-45';
235 $strout = Bio::AlignIO->new('-file' => ">".
236 Bio::Root::IO->catfile("t", "data", "testout.nexus"),
237 '-format' => 'nexus', );
238 $status = $strout->write_aln($aln);
239 is $status, 1, " failed nexus output test";
241 $str = Bio::AlignIO->new(
242 '-file' => Bio::Root::IO->catfile("t","data","Bird_Ovomucoids.nex"),
243 '-format' => 'nexus');
244 isa_ok($str,'Bio::AlignIO');
245 $aln = $str->next_aln();
246 isa_ok($aln,'Bio::Align::AlignI');
247 $str = Bio::AlignIO->new(
248 '-file' => Bio::Root::IO->catfile("t","data","basic-ladder.nex"),
249 '-format' => 'nexus');
250 isa_ok($str,'Bio::AlignIO');
251 $aln = $str->next_aln();
252 isa_ok($aln,'Bio::Align::AlignI');
253 $str = Bio::AlignIO->new(
254 '-file' => Bio::Root::IO->catfile("t","data","Kingdoms_DNA.nex"),
255 '-format' => 'nexus');
256 isa_ok($str,'Bio::AlignIO');
257 $aln = $str->next_aln();
258 isa_ok($aln,'Bio::Align::AlignI');
259 $str = Bio::AlignIO->new(
260 '-file' => Bio::Root::IO->catfile("t","data","char-interleave.nex"),
261 '-format' => 'nexus');
262 isa_ok($str,'Bio::AlignIO');
263 $aln = $str->next_aln();
264 isa_ok($aln,'Bio::Align::AlignI');
265 $str = Bio::AlignIO->new(
266 '-file' => Bio::Root::IO->catfile("t","data","Primate_mtDNA.nex"),
267 '-format' => 'nexus');
268 isa_ok($str,'Bio::AlignIO');
269 $aln = $str->next_aln();
270 isa_ok($aln,'Bio::Align::AlignI');
271 $str = Bio::AlignIO->new(
272 '-file' => Bio::Root::IO->catfile("t","data","char-matrix-spaces.nex"),
273 '-format' => 'nexus');
274 isa_ok($str,'Bio::AlignIO');
275 $aln = $str->next_aln();
276 isa_ok($aln,'Bio::Align::AlignI');
277 $str = Bio::AlignIO->new(
278 '-file' => Bio::Root::IO->catfile("t","data","SPAN_Family4nl.nex"),
279 '-format' => 'nexus');
280 isa_ok($str,'Bio::AlignIO');
281 $aln = $str->next_aln();
282 isa_ok($aln,'Bio::Align::AlignI');
283 $str = Bio::AlignIO->new(
284 '-file' => Bio::Root::IO->catfile("t","data","intrablock-comment.nex"),
285 '-format' => 'nexus');
286 isa_ok($str,'Bio::AlignIO');
287 $aln = $str->next_aln();
288 isa_ok($aln,'Bio::Align::AlignI');
289 $str = Bio::AlignIO->new(
290 '-file' => Bio::Root::IO->catfile("t","data","SPAN_Family7n.nex"),
291 '-format' => 'nexus');
292 isa_ok($str,'Bio::AlignIO');
293 $aln = $str->next_aln();
294 isa_ok($aln,'Bio::Align::AlignI');
295 $str = Bio::AlignIO->new(
296 '-file' => Bio::Root::IO->catfile("t","data","long-names.nex"),
297 '-format' => 'nexus');
298 isa_ok($str,'Bio::AlignIO');
299 $aln = $str->next_aln();
300 isa_ok($aln,'Bio::Align::AlignI');
301 $str = Bio::AlignIO->new(
302 '-file' => Bio::Root::IO->catfile("t","data","SPAN_Family8a.nex"),
303 '-format' => 'nexus');
304 isa_ok($str,'Bio::AlignIO');
305 $aln = $str->next_aln();
306 isa_ok($aln,'Bio::Align::AlignI');
307 $str = Bio::AlignIO->new(
308 '-file' => Bio::Root::IO->catfile("t","data","multiline-intrablock-comment.nex"),
309 '-format' => 'nexus');
310 isa_ok($str,'Bio::AlignIO');
311 $aln = $str->next_aln();
312 isa_ok($aln,'Bio::Align::AlignI');
313 $str = Bio::AlignIO->new(
314 '-file' => Bio::Root::IO->catfile("t","data","Treebase-chlamy-dna.nex"),
315 '-format' => 'nexus');
316 isa_ok($str,'Bio::AlignIO');
317 $aln = $str->next_aln();
318 isa_ok($aln,'Bio::Align::AlignI');
319 $str = Bio::AlignIO->new(
320 '-file' => Bio::Root::IO->catfile("t","data","quoted-strings1.nex"),
321 '-format' => 'nexus');
322 isa_ok($str,'Bio::AlignIO');
323 $aln = $str->next_aln();
324 isa_ok($aln,'Bio::Align::AlignI');
325 $str = Bio::AlignIO->new(
326 '-file' => Bio::Root::IO->catfile("t","data","UnaSmithHIV-both.nex"),
327 '-format' => 'nexus');
328 isa_ok($str,'Bio::AlignIO');
329 $aln = $str->next_aln();
330 isa_ok($aln,'Bio::Align::AlignI');
331 $str = Bio::AlignIO->new(
332 '-file' => Bio::Root::IO->catfile("t","data","quoted-strings2.nex"),
333 '-format' => 'nexus');
334 isa_ok($str,'Bio::AlignIO');
335 $aln = $str->next_aln();
336 isa_ok($aln,'Bio::Align::AlignI');
337 $str = Bio::AlignIO->new(
338 '-file' => Bio::Root::IO->catfile("t","data","barns-combined.nex"),
339 '-format' => 'nexus');
340 isa_ok($str,'Bio::AlignIO');
341 $aln = $str->next_aln();
342 isa_ok($aln,'Bio::Align::AlignI');
343 $str = Bio::AlignIO->new(
344 '-file' => Bio::Root::IO->catfile("t","data","radical-whitespace.nex"),
345 '-format' => 'nexus');
346 isa_ok($str,'Bio::AlignIO');
347 $aln = $str->next_aln();
348 isa_ok($aln,'Bio::Align::AlignI');
349 $str = Bio::AlignIO->new(
350 '-file' => Bio::Root::IO->catfile("t","data","basic-bush.nex"),
351 '-format' => 'nexus');
352 isa_ok($str,'Bio::AlignIO');
353 $aln = $str->next_aln();
354 isa_ok($aln,'Bio::Align::AlignI');
355 $str = Bio::AlignIO->new(
356 '-file' => Bio::Root::IO->catfile("t","data","radical-whitespace_02.nex"),
357 '-format' => 'nexus');
361 $str = new Bio::AlignIO('-format' => 'emboss',
362 '-file' => Bio::Root::IO->catfile("t", "data", 'cysprot.water'));
363 $aln = $str->next_aln();
364 isa_ok($aln,'Bio::Align::AlignI');
365 is($aln->score,'501.50');
366 is($aln->get_seq_by_pos(1)->get_nse,'PAPA_CARPA/3-342');
367 is($aln->get_seq_by_pos(2)->get_nse,'CATL_HUMAN/1-331');
368 is(sprintf("%.1f",$aln->overall_percentage_identity),33.8);
369 is(sprintf("%.1f",$aln->average_percentage_identity),40.1);
371 is($aln->get_seq_by_pos(1)->start, 3);
372 is($aln->length,364);
376 $str = new Bio::AlignIO('-format' => 'emboss',
377 '-file' => Bio::Root::IO->catfile("t", "data", 'cysprot.needle'));
378 $aln = $str->next_aln();
379 isa_ok($aln,'Bio::Align::AlignI');
380 is($aln->score,'499.50');
381 is($aln->get_seq_by_pos(1)->get_nse,'PAPA_CARPA/1-345');
382 is($aln->get_seq_by_pos(2)->get_nse,'CATL_HUMAN/1-333');
386 $str = new Bio::AlignIO('-format' => 'emboss',
387 '-file' => Bio::Root::IO->catfile("t", "data", 'cys1_dicdi.water'));
388 $aln = $str->next_aln();
389 isa_ok($aln,'Bio::Align::AlignI');
390 is($aln->get_seq_by_pos(1)->get_nse,'CYS1_DICDI/1-343');
391 is($aln->get_seq_by_pos(2)->get_nse,'CYS1_DICDI-1/1-343');
392 is($aln->score,'1841.0');
393 $aln = $str->next_aln();
394 isa_ok($aln,'Bio::Align::AlignI');
395 is($aln->get_seq_by_pos(1)->get_nse,'CYS1_DICDI/29-343');
396 is($aln->get_seq_by_pos(2)->get_nse,'ALEU_HORVU/61-360');
399 # EMBOSS water 2.2.x sparse needle
400 $str = new Bio::AlignIO(-verbose => $DEBUG,
401 '-format' => 'emboss',
402 '-file' => Bio::Root::IO->catfile("t", "data", 'sparsealn.needle'));
403 $aln = $str->next_aln();
404 isa_ok($aln,'Bio::Align::AlignI');
405 is($aln->score,'18.0');
406 is(sprintf("%.1f",$aln->overall_percentage_identity), 2.1);
407 is(sprintf("%.1f",$aln->average_percentage_identity), 38.5);
408 is($aln->get_seq_by_pos(1)->length, 238);
409 is($aln->length,238);
410 is($aln->get_seq_by_pos(1)->get_nse,'KV1K_HUMAN/1-108');
411 is($aln->get_seq_by_pos(2)->get_nse,'IF1Y_HUMAN/1-143');
412 is($aln->get_seq_by_pos(1)->seq(), 'DIQMTQSPSTLSVSVGDRVTITCEASQTVLSYLNWYQQKPGKAPKLLIYAASSLETGVPSRFSGQGSGTBFTFTISSVZPZBFATYYCQZYLDLPRTFGQGTKVDLKR'.'-'x130);
413 is($aln->get_seq_by_pos(2)->seq(), ('-'x94).'PKNKGKGGK-NRRRGKNENESEKRELVFKEDGQEYAQVIKMLGNGRLEALCFDGVKRLCHIRGKLRKKVWINTSDIILVGLRDYQDNKADVILKYNADEARSLKAYGGLPEHAKINETDTFGPGDDDEIQFDDIGDDDEDIDDI');
414 is($aln->is_flush, 1);
418 $str = new Bio::AlignIO('-format' => 'mega',
419 '-file' => Bio::Root::IO->catfile("t","data","hemoglobinA.meg"));
421 $aln = $str->next_aln();
422 isa_ok($aln,'Bio::Align::AlignI');
423 is($aln->get_seq_by_pos(1)->get_nse,'Human/1-141');
424 is($aln->get_seq_by_pos(2)->get_nse,'Horse/1-144');
426 is($aln->get_seq_by_pos(3)->subseq(1,10), 'V-LSAADKGN');
428 $strout = new Bio::AlignIO('-format' => 'mega',
429 '-file' => ">" .Bio::Root::IO->catfile("t","data","testout.mega"));
431 $status = $strout->write_aln($aln);
432 is $status, 1, " failed mega output test";
436 $str = new Bio::AlignIO('-format' => 'emboss',
437 '-file' => Bio::Root::IO->catfile('t','data','gf-s71.needle'));
438 $aln = $str->next_aln();
439 isa_ok($aln,'Bio::Align::AlignI');
440 is($aln->get_seq_by_pos(2)->seq(), 'MEDVTLFQFTWRKPI-RLQGEIVYKTSETQTIETNKKDVECVANFQENKEVQTDS-VDNGVGENVKKDITISKEVLNLLYDFVRDDSKVNYDRLLEFHKFDKVALETVQKYHVETRNENIILMISSSSRKTLILFGGISHETFCSHQARALLCSSSTSFSIPLPVCAISAVFYSSTQFILGDVSGNISMCSKDKIIFEKKITDGAVTCLEMCRHGLLSGSDDGNIILWQIGTSGLEKLGGTKLTVSDLSRKIRRSSTSNKPVAIVSMQVYVWPSGEEACVATETGGLYLLTLPTLDYKPLSHQTATSINKILFENQFVAVIYHTSNAAVFNSEGLVDEIPFVATLAVR----------PKLVLF--YTSVCVQDITLNCTSPFREFNNEYNPVIKFSKIRFSADLSVING-FRTSSPNSNN-----------------------------------------------');
441 is($aln->get_seq_by_pos(1)->seq(), 'MEDVTLHHFRWRKPVENKNGEIVYKTSETQTAEISRKDVECVANFQKSQESQTDDFMQNGVGDGIKKEIRISKEVLGHIYDFLRDDSKVNYDRLLEFHKFDKVSLETVQKYHVETRNENIILMISNSSRKTLILFGGLSHETFCSHQARAVLCSSSTTSSLPLPVCAISAVFYSSTQFLLGDISGNISMWTKEKMIFENKVTDGSVTSLELCRYGLLSGSDDGNVILWKVEESKIEKIEGIKLTVSDLSRKIRRSSTSNKPVAIVSMQV----SGDEVCVATETGGLYLLTLPTLESKPLT-QSATSIFKILYEHPYIAVVYHTSNSAIFNSEGLVDEIPFVATLAVRCGAYFIFSNQSRLIIWSMNTRSTVIDENLNCHS-ICSLSND--------------TLQVLDGDFNLNSQSENSATSESENLRISDLQNLRMLKLQNLRTSEFQNFRTSESQYFKKDNGEL');
442 is($aln->is_flush(), 1);
443 is($aln->get_seq_by_pos(1)->get_nse,'gf.s71.44/1-448');
444 is($aln->get_seq_by_pos(2)->get_nse,'Y50C1A.2/1-406');
447 # PHYLIP sequential/non-interleaved
448 $strout = Bio::AlignIO->new('-file' =>
449 Bio::Root::IO->catfile("t","data",
450 "noninterleaved.phy"),
451 '-format' => 'phylip');
452 $aln = $strout->next_aln($aln);
453 isa_ok($aln,'Bio::Align::AlignI');
454 is($aln->get_seq_by_pos(2)->seq(), 'CCTCAGATCACTCTTTGGCAACGACCCCTCGTCACAATAAAGGTAGGGGGGCAACTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGACATGAATTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGGTTTATCAAAGTAAGACAGTATGATCAGATACCCATAGAGATCTGTGGACATAAAGCTATAGGTACAGTATTAGTAGGACCCACACCTGTCAATATAATTGGAAGAAATCTGTTGACTCAGATTGGTTGCACTTTAAATTTT' );
458 $str = Bio::AlignIO->new(
459 '-file' => Bio::Root::IO->catfile("t", "data","little.largemultifasta"),
460 '-format' => 'largemultifasta');
461 $aln = $str->next_aln();
462 isa_ok($aln,'Bio::Align::AlignI');
463 is $aln->get_seq_by_pos(1)->get_nse, 'Human:/1-81', " failed fasta input test ";
464 is ($aln->get_seq_by_pos(1)->description,
465 '72.0:1018606-3386002; 73.0:0-14850845; 74.0:0-83355922; SPECIAL_hsApr2003_3.0:0-414023;',
466 " failed fasta input test for description");
467 is ($aln->get_seq_by_pos(3)->display_id, 'Rat:',
468 " failed fasta input test for id");
470 is ($aln->get_seq_by_pos(3)->description,
471 '72.0:1018606-3386002; 73.0:0-14850845; 74.0:0-83355922; SPECIAL_hsApr2003_3.0:0-414023;',
472 " failed fasta input test for description");
474 $strout = Bio::AlignIO->new(
475 '-file' => ">".Bio::Root::IO->catfile("t", "data",
476 "testout.largemultifasta"),
477 '-format' => 'largemultifasta');
478 $status = $strout->write_aln($aln);
479 is $status, 1," failed fasta output test";
483 # just skip on perl 5.6.0 and earlier as it causes a crash on
484 # default perl with OS X 10.2
485 # fink perl 5.6.0 does not seem to have the problem
486 # can't figure out what it is so just skip for now
487 if( $^O ne 'darwin' || $] > 5.006 ) {
488 $str = new Bio::AlignIO(
489 -file => Bio::Root::IO->catfile("t", "data", "testaln.po"),
492 isa_ok($str, 'Bio::AlignIO');
493 $aln = $str->next_aln();
494 isa_ok($aln,'Bio::Align::AlignI');
495 is $aln->no_sequences, 6;
497 # output is? i.e. does conversion from clustalw to po give the same alignment?
498 $str = new Bio::AlignIO(
499 '-file' => Bio::Root::IO->catfile("t", "data", "testaln.aln"),
500 '-format' => 'clustalw');
501 isa_ok($str,'Bio::AlignIO');
502 $aln = $str->next_aln();
503 isa_ok($aln,'Bio::Align::AlignI');
504 $strout = Bio::AlignIO->new(
505 '-file' => ">" . Bio::Root::IO->catfile("t", "data", "testout.po"),
507 $status = $strout->write_aln($aln);
508 is $status, 1, " failed po output test";
510 $str = new Bio::AlignIO(
511 '-file' => Bio::Root::IO->catfile("t", "data", "testaln.po"),
513 isa_ok($str,'Bio::AlignIO');
514 my $aln2 = $str->next_aln();
515 isa_ok($aln2,'Bio::Align::AlignI');
516 is $aln2->no_sequences, $aln->no_sequences;
517 is $aln2->length, $aln->length;
520 skip(1,"skipping due to bug in perl 5.6.0 that comes with OS X 10.2");
526 # this file has no Strand column
527 $str = new Bio::AlignIO(
528 -file => Bio::Root::IO->catfile("t", "data", "test.meme"),
530 isa_ok($str,'Bio::AlignIO');
531 $aln = $str->next_aln();
532 isa_ok($aln,'Bio::Align::AlignI');is $aln->length,25;
533 is $aln->no_sequences,4;
534 is $aln->get_seq_by_pos(3)->seq(),"CCTTAAAATAAAATCCCCACCACCA";
535 is $aln->get_seq_by_pos(3)->strand,"1";
537 # this file has a Strand column
538 $str = new Bio::AlignIO(
539 -file => Bio::Root::IO->catfile("t", "data", "test.meme2"),
541 isa_ok($str,'Bio::AlignIO');
542 $aln = $str->next_aln();
543 isa_ok($aln,'Bio::Align::AlignI');is $aln->length,20;
544 is $aln->no_sequences,8;
545 is $aln->get_seq_by_pos(8)->seq(),"CCAGTCTCCCCTGAATACCC";
546 is $aln->get_seq_by_pos(7)->strand,"-1";
547 is $aln->get_seq_by_pos(6)->strand,"1";