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
Collaboration diagram for TreeNode:
Collaboration graph


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 ()
GB_ERROR apply_aci_to_remarks (const char *aci, const GBL_call_env &callEnv)
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

GBT_LEN leftlen
GBT_LEN rightlen

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)


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

Detailed Description

Definition at line 170 of file TreeNode.h.

Constructor & Destructor Documentation

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

Definition at line 384 of file TreeNode.h.

Member Function Documentation

TreeNode*& TreeNode::self_ref ( )

Definition at line 191 of file TreeNode.h.

References is_leftson(), leftson, and rightson.

Referenced by unlink_from_father().

void TreeNode::unlink_from_father ( )

Definition at line 194 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 

Definition at line 575 of file AP_Tree.cxx.

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

void TreeNode::fixKeeledOrientation ( )

Definition at line 202 of file TreeNode.h.

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

Referenced by swap_node_info().

bool TreeNode::is_leaf ( ) const

Definition at line 211 of file TreeNode.h.

Referenced by add_bootstrap(), ap_just_tree_rek(), ap_mark_degenerated(), ap_mark_duplicates_rek(), apply_aci_to_remarks(), 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_seq_quality_cb(), SQ_check_tree_structure(), SQ_pass1_on_tree(), SQ_pass2_on_tree(), 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 ( )

Definition at line 212 of file TreeNode.h.

References is_leaf(), and rt_assert.

Referenced by gbt_read_tree_rek(), and neighbourjoining().

get_father  ,
get_leftson  ,
get_rightson  ,
bool TreeNode::is_son_of ( const TreeNode Father) const
bool TreeNode::is_leftson ( ) const
bool TreeNode::is_rightson ( ) const
bool TreeNode::is_inside ( const TreeNode subtree) const
bool TreeNode::is_ancestor_of ( const TreeNode descendant) const

Definition at line 241 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

Definition at line 244 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

Definition at line 248 of file TreeNode.h.

References in_same_branch_as().

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

Definition at line 792 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)

Definition at line 253 of file TreeNode.h.

References ancestor_common_with().

Referenced by ancestor_common_with().

bool TreeNode::is_son_of_root ( ) const

Definition at line 255 of file TreeNode.h.

References father, and is_root_node().

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

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

Definition at line 260 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

like get_branchlength, but root-edge is treated correctly

Definition at line 265 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)

like set_branchlength, but root-edge is treated correctly

Definition at line 272 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 697 of file TreeNode.cxx.

References is_leaf(), leftlen, and rightlen.

GBT_LEN TreeNode::root_distance ( ) const

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

Definition at line 284 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

Definition at line 288 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().

GB_ERROR TreeNode::apply_aci_to_remarks ( const char aci,
const GBL_call_env callEnv 

Definition at line 652 of file TreeNode.cxx.

References error(), GB_await_error(), GB_command_interpreter_in_env(), GBS_trim(), is_leaf(), and NULp.

Referenced by NT_edit_bootstrap().

void TreeNode::reset_branchlengths ( )

Definition at line 678 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 687 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 706 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 729 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
const char* TreeNode::get_remark ( ) const
const SmartCharPtr& TreeNode::get_remark_ptr ( ) const
bool TreeNode::is_inner_node_with_remark ( ) const

Definition at line 315 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)
void TreeNode::set_remark ( const char newRemark)

Definition at line 320 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)

Definition at line 323 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 ( )
bool TreeNode::has_no_remark ( ) const
bool TreeNode::has_valid_root_remarks ( ) const
void TreeNode::set_tree_root ( TreeRoot new_root)

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

return true for root-node and its sons

Definition at line 349 of file TreeNode.h.

References father.

Referenced by set_root().

void TreeNode::destroy ( )

Definition at line 368 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)

Definition at line 374 of file TreeNode.h.

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

static void TreeNode::destroy ( TreeNode that)

Definition at line 394 of file TreeNode.h.

References destroy().

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

Definition at line 397 of file TreeNode.h.

References destroy().

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

Unlink tree from the database.

See also

Definition at line 976 of file adtree.cxx.

References gb_node, is_leaf(), and NULp.

Referenced by GBT_unlink_tree().

void TreeNode::announce_tree_constructed ( )

Definition at line 405 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 ( )

Definition at line 414 of file TreeNode.h.

References NULp, and set_tree_root().

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

void TreeNode::forget_relatives ( )

Definition at line 415 of file TreeNode.h.

References NULp.

Referenced by fixDeletedSon(), and GBT_remove_leafs().

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

Definition at line 430 of file TreeNode.h.

References get_root_node().

Referenced by get_root_node().

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

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 ( )
const TreeNode* TreeNode::get_brother ( ) const

Definition at line 440 of file TreeNode.h.

References get_brother().

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

Definition at line 451 of file TreeNode.h.

References keelTarget().

bool TreeNode::keelsDownGroup ( const TreeNode toSon) const

Definition at line 454 of file TreeNode.h.

References keelTarget().

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

void TreeNode::unkeelGroup ( )

Definition at line 458 of file TreeNode.h.

References keelTarget(), and rt_assert.

Referenced by AWT_graphic_tree::toggle_group().

int TreeNode::keeledStateInfo ( ) const

Definition at line 462 of file TreeNode.h.

Referenced by gbt_write_tree_nodes().

void TreeNode::setKeeledState ( int  keeledState)

Definition at line 465 of file TreeNode.h.

Referenced by gbt_read_tree_rek().

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

Definition at line 486 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
TreeNode* TreeNode::find_parent_with_groupInfo ( bool  skipKeeledBrothers = false)

Definition at line 511 of file TreeNode.h.

References find_parent_with_groupInfo().

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

Definition at line 541 of file TreeNode.h.

References find_parent_clade().

int TreeNode::calc_clade_level ( ) const

Definition at line 544 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 799 of file TreeNode.cxx.

References is_clade(), and is_leaf().

Referenced by NTREE_move_tree_info().

virtual void TreeNode::swap_sons ( )

Reimplemented in AP_tree, and FINAL_TYPE< SEQTYPE >.

Definition at line 553 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 ( )

remove remark + zero but return branchlen

Definition at line 565 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

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 

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: