[Bioperl-guts-l] bioperl-run/Bio/Tools/Run/Phylo/Phylip SeqBoot.pm, 1.12, 1.13 ProtPars.pm, 1.24, 1.25 ProtDist.pm, 1.30, 1.31 Consense.pm, 1.14, 1.15 Neighbor.pm, 1.27, 1.28

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


Update of /home/repository/bioperl/bioperl-run/Bio/Tools/Run/Phylo/Phylip
In directory dev.open-bio.org:/tmp/cvs-serv1917

Modified Files:
	SeqBoot.pm ProtPars.pm ProtDist.pm Consense.pm Neighbor.pm 
Log Message:
POD change: add paragraph on protecting long sequence names

Index: ProtDist.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/Bio/Tools/Run/Phylo/Phylip/ProtDist.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** ProtDist.pm	4 Jul 2006 22:23:33 -0000	1.30
--- ProtDist.pm	12 Jan 2007 22:26:56 -0000	1.31
***************
*** 46,49 ****
--- 46,64 ----
    my ($matrix)  = $protdist_factory->run('/home/shawnh/prot.phy');
  
+   # To prevent PHYLIP from truncating sequence names:
+   # Step 1. Shelf the original names:
+     my ($aln_safe, $ref_name)=                    #   $aln_safe has serial names
+                $aln->set_displayname_safe();      #   $ref_name holds original names
+   # Step 2. Run ProtDist and Neighbor:
+     ($matrix) = $protdist_factory->
+                create_distance_matrix($aln_safe); #  Use $aln_safe instead of $aln
+     ($tree) = $neighbor_factory->run($matrix);
+   # Step 3. Retrieve orgininal OTU names:
+     use Bio::Tree::Tree;
+     my @nodes=$tree->get_nodes();
+     foreach my $nd (@nodes){
+        $nd->id($ref_name->{$nd->id_output}) if $nd->is_Leaf;
+     }
+ 
  =head1 DESCRIPTION
  

Index: Neighbor.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/Bio/Tools/Run/Phylo/Phylip/Neighbor.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Neighbor.pm	4 Jul 2006 22:23:33 -0000	1.27
--- Neighbor.pm	12 Jan 2007 22:26:56 -0000	1.28
***************
*** 58,61 ****
--- 58,77 ----
    my ($tree) = $neighbor_factory->run('/home/shawnh/prot.dist');
  
+   # To prevent PHYLIP from truncating sequence names:
+   # Step 1. Shelf the original names:
+     my ($aln_safe, $ref_name)=                    #   $aln_safe has serial names
+                $aln->set_displayname_safe();      #   $ref_name holds original names
+   # Step 2. Run ProtDist and Neighbor:
+     $matrix  = $protdist_factory->
+                 creat_distance_matrix($aln_safe); #  Use $aln_safe instead of $aln
+     $tree = $neighbor_factory->run($matrix);
+   # Step 3. Retrieve orgininal OTU names:
+     use Bio::Tree::Tree;
+     my @nodes=$tree->get_nodes();
+     foreach my $nd (@nodes){
+        $nd->id($ref_name->{$nd->id_output}) if $nd->is_Leaf;
+     }
+ 
+ 
  =head1 PARAMTERS FOR NEIGHBOR COMPUTATION
  

Index: SeqBoot.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/Bio/Tools/Run/Phylo/Phylip/SeqBoot.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** SeqBoot.pm	4 Jul 2006 22:23:33 -0000	1.12
--- SeqBoot.pm	12 Jan 2007 22:26:56 -0000	1.13
***************
*** 33,36 ****
--- 33,51 ----
    }
  
+   # To prevent PHYLIP from truncating sequence names:
+   # Step 1. Shelf the original names:
+   my ($aln_safe, $ref_name)=                  #  $aln_safe has serial names
+              $aln->set_displayname_safe();    #  $ref_name holds orginal names 
+   # Step 2. Run PHYLIP programs:
+   $aln_ref = $seq->run($aln_safe);            #  Use $aln_safe instead of $aln
+   # Step 3. Retrieve orgininal names
+   $aio = Bio::AlignIO->new(
+              -file=>">alignment.bootstrap",
+              -format=>"fasta");               #  FASTA output to view full names
+   foreach my $ai(@{$aln_ref}){
+          my $new_aln=$ai->restore_displayname($ref_name); #  Restore names
+          $aio->write_aln($new_aln);
+   }
+ 
  =head1 DESCRIPTION
  

Index: Consense.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/Bio/Tools/Run/Phylo/Phylip/Consense.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Consense.pm	4 Jul 2006 22:23:33 -0000	1.14
--- Consense.pm	12 Jan 2007 22:26:56 -0000	1.15
***************
*** 28,31 ****
--- 28,34 ----
    my $aln = $aio->next_aln;
  
+   # To prevent truncation of sequence names by PHYLIP runs, use set_displayname_safe
+   my ($aln_safe, $ref_name)=$aln->set_displayname_safe();
+ 
    #next use seqboot to generate multiple aligments
    my @params = ('datatype'=>'SEQUENCE','replicates'=>10);
***************
*** 34,37 ****
--- 37,44 ----
    my $aln_ref= $seqboot_factory->run($aln);
  
+   Or, for long sequence names:
+ 
+   my $aln_ref= $seqboot_factory->run($aln_safe);
+ 
    #next build distance matrices and construct trees
    my $pd_factory = Bio::Tools::Run::Phylo::Phylip::ProtDist->new();
***************
*** 54,57 ****
--- 61,70 ----
    my $tree = $con_factory->run(\@tree);
  
+   # Restore original sequence names, after ALL phylip runs:
+   my @nodes = $tree->get_nodes();
+   foreach my $nd (@nodes){
+      $nd->id($ref_name->{$nd->id_output}) if $nd->is_Leaf;
+   }
+ 
    #now draw the tree
    my $draw_factory = Bio::Tools::Run::Phylo::Phylip::DrawTree->new();

Index: ProtPars.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-run/Bio/Tools/Run/Phylo/Phylip/ProtPars.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** ProtPars.pm	4 Jul 2006 22:23:33 -0000	1.24
--- ProtPars.pm	12 Jan 2007 22:26:56 -0000	1.25
***************
*** 38,41 ****
--- 38,54 ----
    $tree = $tree_factory->run("/usr/users/shawnh/COMPARA/prot.phy");
  
+   # To prevent PHYLIP from truncating sequence names:
+   # Step 1. Shelf the original names:
+      my ($aln_safe, $ref_name)=                    #   $aln_safe has serial names
+                 $aln->set_displayname_safe();      #   $ref_name holds original names
+   # Step 2. Run ProtPars:
+      $tree = $protpars_factory->run($aln_safe);    #  Use $aln_safe instead of $aln
+   # Step 3. Retrieve orgininal OTU names:
+      use Bio::Tree::Tree;
+      my @nodes=$tree->get_nodes();
+          foreach my $nd (@nodes){
+             $nd->id($ref_name->{$nd->id_output}) if $nd->is_Leaf;
+          }
+ 
  =head1 PARAMTERS FOR PROTPARS COMPUTATION
  
***************
*** 118,122 ****
  =cut
  
- #'
  
  	
--- 131,134 ----



More information about the Bioperl-guts-l mailing list