ARB
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
TreeNode Struct Referenceabstract

#include <TreeNode.h>

Inheritance diagram for TreeNode:
Inheritance graph
[legend]
Collaboration diagram for TreeNode:
Collaboration graph
[legend]

Classes

class  LengthCollector
 
struct  multifurc_limits
 

Public Member Functions

bool is_leaf () const
 
void markAsLeaf ()
 
 DEFINE_READ_ACCESSORS (TreeNode *, get_father, father)
 
 DEFINE_READ_ACCESSORS (TreeNode *, get_leftson, leftson)
 
 DEFINE_READ_ACCESSORS (TreeNode *, get_rightson, rightson)
 
bool is_son_of (const TreeNode *Father) const
 
bool is_leftson () const
 
bool is_rightson () const
 
bool is_inside (const TreeNode *subtree) const
 
bool is_ancestor_of (const TreeNode *descendant) const
 
bool in_same_branch_as (const TreeNode *other) const
 
bool in_other_branch_than (const TreeNode *other) const
 
const TreeNodeancestor_common_with (const TreeNode *other) const
 
TreeNodeancestor_common_with (TreeNode *other)
 
bool is_son_of_root () const
 
GBT_LEN get_branchlength () const
 
void set_branchlength (GBT_LEN newlen)
 
GBT_LEN get_branchlength_unrooted () const
 
void set_branchlength_unrooted (GBT_LEN newlen)
 
GBT_LEN sum_child_lengths () const
 
GBT_LEN root_distance () const
 
GBT_LEN intree_distance_to (const TreeNode *other) const
 
void remove_bootstrap ()
 
void reset_branchlengths ()
 
void scale_branchlengths (double factor)
 
void bootstrap2branchlen ()
 
void branchlen2bootstrap ()
 
GBT_RemarkType parse_bootstrap (double &bootstrap) const
 
const charget_remark () const
 
const SmartCharPtr & get_remark_ptr () const
 
bool is_inner_node_with_remark () const
 
void use_as_remark (const SmartCharPtr &newRemark)
 
void set_remark (const char *newRemark)
 
void set_bootstrap (double bootstrap)
 
void remove_remark ()
 
bool has_no_remark () const
 
bool has_valid_root_remarks () const
 
 TreeNode (TreeRoot *root)
 
TreeNodefixDeletedSon ()
 
void unlink_from_DB ()
 
void announce_tree_constructed ()
 
virtual unsigned get_leaf_count () const =0
 
virtual void compute_tree ()=0
 
void forget_origin ()
 
void forget_relatives ()
 
TreeRootget_tree_root () const
 
const TreeNodeget_root_node () const
 
TreeNodeget_root_node ()
 
bool is_root_node () const
 
virtual void set_root ()
 
TreeNodeget_brother ()
 
const TreeNodeget_brother () const
 
bool has_group_info () const
 
TreeNodekeelTarget ()
 
const TreeNodekeelTarget () const
 
bool keelsDownGroup (const TreeNode *toSon) const
 
void unkeelGroup ()
 
int keeledStateInfo () const
 
void setKeeledState (int keeledState)
 
bool is_normal_group () const
 
bool is_keeled_group () const
 
bool is_clade () const
 
const charget_group_name () const
 
const TreeNodefind_parent_with_groupInfo (bool skipKeeledBrothers=false) const
 
TreeNodefind_parent_with_groupInfo (bool skipKeeledBrothers=false)
 
const TreeNodefind_parent_clade () const
 
TreeNodefind_parent_clade ()
 
int calc_clade_level () const
 
int count_clades () const
 
virtual void swap_sons ()
 
void rotate_subtree ()
 
void reorder_tree (TreeOrder mode)
 
TreeNodefindLeafNamed (const char *wantedName)
 
GBT_LEN reset_length_and_bootstrap ()
 
void multifurcate ()
 
void set_branchlength_preserving (GBT_LEN new_len)
 
void multifurcate_whole_tree (const multifurc_limits &below)
 
- Public Member Functions inherited from Noncopyable
 Noncopyable ()
 

Static Public Member Functions

static void destroy (TreeNode *that)
 
static void destroy (TreeNode *that, TreeRoot *root)
 

Public Attributes

