[Bioperl-guts-l] bioperl-live/t TreeBuild.t,1.3,1.4

Jason Stajich jason at dev.open-bio.org
Mon Jun 18 13:44:31 EDT 2007


Update of /home/repository/bioperl/bioperl-live/t
In directory dev.open-bio.org:/tmp/cvs-serv11456/t

Modified Files:
	TreeBuild.t 
Log Message:
Converted to Test::More

Index: TreeBuild.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/TreeBuild.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TreeBuild.t	14 Jun 2007 14:16:21 -0000	1.3
--- TreeBuild.t	18 Jun 2007 17:44:29 -0000	1.4
***************
*** 5,28 ****
  # Before `make install' is performed this script should be runnable with
  # `make test'. After `make install' it should work as `perl test.t'
  
- my $error = 0;
  
  use strict;
! BEGIN {
!     # to handle systems with no installed Test module
!     # we include the t dir (where a copy of Test.pm is located)
!     # as a fallback
!     eval { require Test; };
      if( $@ ) {
! 	use lib 't';
      }
- 
-     use Test;
-     plan tests => 7;
  }
  
- if( $error == 1 ) {
-     exit(0);
- }
  
  my $debug = -1;
--- 5,34 ----
  # Before `make install' is performed this script should be runnable with
  # `make test'. After `make install' it should work as `perl test.t'
+ use strict;
+ use constant NUMTESTS => 14;
+ use vars qw($DEBUG);
+ $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
  
  
  use strict;
! BEGIN { 
!     eval { require Test::More; };
      if( $@ ) {
! 	use lib 't/lib';
!     }
!     use Test::More;
!     
!     plan tests => NUMTESTS;
!     for my $mod ( qw(Bio::Align::DNAStatistics
! 		   Bio::Align::ProteinStatistics
! 		   Bio::Align::Utilities
! 		   Bio::AlignIO
! 		   Bio::Root::IO
! 		   Bio::Tree::DistanceFactory
! 		   Bio::TreeIO ) ) {
! 	use_ok($mod);
      }
  }
  
  
  my $debug = -1;
***************
*** 40,62 ****
  							    'pep-266.aln'));
  my $aln = $in->next_aln();
! ok($aln);
  my $pstats = Bio::Align::ProteinStatistics->new(-verbose => $debug);
  my $matrix = $pstats->distance(-method => 'Kimura',
  			       -align  => $aln);
! ok($matrix);
  
  my $treebuilder = Bio::Tree::DistanceFactory->new(-method => 'NJ');
  my $tree = $treebuilder->make_tree($matrix);
! ok($tree);
  
  my ($cn) = $tree->find_node('183.m01790');
  
  # brlens checked against tree generated by PHYLIP NJ
! ok($tree->find_node('AN2438.1')->branch_length, '0.28221');
! ok($tree->find_node('FG05298.1')->branch_length, '0.20593');
  
  # simple topology test - make sure these 2 are sister
! ok($tree->find_node('YOR262W')->ancestor->id, 
!    $tree->find_node('Smik_Contig1103.1')->ancestor->id);
  
  # TODO 
--- 46,68 ----
  							    'pep-266.aln'));
  my $aln = $in->next_aln();
! isa_ok($aln, 'Bio::SimpleAlign','SimpleAlign object parsed out');
  my $pstats = Bio::Align::ProteinStatistics->new(-verbose => $debug);
  my $matrix = $pstats->distance(-method => 'Kimura',
  			       -align  => $aln);
! isa_ok($matrix,'Bio::Matrix::MatrixI','Protein distance matrix retrieved');
  
  my $treebuilder = Bio::Tree::DistanceFactory->new(-method => 'NJ');
  my $tree = $treebuilder->make_tree($matrix);
! isa_ok($tree,'Bio::Tree::TreeI', 'Tree object gotten back');
  
  my ($cn) = $tree->find_node('183.m01790');
  
  # brlens checked against tree generated by PHYLIP NJ
! is($tree->find_node('AN2438.1')->branch_length, '0.28221','NJ calculated Branch length');
! is($tree->find_node('FG05298.1')->branch_length, '0.20593','NJ calculated Branch length');
  
  # simple topology test - make sure these 2 are sister
! is($tree->find_node('YOR262W')->ancestor->id, 
!    $tree->find_node('Smik_Contig1103.1')->ancestor->id, 'Make sure two nodes are sister');
  
  # TODO 
***************
*** 66,68 ****
  # test the bootstrap
  my $replicates = &bootstrap_replicates($aln,10);
! ok(scalar @$replicates, 10);
--- 72,74 ----
  # test the bootstrap
  my $replicates = &bootstrap_replicates($aln,10);
! is(scalar @$replicates, 10,'10 replicates formulated');



More information about the Bioperl-guts-l mailing list