1 # -*-Perl-*- Test Harness script for Bioperl
9 test_begin( -tests => 47 );
11 use_ok( 'Bio::Align::Utilities',
12 qw( aa_to_dna_aln bootstrap_replicates cat dna_to_aa_aln ) );
13 use_ok('Bio::AlignIO');
17 my $in = Bio::AlignIO->new(
18 -format => 'clustalw',
19 -file => test_input_file('pep-266.aln')
21 my $pep_aln = $in->next_aln();
22 isa_ok( $pep_aln, 'Bio::Align::AlignI' );
26 my $seqin = Bio::SeqIO->new(
28 -file => test_input_file('cds-266.fas')
32 while ( my $seq = $seqin->next_seq ) {
33 $dna_seq{ $seq->display_id } = $seq;
36 my $dna_aln = aa_to_dna_aln( $pep_aln, \%dna_seq );
38 my @aa_seqs = $pep_aln->each_seq;
40 for my $dna_seq ( $dna_aln->each_seq ) {
41 my $peptrans = $dna_seq->translate();
42 my $aaseq = shift @aa_seqs;
43 is( $peptrans->seq(), $aaseq->seq() );
47 my $aa_aln = dna_to_aa_aln($dna_aln);
49 my @pep_seqs = $aa_aln->each_seq;
51 for my $dna_seq ( $dna_aln->each_seq ) {
52 my $peptrans = $dna_seq->translate();
53 my $aaseq = shift @pep_seqs;
54 is( $peptrans->seq, $aaseq->seq );
57 # bootstrap_replicates
58 my $bootstraps = bootstrap_replicates( $pep_aln, 10 );
59 is( scalar @$bootstraps, 10 );
62 my $sub_aln1 = $pep_aln->slice( 1, 100 );
63 my $sub_aln2 = $pep_aln->slice( 101, 200 );
64 my $sub_aln3 = $pep_aln->slice( 1, 200 );
65 my $cat_aln = cat( $sub_aln1, $sub_aln2 );
66 my @seq = $sub_aln3->each_seq;
67 for my $seq ( $cat_aln->each_seq ) {
68 my $refseq = shift @seq;
69 is( $seq->seq, $refseq->seq );