[Bio] / FigKernelPackages / gjonewicklib.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/gjonewicklib.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19, Tue Apr 13 20:33:16 2010 UTC revision 1.20, Sat Aug 14 23:58:51 2010 UTC
# Line 1  Line 1 
1  # This is a SAS component.  # This is a SAS component.
2    
3  #  #
4  # Copyright (c) 2003-2007 University of Chicago and Fellowship  # Copyright (c) 2003-2010 University of Chicago and Fellowship
5  # for Interpretations of Genomes. All Rights Reserved.  # for Interpretations of Genomes. All Rights Reserved.
6  #  #
7  # This file is part of the SEED Toolkit.  # This file is part of the SEED Toolkit.
# Line 147  Line 147 
147  #  ( $tipref,  $xmax ) = newick_most_distant_tip_ref( $noderef )  #  ( $tipref,  $xmax ) = newick_most_distant_tip_ref( $noderef )
148  #  ( $tipname, $xmax ) = newick_most_distant_tip_name( $noderef )  #  ( $tipname, $xmax ) = newick_most_distant_tip_name( $noderef )
149  #  #
150    #  Provide a standard name by which two trees can be compared for same topology
151    #
152    #  $stdname = std_tree_name( $tree )
153    #
154  #  Tree tip insertion point (tip is on branch of length x that  #  Tree tip insertion point (tip is on branch of length x that
155  #  is inserted into branch connecting node1 and node2, a distance  #  is inserted into branch connecting node1 and node2, a distance
156  #  x1 from node1 and x2 from node2):  #  x1 from node1 and x2 from node2):
# Line 327  Line 331 
331    
332          newick_tip_insertion_point          newick_tip_insertion_point
333    
334          std_newick_name          std_tree_name
335    
336          path_to_tip          path_to_tip
337          path_to_named_node          path_to_named_node
# Line 1653  Line 1657 
1657    
1658    
1659  #-------------------------------------------------------------------------------  #-------------------------------------------------------------------------------
1660    #  Standard name for a Newick tree topology
1661    #
1662    #    $stdname = std_tree_name( $tree )
1663    #
1664    #-------------------------------------------------------------------------------
1665    sub std_tree_name
1666    {
1667        my ( $tree ) = @_;
1668        my ( $mintip ) = sort { lc $a cmp lc $b } newick_tip_list( $tree );
1669        ( std_tree_name_2( reroot_newick_next_to_tip( copy_newick_tree( $tree ), $mintip ) ) )[0];
1670    }
1671    
1672    
1673    #
1674    #  ( $name, $mintip ) = std_tree_name_2( $node )
1675    #
1676    sub std_tree_name_2
1677    {
1678        my ( $node ) = @_;
1679    
1680        my @descends = newick_desc_list( $node );
1681        if ( @descends == 0 )
1682        {
1683            my $lbl = newick_lbl( $node );
1684            return ( $lbl, $lbl );
1685        }
1686    
1687        my @list = sort { lc $a->[1] cmp lc $b->[1] || $a->[1] cmp $b->[1] }
1688                   map  { [ std_tree_name_2( $_ ) ] }
1689                   @descends;
1690        my $mintip = $list[0]->[1];
1691        my $name   = '(' . join( "\t", map { $_->[0] } @list ) . ')';
1692    
1693        return ( $name, $mintip );
1694    }
1695    
1696    
1697    #-------------------------------------------------------------------------------
1698  #  Move largest groups to periphery of tree (in place).  #  Move largest groups to periphery of tree (in place).
1699  #  #
1700  #      dir  <= -2 for up-sweeping tree (big groups always first),  #      dir  <= -2 for up-sweeping tree (big groups always first),

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3