[Bioperl-guts-l] bioperl-live/Bio/Tree Node.pm,1.39,1.40

Jason Stajich jason at pub.open-bio.org
Mon Sep 5 15:19:17 EDT 2005


Update of /home/repository/bioperl/bioperl-live/Bio/Tree
In directory pub.open-bio.org:/tmp/cvs-serv32559/Bio/Tree

Modified Files:
	Node.pm 
Log Message:
join two nodes into one if node only has one child: per bug from Niv Sabath


Index: Node.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/Bio/Tree/Node.pm,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** Node.pm	3 Sep 2005 12:40:17 -0000	1.39
--- Node.pm	5 Sep 2005 19:19:15 -0000	1.40
***************
*** 232,247 ****
  	   $self->{'_desc'}->{$n->internal_id}->ancestor(undef);
  	   delete $self->{'_desc'}->{$n->internal_id};
- 	   my $a1 = $self->ancestor;
- 	   # remove unecessary nodes if we have removed the part 
- 	   # which branches.
- 	   # if( $a1 ) {
- 	   #    my $bl = $self->branch_length || 0;
- 	   #    my @d = $self->each_Descendent;
- 	   #    if (scalar @d == 1) {
- 	   #	   $d[0]->branch_length($bl + ($d[0]->branch_length || 0));
- 	   #	   $a1->add_Descendent($d[0]);
- 	   #    }
- 	   #    $a1->remove_Descendent($self);
- 	   #}
  	   $c++;
         } else { 
--- 232,235 ----
***************
*** 250,253 ****
--- 238,253 ----
  	       $self->debug("Descendents are " . join(',', keys %{$self->{'_desc'}})."\n");
  	   }
+        }
+    }
+    # remove unecessary nodes if we have removed the part 
+    # which branches.
+    my $a1 = $self->ancestor;   
+    if( $a1 ) {
+        my $bl = $self->branch_length || 0;
+        my @d = $self->each_Descendent;
+        if (scalar @d == 1) {
+ 	   $d[0]->branch_length($bl + ($d[0]->branch_length || 0));
+ 	   $a1->add_Descendent($d[0]);	       
+ 	   $a1->remove_Descendent($self);
         }
     }



More information about the Bioperl-guts-l mailing list