TreeNodefather
 
TreeNodeleftson
 
TreeNoderightson
 
GBT_LEN leftlen
 
GBT_LEN rightlen
 
GBDATAgb_node
 
charname
 

Protected Member Functions

TreeNode *& self_ref ()
 
void unlink_from_father ()
 
void swap_node_info (TreeNode *other, bool ofKeeledGroups)
 
void fixKeeledOrientation ()
 
void set_tree_root (TreeRoot *new_root)
 
bool at_root () const
 
virtual ~TreeNode ()
 
void destroy ()
 
void destroy (TreeRoot *viaRoot)
 

Friends

void TreeRoot::change_root (TreeNode *old, TreeNode *newroot)
 

Detailed Description

Definition at line 130 of file TreeNode.h.

Constructor & Destructor Documentation

virtual TreeNode::~TreeNode ( )
inlineprotectedvirtual
TreeNode::TreeNode ( TreeRoot root)
inline

Definition at line 343 of file TreeNode.h.

Member Function Documentation

TreeNode*& TreeNode::self_ref ( )
inlineprotected

Definition at line 151 of file TreeNode.h.

References is_leftson(), leftson, and rightson.

Referenced by unlink_from_father().

void TreeNode::unlink_from_father ( )
inlineprotected

Definition at line 154 of file TreeNode.h.

References NULp, and self_ref().

Referenced by AP_tree::REMOVE(), and ~TreeNode().

void TreeNode::swap_node_info ( TreeNode other,
bool  ofKeeledGroups 
)
inlineprotected

Definition at line 575 of file AP_Tree.cxx.

References fixKeeledOrientation(), gb_assert, gb_node, get_father(), name, and swap().

void TreeNode::fixKeeledOrientation ( )
inlineprotected

Definition at line 162 of file TreeNode.h.

References is_keeled_group(), is_leftson(), and rt_assert.

Referenced by swap_node_info().

bool TreeNode::is_leaf ( ) const
inline

Definition at line 171 of file TreeNode.h.

Referenced by add_bootstrap(), ap_just_tree_rek(), ap_mark_degenerated(), ap_mark_duplicates_rek(), ARB_main(), bootstrap2branchlen(), branchlen2bootstrap(), build_taxonomy_rek(), ARB_seqtree::calcTreeInfo(), collect_contained_groups(), collect_enclosing_groups(), AP_tree::colorize(), FINAL_TYPE< SEQTYPE >::compute_tree(), ARB_seqtree::contains_marked_species(), count_clades(), AP_tree::count_leafs(), countTaxLevel(), AWT_graphic_tree::detect_group_state(), BootstrapConfig::display_node_remark(), export_tree_node_print(), export_tree_node_print_xml(), export_tree_rek(), fill_species_name_array(), SpecSetRegistry::find_best_matches_info(), find_node_with_groupdata(), findLeafNamed(), findNode(), fixDeletedSon(), GBT_count_leafs(), gbt_is_invalid(), GBT_is_invalid(), gbt_link_tree_to_hash_rek(), GBT_remove_leafs(), gbt_rename_tree_rek(), GBT_TREE_order(), gbt_write_tree_nodes(), gbt_write_tree_rek_new(), get_downgroups(), get_group_name(), get_remark(), get_remark_ptr(), Cluster::get_upgroup_info(), AWT_graphic_tree::group_tree(), GroupIterator::GroupIterator(), AP_tree::has_correct_mark_flags(), has_group_info(), has_son(), has_valid_root_remarks(), AP_tree::initial_insert(), is_ancestor_of(), is_clade(), ARB_edge::is_edge_from_leaf(), ARB_edge::is_edge_to_leaf(), is_inner_node_with_remark(), AP_tree::is_inside_folded_group(), SpecSet::is_leaf_set(), is_normal_group(), leafEdge(), left_neighbour_leaf(), link_to_tree(), AP_tree::load_subtree_info(), main(), mapTree(), AWT_graphic_tree::mark_species_in_tree(), AWT_graphic_tree::mark_species_in_tree_that(), ARB_seqtree::mark_subtree(), markAsLeaf(), AP_tree::move_group_to(), AP_tree::moveNextTo(), nt_build_conf_string_rek(), NT_remove_species_in_tree_from_hash(), NT_resort_data_base_by_tree(), parse_bootstrap(), DepthMarker::perform_marking(), GroupSearch::perform_search(), FINAL_TYPE< SEQTYPE >::recalc_marked_from_sons(), SpecSetRegistry::registerTree(), relink_tree_rek(), AP_tree::REMOVE(), remove_bootstrap(), reset_branchlengths(), reset_length_and_bootstrap(), AP_tree::reset_subtree_angles(), AP_tree::reset_subtree_layout(), AP_tree::reset_subtree_linewidths(), AP_tree::reset_subtree_spreads(), rightmost_leaf(), rotate_subtree(), scale_branchlengths(), set_branchlength_preserving(), AP_tree::set_linewidth_recursive(), set_root(), SpeciesInTwoTrees::setSpecies(), BootstrapConfig::shall_show_remark_for(), SQ_calc_and_apply_group_data(), SQ_calc_and_apply_group_data2(), sq_calc_seq_quality_cb(), SQ_check_tree_structure(), sum_child_lengths(), AP_tree::swap_sons(), swap_sons(), AWT_graphic_tree::toggle_group(), trackable_species(), tree2newick(), TREE_export_tree(), AWT_graphic_tree::tree_has_marks(), TREE_load(), TREE_scale(), tree_size_ok(), AP_tree::tree_write_tree_rek(), unlink_from_DB(), AP_tree::update_subtree_information(), use_as_remark(), and NodeTextBuilder::work().

