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