Bio::DB::Universal: move into its own distribution
[bioperl-live.git] / t / Align / Utilities.t
blobb67cb0982a6637217b747ff2ffb9d0cd550532d8
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN {
7         use lib '.';
8     use Bio::Root::Test;
9     
10     test_begin(-tests => 14);
11         
12         use_ok('Bio::Align::Utilities', qw(:all));
13         use_ok('Bio::SimpleAlign');
14         use_ok('Bio::PrimarySeq');
15         use_ok('Bio::LocatableSeq');
16         use_ok('Bio::AlignIO');
19 my $DEBUG = test_debug();
21 my $aa_align = Bio::SimpleAlign->new();
22 $aa_align->add_seq(Bio::LocatableSeq->new(-id => "n1", -seq => "MLIDVG-MLVLR"));
23 $aa_align->add_seq(Bio::LocatableSeq->new(-id => "n2", -seq => "MLIDVRTPLALR"));
24 $aa_align->add_seq(Bio::LocatableSeq->new(-id => "n3", -seq => "MLI-VR-SLALR"));
26 my %dnaseqs = ();
27 $dnaseqs{'n1'} = Bio::PrimarySeq->new(-id => "n1dna", -seq => 'atgctgatagacgtaggcatgctagtactgaga');
28 $dnaseqs{'n2'} = Bio::PrimarySeq->new(-id => "n2dna", -seq => 'atgctgatcgacgtacgcaccccgctagcactcaga');
29 $dnaseqs{'n3'} = Bio::PrimarySeq->new(-id => "n3dna", -seq => 'atgttgattgtacgctcgcttgcacttaga');
30 my $dna_aln;
32 ok( $dna_aln = &aa_to_dna_aln($aa_align, \%dnaseqs));
33 if( $DEBUG ) {
34         Bio::AlignIO->new(-format=>'clustalw')->write_aln($dna_aln);
37 is $dna_aln->length, 36;
38 is $dna_aln->num_residues, 99;
39 is $dna_aln->num_sequences, 3;
40 is $dna_aln->consensus_string(50), "atgctgat?gacgtacgc????cgctagcact?aga";
42 my @dnaseqs = $dna_aln->each_seq;
43 is $dnaseqs[0]->display_id, 'n1dna';
44 $dna_aln->verbose(-1);
45 my $replicates;
46 ok $replicates = &bootstrap_replicates($dna_aln,3);
48 is scalar @$replicates, 3;
49 my $repl_aln = pop @$replicates;
50 is $repl_aln->num_sequences, 3;
52 ##use IO::String;
53 ##use Bio::AlignIO;
54 ##my $string;
55 ##my $out = IO::String->new($string);
57 ##my $strout = Bio::AlignIO->new(-fh   => $out,'-format' => 'pfam');
58 ##$strout->write_aln($repl_aln);
59 ##is $string, "";