void TreeNode::markAsLeaf ( )
inline

Definition at line 172 of file TreeNode.h.

References is_leaf(), and rt_assert.

Referenced by gbt_read_tree_rek(), and neighbourjoining().

TreeNode::DEFINE_READ_ACCESSORS ( TreeNode ,
get_father  ,
father   
)
TreeNode::DEFINE_READ_ACCESSORS ( TreeNode ,
get_leftson  ,
leftson   
)
TreeNode::DEFINE_READ_ACCESSORS ( TreeNode ,
get_rightson  ,
rightson   
)
bool TreeNode::is_son_of ( const TreeNode Father) const
inline
bool TreeNode::is_leftson ( ) const
inline
bool TreeNode::is_rightson ( ) const
inline
bool TreeNode::is_inside ( const TreeNode subtree) const
inline
bool TreeNode::is_ancestor_of ( const TreeNode descendant) const
inline

Definition at line 201 of file TreeNode.h.

References is_inside(), and is_leaf().

Referenced by ancestor_common_with(), find_parent_clade(), and in_same_branch_as().

bool TreeNode::in_same_branch_as ( const TreeNode other) const
inline

Definition at line 204 of file TreeNode.h.

References is_ancestor_of().

Referenced by find_parent_clade(), and in_other_branch_than().

bool TreeNode::in_other_branch_than ( const TreeNode other) const
inline

Definition at line 208 of file TreeNode.h.

References in_same_branch_as().

const TreeNode * TreeNode::ancestor_common_with ( const TreeNode other) const

Definition at line 765 of file TreeNode.cxx.

References get_father(), and is_ancestor_of().

Referenced by common_ancestor(), and intree_distance_to().

TreeNode* TreeNode::ancestor_common_with ( TreeNode other)
inline

Definition at line 213 of file TreeNode.h.

References ancestor_common_with().

Referenced by ancestor_common_with().

bool TreeNode::is_son_of_root ( ) const
inline

Definition at line 215 of file TreeNode.h.

References father, and is_root_node().

Referenced by AP_tree::insert(), and AP_tree::REMOVE().

GBT_LEN TreeNode::get_branchlength ( ) const
inline
void TreeNode::set_branchlength ( GBT_LEN  newlen)
inline

Definition at line 220 of file TreeNode.h.

References gb_assert, and is_nan_or_inf().

Referenced by set_branchlength_unrooted(), and ARB_edge::set_length().

GBT_LEN TreeNode::get_branchlength_unrooted ( ) const
inline

like get_branchlength, but root-edge is treated correctly

Definition at line 225 of file TreeNode.h.

References get_branchlength(), is_root_node(), leftlen, and rightlen.

Referenced by branchlen2bootstrap(), reset_length_and_bootstrap(), and set_branchlength_preserving().

