Catch failing tie'd DB_File handle
[bioperl-live.git] / t / AlignUtil.t
blobd5dc770e73ba999a67a5c31076bf914ef1cf00f4
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN {
7     use lib 't/lib';
8     use BioperlTest;
9     
10     test_begin(-tests => 19);
11         
12         use_ok('Bio::Align::Utilities',qw(aa_to_dna_aln bootstrap_replicates) );
13         use_ok('Bio::AlignIO');
14         use_ok('Bio::SeqIO');
17 my $in = Bio::AlignIO->new(-format => 'clustalw',
18                           -file   => test_input_file('pep-266.aln'));
19 my $aln = $in->next_aln();
20 isa_ok($aln, 'Bio::Align::AlignI');
21 $in->close();
23 my $seqin = Bio::SeqIO->new(-format => 'fasta',
24                            -file   => test_input_file('cds-266.fas'));
25 # get the cds sequences
26 my %cds_seq;
27 while( my $seq = $seqin->next_seq ) {
28     $cds_seq{$seq->display_id} = $seq;
31 my $cds_aln = &aa_to_dna_aln($aln,\%cds_seq);
33 my @aa_seqs = $aln->each_seq;
35 for my $cdsseq ( $cds_aln->each_seq ) {
36     my $peptrans = $cdsseq->translate();
37     my $aaseq = shift @aa_seqs;
38     is($peptrans->seq(),$aaseq->seq());
41 my $bootstraps = &bootstrap_replicates($aln,10);
43 is(scalar @$bootstraps, 10);