[Bioperl-guts-l] bioperl-run/t SeqBoot.t, 1.2, 1.3 Neighbor.t, 1.8, 1.9 ProtDist.t, 1.15, 1.16 ProtPars.t, 1.8, 1.9

Weigang Qiu weigang at dev.open-bio.org
Fri Jan 12 17:21:56 EST 2007


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

Modified Files:
	SeqBoot.t Neighbor.t ProtDist.t ProtPars.t 
Log Message:
add tests for protecting/restoring sequences with long names

Index: Neighbor.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/t/Neighbor.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Neighbor.t	8 Oct 2005 21:56:18 -0000	1.8
--- Neighbor.t	12 Jan 2007 22:21:54 -0000	1.9
***************
*** 104,105 ****
--- 104,125 ----
  		    $a->id cmp $b->id } $tree->get_nodes();
  ok ($nodes[1]->id, 'ENSP000003',"failed creating tree by neighbor");
+ 
+ # Test name preservation and restoration:
+ $inputfilename = Bio::Root::IO->catfile("t","data","longnames.aln");
+ my $aln = Bio::AlignIO->new(-file=>$inputfilename, -format=>'clustalw')->next_aln;
+ my ($aln_safe, $ref_name) =$aln->set_displayname_safe(3);
+ $protdist_factory = Bio::Tools::Run::Phylo::Phylip::ProtDist->new();
+ ($matrix) = $protdist_factory->create_distance_matrix($aln_safe);
+ $tree_factory->outgroup(undef);
+ ($tree) = $tree_factory->create_tree($matrix);
+ @nodes = sort { defined $a->id && 
+ 		    defined $b->id &&
+ 		    $a->id cmp $b->id } $tree->get_nodes();
+ ok ($nodes[12]->id, 'S01',"failed to assign serial names");
+ foreach my $nd (@nodes){
+   $nd->id($ref_name->{$nd->id_output}) if $nd->is_Leaf;
+ }
+ ok ($nodes[12]->id, 'Spar_21273',"failed to restore original names");
+ 
+ 
+ 

Index: ProtPars.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/t/ProtPars.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ProtPars.t	30 Sep 2005 01:21:02 -0000	1.8
--- ProtPars.t	12 Jan 2007 22:21:54 -0000	1.9
***************
*** 14,18 ****
      use Test;
      use vars qw($NTESTS);
!     $NTESTS = 7;
      plan tests => $NTESTS;
  }
--- 14,18 ----
      use Test;
      use vars qw($NTESTS);
!     $NTESTS = 10;
      plan tests => $NTESTS;
  }
***************
*** 82,83 ****
--- 82,100 ----
  ok (scalar(@nodes),13,
      "failed creating tree by protpars");
+ 
+ # test name preservation and restoration:
+ @params = ('threshold'=>10,'jumble'=>'7,5',outgroup=>2,'idlength'=>10);
+ $tree_factory = Bio::Tools::Run::Phylo::Phylip::ProtPars->new(@params);
+ $tree_factory->quiet($bequiet);  # Suppress protpars messages to terminal 
+ $inputfilename = Bio::Root::IO->catfile("t","data","longnames.aln");
+ my $aln = Bio::AlignIO->new(-file=>$inputfilename, -format=>'clustalw')->next_aln;
+ my ($aln_safe, $ref_name) =$aln->set_displayname_safe(3);
+ $tree = $tree_factory->create_tree($aln_safe);
+ @nodes = sort { $a->id cmp $b->id } $tree->get_nodes();
+ ok (scalar(@nodes),27,
+     "failed creating tree by protpars");
+ ok ($nodes[12]->id, 'S01',"failed to assign serial names");
+ foreach my $nd (@nodes){
+   $nd->id($ref_name->{$nd->id_output}) if $nd->is_Leaf;
+ }
+ ok ($nodes[12]->id, 'Spar_21273',"failed to restore original names");

Index: ProtDist.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/t/ProtDist.t,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ProtDist.t	29 Sep 2005 20:59:29 -0000	1.15
--- ProtDist.t	12 Jan 2007 22:21:54 -0000	1.16
***************
*** 14,18 ****
      use Test;
      use vars qw($NTESTS);
!     $NTESTS = 11;
      plan tests => $NTESTS;
  }
--- 14,18 ----
      use Test;
      use vars qw($NTESTS);
!     $NTESTS = 13;
      plan tests => $NTESTS;
  }
***************
*** 111,112 ****
--- 111,120 ----
      "failed creating distance matrix");
  ok(sprintf("%.2f",$matrix->get_entry('CATL_HUMAN','CYS1_DICDI'),'1.30', "failed creating distance matrix"));
+ 
+ # Test name preservation and restoration:
+ $inputfilename = Bio::Root::IO->catfile("t","data","longnames.aln");
+ my $aln = Bio::AlignIO->new(-file=>$inputfilename, -format=>'clustalw')->next_aln;
+ my ($aln_safe, $ref_name) =$aln->set_displayname_safe(3);
+ ($matrix) = $dist_factory->create_distance_matrix($aln_safe);
+ ok (int($matrix->get_entry('S03','S03')),0, "failed creating matrix on safe names");
+ ok(sprintf("%.4f",$matrix->get_entry('S01','S02'),'0.0205', "failed creating distance matrix"));

Index: SeqBoot.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/t/SeqBoot.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SeqBoot.t	28 Mar 2003 22:40:52 -0000	1.2
--- SeqBoot.t	12 Jan 2007 22:21:54 -0000	1.3
***************
*** 14,18 ****
      use Test;
      use vars qw($NTESTS);
!     $NTESTS = 6;
      plan tests => $NTESTS;
  }
--- 14,18 ----
      use Test;
      use vars qw($NTESTS);
!     $NTESTS = 8;
      plan tests => $NTESTS;
  }
***************
*** 69,70 ****
--- 69,80 ----
  ok scalar(@{$aln_ref}), 2;
  
+ # Test name preservation and restoration:
+ $inputfilename = Bio::Root::IO->catfile("t","data","longnames.aln");
+ $aln = Bio::AlignIO->new(-file=>$inputfilename, -format=>'clustalw')->next_aln;
+ my ($aln_safe, $ref_name) =$aln->set_displayname_safe();
+ $aln_ref = $sb_factory->run($aln_safe);
+ my $first=shift @{$aln_ref};
+ ok $first->get_seq_by_pos(3)->id(), "S000000003", "ailed to  assign serial names";
+ my $aln_restored=$first->restore_displayname($ref_name);
+ ok $aln_restored->get_seq_by_pos(3)->id(), "Smik_Contig1103.1", "fail to restore original names";
+ 



More information about the Bioperl-guts-l mailing list