void TreeNode::set_branchlength_unrooted ( GBT_LEN  newlen)
inline

like set_branchlength, but root-edge is treated correctly

Definition at line 232 of file TreeNode.h.

References is_root_node(), leftlen, rightlen, and set_branchlength().

Referenced by bootstrap2branchlen(), reset_length_and_bootstrap(), and set_branchlength_preserving().

GBT_LEN TreeNode::sum_child_lengths ( ) const

Definition at line 670 of file TreeNode.cxx.

References is_leaf(), leftlen, and rightlen.

GBT_LEN TreeNode::root_distance ( ) const
inline

returns distance from node to root (including nodes own length)

Definition at line 244 of file TreeNode.h.

References get_branchlength(), and root_distance().

Referenced by intree_distance_to(), and root_distance().

GBT_LEN TreeNode::intree_distance_to ( const TreeNode other) const
inline

Definition at line 248 of file TreeNode.h.

References ancestor_common_with(), and root_distance().

Referenced by DI_MATRIX::extract_from_tree().

void TreeNode::remove_bootstrap ( )

Definition at line 644 of file TreeNode.cxx.

References is_leaf().

Referenced by NT_remove_bootstrap().

void TreeNode::reset_branchlengths ( )

Definition at line 651 of file TreeNode.cxx.

References DEFAULT_BRANCH_LENGTH, is_leaf(), leftlen, and rightlen.

Referenced by NT_reset_branchlengths().

void TreeNode::scale_branchlengths ( double  factor)

Definition at line 660 of file TreeNode.cxx.

References is_leaf(), leftlen, and rightlen.

Referenced by NT_scale_tree().

void TreeNode::bootstrap2branchlen ( )

copy bootstraps to branchlengths

Definition at line 679 of file TreeNode.cxx.

References DEFAULT_BRANCH_LENGTH, father, is_leaf(), parse_bootstrap(), REMARK_BOOTSTRAP, and set_branchlength_unrooted().

Referenced by NT_move_boot_branch().

void TreeNode::branchlen2bootstrap ( )

copy branchlengths to bootstraps

Definition at line 702 of file TreeNode.cxx.

References get_branchlength_unrooted(), has_no_remark(), is_leaf(), is_root_node(), remove_remark(), rt_assert, and set_bootstrap().

Referenced by NT_move_boot_branch().

GBT_RemarkType TreeNode::parse_bootstrap ( double &  bootstrap) const
inline
const char* TreeNode::get_remark ( ) const
inline
const SmartCharPtr& TreeNode::get_remark_ptr ( ) const
inline
bool TreeNode::is_inner_node_with_remark ( ) const
inline

Definition at line 274 of file TreeNode.h.

References get_remark_ptr(), and is_leaf().

Referenced by gbt_read_tree_rek().

void TreeNode::use_as_remark ( const SmartCharPtr &  newRemark)
inline
void TreeNode::set_remark ( const char newRemark)
inline

Definition at line 279 of file TreeNode.h.

References use_as_remark().

Referenced by SpecSetRegistry::find_best_matches_info(), and gbt_read_tree_rek().

void TreeNode::set_bootstrap ( double  bootstrap)
inline

Definition at line 282 of file TreeNode.h.

References GBS_global_string_copy(), and use_as_remark().

Referenced by add_bootstrap(), branchlen2bootstrap(), and TREE_scale().

void TreeNode::remove_remark ( )
inline
bool TreeNode::has_no_remark ( ) const
inline
bool TreeNode::has_valid_root_remarks ( ) const
void TreeNode::set_tree_root ( TreeRoot new_root)
protected

Definition at line 84 of file TreeNode.cxx.

References leftson, and rightson.

Referenced by TreeRoot::change_root(), forget_origin(), AP_tree::initial_insert(), and AP_tree::insert().

bool TreeNode::at_root ( ) const
inlineprotected

return true for root-node and its sons

Definition at line 308 of file TreeNode.h.

References father.

Referenced by set_root().

void TreeNode::destroy ( )
inlineprotected

Definition at line 327 of file TreeNode.h.

References TreeRoot::destroyNode(), get_tree_root(), knownNonNull(), and rt_assert.

