1 # -*-Perl-*- Test Harness script for Bioperl
8 test_begin( -tests => 47 );
10 use_ok( 'Bio::Align::Utilities',
11 qw( aa_to_dna_aln bootstrap_replicates cat dna_to_aa_aln ) );
12 use_ok('Bio::AlignIO');
16 my $in = Bio::AlignIO->new(
17 -format => 'clustalw',
18 -file => test_input_file('pep-266.aln')
20 my $pep_aln = $in->next_aln();
21 isa_ok( $pep_aln, 'Bio::Align::AlignI' );
25 my $seqin = Bio::SeqIO->new(
27 -file => test_input_file('cds-266.fas')
31 while ( my $seq = $seqin->next_seq ) {
32 $dna_seq{ $seq->display_id } = $seq;
35 my $dna_aln = aa_to_dna_aln( $pep_aln, \%dna_seq );
37 my @aa_seqs = $pep_aln->each_seq;
39 for my $dna_seq ( $dna_aln->each_seq ) {
40 my $peptrans = $dna_seq->translate();
41 my $aaseq = shift @aa_seqs;
42 is( $peptrans->seq(), $aaseq->seq() );
46 my $aa_aln = dna_to_aa_aln($dna_aln);
48 my @pep_seqs = $aa_aln->each_seq;
50 for my $dna_seq ( $dna_aln->each_seq ) {
51 my $peptrans = $dna_seq->translate();
52 my $aaseq = shift @pep_seqs;
53 is( $peptrans->seq, $aaseq->seq );
56 # bootstrap_replicates
57 my $bootstraps = bootstrap_replicates( $pep_aln, 10 );
58 is( scalar @$bootstraps, 10 );
61 my $sub_aln1 = $pep_aln->slice( 1, 100 );
62 my $sub_aln2 = $pep_aln->slice( 101, 200 );
63 my $sub_aln3 = $pep_aln->slice( 1, 200 );
64 my $cat_aln = cat( $sub_aln1, $sub_aln2 );
65 my @seq = $sub_aln3->each_seq;
66 for my $seq ( $cat_aln->each_seq ) {
67 my $refseq = shift @seq;
68 is( $seq->seq, $refseq->seq );