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

Gabriel Valiente valiente at pub.open-bio.org
Sat Sep 3 08:40:19 EDT 2005


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

Modified Files:
	Node.pm 
Log Message:
bug fixes for node height


Index: Node.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/Bio/Tree/Node.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** Node.pm	5 Jul 2005 12:08:38 -0000	1.38
--- Node.pm	3 Sep 2005 12:40:17 -0000	1.39
***************
*** 497,501 ****
   Usage   : my $len = $node->height
   Function: Returns the height of the tree starting at this
!            node.  Height is the maximum branchlength.
   Returns : The longest length (weighting branches with branch_length) to a leaf
   Args    : none
--- 497,501 ----
   Usage   : my $len = $node->height
   Function: Returns the height of the tree starting at this
!            node.  Height is the maximum branchlength to get to the tip.
   Returns : The longest length (weighting branches with branch_length) to a leaf
   Args    : none
***************
*** 505,509 ****
  sub height { 
      my ($self) = @_;
! 
      return $self->{'_height'} if( defined $self->{'_height'} );
      
--- 505,509 ----
  sub height { 
      my ($self) = @_;
!     
      return $self->{'_height'} if( defined $self->{'_height'} );
      
***************
*** 512,523 ****
      my $max = 0;
      foreach my $subnode ( $self->each_Descendent ) { 
! 	my $s = $subnode->height;
  	if( $s > $max ) { $max = $s; }
      }
!     my $bl = $self->branch_length;
!     $bl = 1 unless (defined $bl && $bl =~ /^\-?\d+(\.\d+)?$/);
!    return ($self->{'_height'} = $max + $bl);
  }
- 
  
  =head2 invalidate_height
--- 512,522 ----
      my $max = 0;
      foreach my $subnode ( $self->each_Descendent ) { 
! 	my $bl = $subnode->branch_length;
! 	$bl = 1 unless (defined $bl && $bl =~ /^\-?\d+(\.\d+)?$/);
! 	my $s = $subnode->height + $bl;
  	if( $s > $max ) { $max = $s; }
      }
!     return ($self->{'_height'} = $max);
  }
  
  =head2 invalidate_height



More information about the Bioperl-guts-l mailing list