Referenced by destroy(), destroy(), and AP_tree::REMOVE().

void TreeNode::destroy ( TreeRoot viaRoot)
inlineprotected

Definition at line 333 of file TreeNode.h.

References TreeRoot::destroyNode(), get_tree_root(), knownNonNull(), and rt_assert.

static void TreeNode::destroy ( TreeNode that)
inlinestatic

Definition at line 353 of file TreeNode.h.

References destroy().

static void TreeNode::destroy ( TreeNode that,
TreeRoot root 
)
inlinestatic

Definition at line 356 of file TreeNode.h.

References destroy().

TreeNode * TreeNode::fixDeletedSon ( )
void TreeNode::unlink_from_DB ( )

Unlink tree from the database.

See also
GBT_link_tree()

Definition at line 930 of file adtree.cxx.

References gb_node, is_leaf(), and NULp.

Referenced by GBT_unlink_tree().

void TreeNode::announce_tree_constructed ( )
inline

Definition at line 364 of file TreeNode.h.

References TreeRoot::change_root(), gb_assert, get_tree_root(), and NULp.

Referenced by GBT_read_tree_and_size(), and TreeReader::load().

virtual unsigned TreeNode::get_leaf_count ( ) const
pure virtual
virtual void TreeNode::compute_tree ( )
pure virtual
void TreeNode::forget_origin ( )
inline

Definition at line 373 of file TreeNode.h.

References NULp, and set_tree_root().

Referenced by fixDeletedSon(), GBT_remove_leafs(), and AP_tree::REMOVE().

void TreeNode::forget_relatives ( )
inline

Definition at line 374 of file TreeNode.h.

References NULp.

Referenced by fixDeletedSon(), and GBT_remove_leafs().

TreeRoot* TreeNode::get_tree_root ( ) const
inline
const TreeNode* TreeNode::get_root_node ( ) const
inline
TreeNode* TreeNode::get_root_node ( )
inline

Definition at line 389 of file TreeNode.h.

References get_root_node().

Referenced by get_root_node().

bool TreeNode::is_root_node ( ) const
inline
void TreeNode::set_root ( )
virtual

set the root at parent edge of this pointers to tree-nodes remain valid, but all parent-nodes of this change their meaning (afterwards they will point to [father+brother] instead of [this+brother]) esp. pointers to the root-node will still point to the root-node (which only changed children)

Reimplemented in FINAL_TYPE< SEQTYPE >.

Definition at line 206 of file TreeNode.cxx.

References at_root(), father, get_father(), POS_TREE1::get_father(), get_remark_ptr(), get_root_node(), has_valid_root_remarks(), is_inside(), is_leaf(), leftlen, leftson, rightlen, rightson, rt_assert, and swap().

Referenced by ST_ML::get_ml_vectors(), nt_add(), NTREE_move_tree_info(), randomMixTree(), and ARB_edge::set_root().

TreeNode* TreeNode::get_brother ( )
inline
const TreeNode* TreeNode::get_brother ( ) const
inline

Definition at line 399 of file TreeNode.h.

References get_brother().

bool TreeNode::has_group_info ( ) const
inline
TreeNode* TreeNode::keelTarget ( )
inline
const TreeNode* TreeNode::keelTarget ( ) const
inline

Definition at line 410 of file TreeNode.h.

References keelTarget().

bool TreeNode::keelsDownGroup ( const TreeNode toSon) const
inline

Definition at line 413 of file TreeNode.h.

References keelTarget().

Referenced by Group::at_node(), and is_keeled_group().

void TreeNode::unkeelGroup ( )
inline

Definition at line 417 of file TreeNode.h.

References keelTarget(), and rt_assert.

Referenced by AWT_graphic_tree::toggle_group().

int TreeNode::keeledStateInfo ( ) const
inline

Definition at line 421 of file TreeNode.h.

Referenced by gbt_write_tree_nodes().

void TreeNode::setKeeledState ( int  keeledState)
inline

Definition at line 424 of file TreeNode.h.

Referenced by gbt_read_tree_rek().

bool TreeNode::is_normal_group ( ) const
inline
bool TreeNode::is_keeled_group ( ) const
inline
bool TreeNode::is_clade ( ) const
inline
const char* TreeNode::get_group_name ( ) const
inline

