2 ## Bioperl Test Harness Script for Modules
7 $DEBUG = $ENV{'BIOPERLDEBUG'} || -1;
10 eval { require Test; };
17 plan tests => $NTESTS;
20 use Bio::Tools::Run::Phylo::Phylip::ProtDist;
21 use Bio::Tools::Run::Alignment::Clustalw;
24 for ( $Test::ntest..$NTESTS ) {
25 skip("ProtDist not found. Skipping.",1);
38 'freq' =>'0.25,0.5,0.125,0.125');
40 my $dist_factory = Bio::Tools::Run::Phylo::Phylip::ProtDist->new(@params);
41 unless($dist_factory->executable){
42 warn("Protdist program not found. Skipping tests $Test::ntest to $NTESTS.\n");
46 ok $dist_factory->isa('Bio::Tools::Run::Phylo::Phylip::ProtDist');
49 $dist_factory->model($model);
51 my $new_model= $dist_factory->model();
52 ok $new_model , 'KIMURA', " couldn't set factory parameter";
55 $dist_factory->gencode($gencode);
57 my $new_gencode= $dist_factory->gencode();
58 ok $new_gencode, 'M', " couldn't set factory parameter";
62 $dist_factory->category($category);
64 my $new_category= $dist_factory->category();
65 ok $new_category, "H", " couldn't set factory parameter";
68 $dist_factory->probchange($probchange);
70 my $new_probchange= $dist_factory->probchange();
71 ok $new_probchange, 0.4, " couldn't set factory parameter";
74 $dist_factory->trans($trans);
76 my $new_trans= $dist_factory->trans();
77 ok $new_trans, 5, " couldn't set factory parameter";
79 my $freq= "0.25,0.5,0.125,0.125";
80 $dist_factory->freq($freq);
82 my $new_freq= $dist_factory->freq();
83 ok $new_freq, "0.25,0.5,0.125,0.125", " couldn't set factory parameter";
86 $dist_factory->quiet($bequiet); # Suppress protpars messages to terminal
88 my $inputfilename = Bio::Root::IO->catfile("t","data","protpars.phy");
90 my $protdist_present = $dist_factory->executable();
91 unless ($protdist_present) {
92 warn("protdist program not found. Skipping tests $Test::ntest to $NTESTS.\n") if($DEBUG);
95 $dist_factory->verbose($verbose);
96 ($matrix) = $dist_factory->create_distance_matrix($inputfilename);
98 ok($matrix->get_entry('ENSP000003','SINFRUP001'),0.27708);
100 $inputfilename = Bio::Root::IO->catfile("t","data","cysprot.fa");
101 @params = ('ktuple' => 2, 'matrix' => 'BLOSUM',
102 -verbose => $verbose);
103 my $align_factory = Bio::Tools::Run::Alignment::Clustalw->new(@params);
105 exit(0) unless $align_factory->executable();
107 my $aln = $align_factory->align($inputfilename);
108 ($matrix) = $dist_factory->create_distance_matrix($aln);
110 ok (int($matrix->get_entry('ALEU_HORVU','ALEU_HORVU')),0,
111 "failed creating distance matrix");
112 ok(sprintf("%.2f",$matrix->get_entry('CATL_HUMAN','CYS1_DICDI'),'1.30', "failed creating distance matrix"));