Definition at line 445 of file TreeNode.h.

References is_keeled_group(), is_leaf(), is_normal_group(), name, and NULp.

Referenced by get_downgroups(), and get_upgroup().

const TreeNode* TreeNode::find_parent_with_groupInfo ( bool  skipKeeledBrothers = false) const
inline
TreeNode* TreeNode::find_parent_with_groupInfo ( bool  skipKeeledBrothers = false)
inline

Definition at line 470 of file TreeNode.h.

References find_parent_with_groupInfo().

const TreeNode* TreeNode::find_parent_clade ( ) const
inline
TreeNode* TreeNode::find_parent_clade ( )
inline

Definition at line 500 of file TreeNode.h.

References find_parent_clade().

int TreeNode::calc_clade_level ( ) const
inline

Definition at line 503 of file TreeNode.h.

References calc_clade_level(), find_parent_clade(), and is_clade().

Referenced by calc_clade_level(), and GroupIterator::get_clade_level().

int TreeNode::count_clades ( ) const

Definition at line 772 of file TreeNode.cxx.

References is_clade(), and is_leaf().

Referenced by NTREE_move_tree_info().

virtual void TreeNode::swap_sons ( )
inlinevirtual

Reimplemented in AP_tree, and FINAL_TYPE< SEQTYPE >.

Definition at line 512 of file TreeNode.h.

References is_leaf(), rt_assert, and swap().

Referenced by rotate_subtree(), and AP_tree::swap_sons().

void TreeNode::rotate_subtree ( )

Definition at line 164 of file TreeNode.cxx.

References is_leaf(), and swap_sons().

void TreeNode::reorder_tree ( TreeOrder  mode)

beautify tree (does not change topology, only swaps branches)

Definition at line 157 of file TreeNode.cxx.

References compute_tree().

Referenced by AWT_graphic_tree::reorderTree().

TreeNode * TreeNode::findLeafNamed ( const char wantedName)

Definition at line 274 of file TreeNode.cxx.

References findLeafNamed(), is_leaf(), name, and NULp.

Referenced by findLeafNamed(), and NT_jump_cb().

GBT_LEN TreeNode::reset_length_and_bootstrap ( )
inline

remove remark + zero but return branchlen

Definition at line 524 of file TreeNode.h.

References get_branchlength_unrooted(), is_leaf(), remove_remark(), and set_branchlength_unrooted().

Referenced by ARB_edge::eliminate().

void TreeNode::multifurcate ( )

eliminate branch from 'this' to 'father' (or brother @ root)

See also
ARB_edge::multifurcate()

Definition at line 588 of file TreeNode.cxx.

References father, ARB_edge::multifurcate(), parentEdge(), and rt_assert.

Referenced by set_branchlength_preserving().

void TreeNode::set_branchlength_preserving ( GBT_LEN  new_len)

set branchlength to 'new_len' while preserving overall distance in tree.

Always works on unrooted tree (i.e. lengths @ root are treated correctly). Length is preserved as in multifurcate()

Definition at line 596 of file TreeNode.cxx.

References get_branchlength_unrooted(), get_remark(), has_no_remark(), is_leaf(), multifurcate(), NULp, rt_assert, set_branchlength_unrooted(), and use_as_remark().

void TreeNode::multifurcate_whole_tree ( const multifurc_limits below)

multifurcate all branches specified by 'below'

  • step 1: eliminate all branches, store eliminated lengths
  • step 2: calculate length distribution for all adjacent branches (proportionally to original length of each branch)
  • step 3: apply distributed length

Definition at line 623 of file TreeNode.cxx.

References get_root_node(), TreeNode::LengthCollector::independent_distribution(), and arb_progress::subtitle().

Referenced by NT_multifurcate_tree().

Friends And Related Function Documentation

void TreeRoot::change_root ( TreeNode old,
TreeNode newroot 
)
friend

Member Data Documentation

TreeNode* TreeNode::father
TreeNode * TreeNode::leftson
TreeNode * TreeNode::rightson
GBT_LEN TreeNode::leftlen
GBT_LEN TreeNode::rightlen
GBDATA* TreeNode::gb_node
char* TreeNode::name

The documentation for this struct was generated from the following files: