ARB
|
#include <arb_progress.h>
#include "gb_local.h"
#include <arb_strarray.h>
#include <set>
#include <limits.h>
#include <arb_global_defs.h>
#include <arb_strbuf.h>
#include <arb_diff.h>
#include <arb_defs.h>
#include <arb_match.h>
#include <arb_msg_nospam.h>
#include "TreeNode.h"
Go to the source code of this file.
Classes | |
struct | link_tree_data |
struct | indexed_name |
Macros | |
#define | GBT_PUT_DATA 1 |
#define | GBT_GET_SIZE 0 |
#define GBT_PUT_DATA 1 |
Definition at line 24 of file adtree.cxx.
Referenced by gbt_write_tree(), and gbt_write_tree_rek_new().
#define GBT_GET_SIZE 0 |
Definition at line 25 of file adtree.cxx.
Referenced by gbt_write_tree().
Definition at line 27 of file adtree.cxx.
References GBT_find_or_create().
Referenced by awt_create_TREE_selection_list(), ensure_trees_have_order(), GBT_check_data(), GBT_find_bottom_tree(), GBT_find_top_tree(), GBT_find_tree(), GBT_get_tree_names(), gbt_write_tree(), get_first_tree(), reorder_trees_cb(), and transfer_tree().
TreeNode* GBT_remove_leafs | ( | TreeNode * | tree, |
GBT_TreeRemoveType | mode, | ||
const GB_HASH * | species_hash, | ||
int * | removed, | ||
int * | groups_removed | ||
) |
Remove leafs from given 'tree'.
tree | tree from which species will be removed |
mode | defines what to remove |
species_hash | hash translation from leaf-name to species-dbnode (not needed if tree is linked; see GBT_link_tree) |
removed | will be incremented for each removed leaf (if !NULp) |
groups_removed | will be incremented for each removed group (if !NULp) |
if 'species_hash' is not provided and tree is not linked, the function will silently act strange:
Definition at line 34 of file adtree.cxx.
References destroy(), TreeNode::fixDeletedSon(), TreeNode::forget_origin(), TreeNode::forget_relatives(), gb_assert, TreeNode::gb_node, GB_read_flag(), GBS_read_hash(), GBT_REMOVE_MARKED, GBT_REMOVE_UNMARKED, GBT_REMOVE_ZOMBIES, TreeNode::get_tree_root(), TreeNode::is_leaf(), TreeNode::is_root_node(), TreeNode::leftson, TreeNode::name, NULp, TreeNode::rightson, and tree.
Referenced by NT_alltree_remove_leafs(), and sq_calc_seq_quality_cb().
Definition at line 113 of file adtree.cxx.
References gb_assert, GB_entry(), and GB_read_int().
Referenced by ensure_trees_have_order(), GBT_copy_tree(), GBT_get_tree_names(), GBT_move_tree(), GBT_tree_behind(), GBT_tree_infrontof(), get_max_tree_idx(), get_tree_behind_idx(), get_tree_infrontof_idx(), get_tree_with_idx(), and tree_set_default_order().
Definition at line 123 of file adtree.cxx.
References GB_child(), GB_nextChild(), and get_tree_idx().
Referenced by ensure_trees_have_order(), and tree_set_default_order().
Definition at line 132 of file adtree.cxx.
References GB_child(), GB_nextChild(), get_tree_idx(), and NULp.
Referenced by GBT_find_top_tree(), and reserve_tree_idx().
Definition at line 143 of file adtree.cxx.
References gb_assert, GB_child(), GB_nextChild(), get_tree_idx(), and NULp.
Referenced by GBT_find_bottom_tree(), and GBT_tree_infrontof().
Definition at line 159 of file adtree.cxx.
References gb_assert, GB_child(), GB_nextChild(), get_tree_idx(), and NULp.
Referenced by GBT_find_top_tree(), and GBT_tree_behind().
Definition at line 175 of file adtree.cxx.
References error(), GB_await_error(), GB_create(), GB_entry(), GB_INT, GB_write_int(), and NULp.
Referenced by ensure_trees_have_order(), GBT_copy_tree(), GBT_get_tree_names(), GBT_move_tree(), reserve_tree_idx(), and tree_set_default_order().
Definition at line 186 of file adtree.cxx.
References error(), get_tree_with_idx(), NULp, and set_tree_idx().
Referenced by GBT_copy_tree(), GBT_get_tree_names(), and GBT_move_tree().
|
static |
Definition at line 196 of file adtree.cxx.
References error(), gb_assert, GB_await_error(), GB_child(), GB_get_father(), GB_get_root(), GB_INT, gb_main, GB_nextChild(), GB_read_int(), GB_search(), GB_write_int(), GBK_terminatef(), GBT_get_tree_data(), get_max_tree_idx(), get_tree_idx(), NULp, and set_tree_idx().
Referenced by GBT_find_bottom_tree(), GBT_find_top_tree(), GBT_get_tree_names(), GBT_move_tree(), GBT_tree_behind(), and GBT_tree_infrontof().
|
static |
Definition at line 220 of file adtree.cxx.
References GB_get_father(), get_max_tree_idx(), get_tree_idx(), and set_tree_idx().
Referenced by gbt_write_tree().
GB_ERROR GBT_write_group_name | ( | GBDATA * | gb_group_name, |
const char * | new_group_name, | ||
bool | pedantic | ||
) |
Definition at line 230 of file adtree.cxx.
References GBS_strstruct::cat(), GBS_strstruct::cat_sQuoted(), error(), gb_assert, GB_GROUP_NAME_MAX, GB_read_key_pntr(), GB_warningf(), GB_write_string(), GBS_global_string(), GBS_static_string(), GBS_strstruct::get_data(), KEELED_INDICATOR, label, GBS_strstruct::nprintf(), NULp, and parse_treelabel().
Referenced by gbt_read_tree_rek(), GBT_write_name_to_groupData(), gbt_write_tree_nodes(), FoundGroup::rename_by_ACI(), and SpecSetRegistry::write_node_information().
GB_ERROR GBT_write_name_to_groupData | ( | GBDATA * | gb_group, |
bool | createNameEntry, | ||
const char * | new_group_name, | ||
bool | pedantic | ||
) |
Definition at line 325 of file adtree.cxx.
References GB_await_error(), GB_FIND, GB_search(), GB_STRING, and GBT_write_group_name().
Referenced by AWT_graphic_tree::toggle_group(), and GroupBuilder::update_group().
Definition at line 332 of file adtree.cxx.
References error(), GB_await_error(), GB_child(), GB_clear_user_flag(), GB_create_container(), GB_delete(), GB_FIND, GB_have_error(), GB_INT, GB_nextChild(), TreeNode::gb_node, GB_read_key_pntr(), GB_search(), GB_STRING, GB_USERFLAG_GHOSTNODE, GB_write_int(), GBT_write_group_name(), GBT_write_int(), TreeNode::is_leaf(), TreeNode::keeledStateInfo(), TreeNode::name, and NULp.
Referenced by gbt_write_tree().
Definition at line 386 of file adtree.cxx.
References buffer, gb_assert, GBT_PUT_DATA, TreeNode::get_remark(), TreeNode::has_no_remark(), TreeNode::is_leaf(), TreeNode::leftlen, TreeNode::name, and TreeNode::rightlen.
Referenced by gbt_write_tree().
|
static |
writes a tree to the database.
If tree is loaded by function GBT_read_tree(..) then 'tree_name' should be NULp else 'gb_tree' should be set to NULp
To copy a tree call GBT_copy_tree() or copy_tree_container() or set recursively all tree->gb_node variables to zero (that unlinks the tree),
Definition at line 441 of file adtree.cxx.
References error(), GB_allow_compression(), gb_assert, GB_await_error(), GB_CREATE_CONTAINER, GB_delete(), GB_entry(), GB_nextEntry(), GB_raise_user_flag(), GB_search(), GB_user_flag(), GB_USERFLAG_GHOSTNODE, GBS_global_string(), GBT_check_tree_name(), GBT_GET_SIZE, GBT_get_tree_data(), GBT_PUT_DATA, GBT_write_int(), GBT_write_string(), gbt_write_tree_nodes(), gbt_write_tree_rek_new(), NULp, and tree_set_default_order().
Referenced by GBT_overwrite_tree(), and GBT_write_tree().
Definition at line 523 of file adtree.cxx.
References gbt_write_tree(), and NULp.
Referenced by ARB_main(), compress_sequence_tree(), di_calculate_tree_cb(), GBT_commit_rename_session(), GBT_write_tree_with_remark(), main(), NT_alltree_remove_leafs(), and AP_tree_root::saveToDB().
Definition at line 526 of file adtree.cxx.
References GB_get_root(), gbt_write_tree(), and NULp.
Referenced by adjustTreeRoot(), NTREE_move_tree_info(), and ARB_seqtree_root::saveToDB().
Definition at line 530 of file adtree.cxx.
References GBT_write_string().
Referenced by GBT_log_to_tree_remark(), and GBT_write_tree_remark().
Definition at line 533 of file adtree.cxx.
References GBT_find_tree(), and write_tree_remark().
Referenced by di_calculate_tree_cb(), GBT_write_tree_with_remark(), and main().
append 'log_entry' to tree comment
gb_tree | the tree |
log_entry | text to append |
stamp | true -> prefix date before 'log_entry' |
Definition at line 537 of file adtree.cxx.
References error(), GB_await_error(), GB_have_error(), GBS_log_action_to(), GBT_read_char_pntr(), NULp, and write_tree_remark().
Referenced by adjustTreeRoot(), GBT_log_to_named_trees_remark(), and NTREE_move_tree_info().
GB_ERROR GBT_log_to_named_trees_remark | ( | GBDATA * | gb_main, |
const char * | tree_name, | ||
const char * | log_entry, | ||
bool | stamp | ||
) |
append 'log_entry' to tree comment
gb_main | database |
tree_name | name of tree |
log_entry | text to append |
stamp | true -> prefix date before 'log_entry' |
Definition at line 556 of file adtree.cxx.
References GBS_global_string(), GBT_find_tree(), and GBT_log_to_tree_remark().
Referenced by di_calculate_tree_cb(), and main().
GB_ERROR GBT_write_tree_with_remark | ( | GBDATA * | gb_main, |
const char * | tree_name, | ||
TreeNode * | tree, | ||
const char * | remark | ||
) |
Definition at line 570 of file adtree.cxx.
References error(), GBT_write_tree(), and GBT_write_tree_remark().
Referenced by create_consense_tree_cb(), save_tree_as_newick(), and TREE_load_to_db().
|
static |
Definition at line 579 of file adtree.cxx.
References ARB_strdup(), TreeNode::father, gb_assert, GB_atof(), GB_await_error(), GB_entry(), GB_get_root(), gb_main, TreeNode::gb_node, GB_read_int(), GB_read_string(), GBS_global_string(), GBT_message(), GBT_write_group_name(), TreeNode::is_inner_node_with_remark(), TreeNode::leftlen, TreeNode::leftson, TreeRoot::makeNode(), TreeNode::markAsLeaf(), TreeNode::name, NULp, TreeNode::parse_bootstrap(), REMARK_BOOTSTRAP, TreeNode::remove_remark(), TreeNode::rightlen, TreeNode::rightson, TreeRoot::set_bootstrap_seen(), TreeNode::set_remark(), and TreeNode::setKeeledState().
Referenced by read_tree_and_size_internal().
|
static |
Definition at line 691 of file adtree.cxx.
References ARB_calloc(), error(), TreeNode::father, gb_assert, GB_await_error(), GB_delete(), GB_entry(), GB_get_root(), gb_main, GB_nextEntry(), TreeNode::gb_node, GB_read_int(), GB_read_key_pntr(), GB_read_string(), GBS_global_string(), GBT_message(), gbt_read_tree_rek(), TreeNode::has_group_info(), implicated, TreeNode::is_normal_group(), TreeNode::keelTarget(), TreeNode::name, NULp, and TreeRoot::set_bootstrap_seen().
Referenced by GBT_read_tree_and_size().
TreeNode* GBT_read_tree_and_size | ( | GBDATA * | gb_main, |
const char * | tree_name, | ||
TreeRoot * | troot, | ||
int * | tree_size | ||
) |
Loads a tree from DB into any user defined structure.
gb_main | DB root node |
tree_name | is the name of the tree in the db |
troot | constructs the tree-node instances |
tree_size | if specified -> will be set to "size of tree" (aka number of leafs minus 1) |
Definition at line 770 of file adtree.cxx.
References TreeNode::announce_tree_constructed(), TreeRoot::delete_by_node(), error(), gb_assert, GB_entry(), GB_export_errorf(), GB_FIND, GB_read_int(), GB_search(), GBT_check_tree_name(), GBT_find_tree(), TreeNode::is_normal_group(), NULp, read_tree_and_size_internal(), and tree.
Referenced by GBT_read_tree(), and MatrixOrder::MatrixOrder().
Definition at line 837 of file adtree.cxx.
References GBT_read_tree_and_size(), and NULp.
Referenced by create_consense_tree_cb(), di_calculate_compressed_matrix_cb(), DI_MATRIX::extract_from_tree(), GBT_commit_rename_session(), GBT_compress_sequence_tree2(), get_cached_taxonomy(), load_and_add_tree(), ARB_seqtree_root::loadFromDB(), main(), mark_action(), NT_alltree_remove_leafs(), PVP_calculate(), sort_tree_by_other_tree(), sq_calc_seq_quality_cb(), TREE_write_Newick(), and TREE_write_XML().
Definition at line 842 of file adtree.cxx.
References TreeNode::is_leaf().
Referenced by ARB_main(), count_nodes(), DeconstructedTree::deconstruct_weighted(), export_tree_node_print_xml(), GBT_get_names_of_species_in_tree(), GBT_link_tree_using_species_hash(), get_cached_taxonomy(), and AP_pos_var::retrieve().
Definition at line 849 of file adtree.cxx.
References GBS_global_string().
Referenced by gbt_is_invalid(), and GBT_is_invalid().
Definition at line 853 of file adtree.cxx.
References TreeNode::is_leaf(), TreeNode::leftson, and TreeNode::rightson.
Referenced by gbt_is_invalid().
Definition at line 857 of file adtree.cxx.
References error(), TreeNode::father, gbt_invalid_because(), has_son(), TreeNode::is_leaf(), TreeNode::leftson, NULp, TreeNode::rightson, and tree.
Referenced by GBT_is_invalid().
Definition at line 880 of file adtree.cxx.
References TreeNode::father, gbt_invalid_because(), gbt_is_invalid(), and TreeNode::is_leaf().
Referenced by di_calculate_tree_cb().
|
static |
Definition at line 897 of file adtree.cxx.
References link_tree_data::duplicates, error(), TreeNode::gb_node, GBS_read_hash(), GBS_write_hash(), TreeNode::is_leaf(), TreeNode::name, NULp, link_tree_data::progress, link_tree_data::seen_species, link_tree_data::species_hash, and link_tree_data::zombies.
Referenced by GBT_link_tree_using_species_hash().
|
static |
Definition at line 921 of file adtree.cxx.
References link_tree_data::duplicates, error(), GB_IGNORE_CASE, GBS_create_hash(), GBS_free_hash(), GBT_count_leafs(), gbt_link_tree_to_hash_rek(), NULp, link_tree_data::progress, link_tree_data::seen_species, link_tree_data::species_hash, and link_tree_data::zombies.
Referenced by GBT_link_tree().
GB_ERROR GBT_link_tree | ( | TreeNode * | tree, |
GBDATA * | gb_main, | ||
bool | show_status, | ||
int * | zombies, | ||
int * | duplicates | ||
) |
Link a given tree to the database. That means that for all tips the member 'gb_node' is set to the database container holding the species data.
tree | which will be linked to DB |
gb_main | DB root node |
show_status | show a progress indicator? |
zombies | if specified -> set to number of zombies (aka non-existing species) in tree |
duplicates | if specified -> set to number of duplicated species in tree |
Definition at line 953 of file adtree.cxx.
References error(), GBS_free_hash(), GBT_create_species_hash(), and GBT_link_tree_using_species_hash().
Referenced by ST_ML::calc_st_ml(), compress_sequence_tree(), GBT_compress_sequence_tree2(), get_cached_taxonomy(), ARB_seqtree_root::linkToDB(), PVP_calculate(), AP_tree::relink(), sq_calc_seq_quality_cb(), TREE_write_Newick(), and TREE_write_XML().
void GBT_unlink_tree | ( | TreeNode * | tree | ) |
Definition at line 986 of file adtree.cxx.
References TreeNode::unlink_from_DB().
Referenced by ARB_seqtree_root::unlinkFromDB().
Definition at line 993 of file adtree.cxx.
References GB_entry(), and GBT_get_tree_data().
Referenced by ad_tree_set_security(), adjustTreeRoot(), ARB_main(), BoundTreeAwarCallback::bind_tree_callback(), calc_pvp(), TreeAdmin::delete_tree_cb(), GBT_existing_tree(), GBT_log_to_named_trees_remark(), GBT_read_tree_and_size(), GBT_size_of_tree(), GBT_tree_info_string(), GBT_write_tree_remark(), get_cached_taxonomy(), get_source_and_check_target_tree(), ARB_seqtree_root::loadFromDB(), TreeAdmin::make_dest_treename_unique_cb(), MG_transfer_tree(), AP_tree_root::saveToDB(), transfer_tree(), TreeAdmin::tree_copy_or_rename_cb(), tree_vars_callback(), TREE_write_Newick(), and TREE_write_XML().
|
inline |
Definition at line 1001 of file adtree.cxx.
References GB_get_father(), and GB_has_key().
Referenced by GBT_get_tree_name(), get_next_tree(), and NT_jump_cb().
Definition at line 1007 of file adtree.cxx.
References GB_child(), and GBT_get_tree_data().
Referenced by find_largest_tree(), and GBT_existing_tree().
Definition at line 1011 of file adtree.cxx.
References gb_assert, GB_nextChild(), is_tree(), and NULp.
Referenced by find_largest_tree().
Definition at line 1017 of file adtree.cxx.
References GBT_read_int(), get_first_tree(), get_next_tree(), and NULp.
Referenced by GBT_name_of_largest_tree().
Definition at line 1031 of file adtree.cxx.
References ensure_trees_have_order(), GB_get_father(), get_tree_idx(), and get_tree_infrontof_idx().
Referenced by reorder_trees_cb(), and transfer_tree().
Definition at line 1036 of file adtree.cxx.
References ensure_trees_have_order(), GB_get_father(), get_tree_behind_idx(), and get_tree_idx().
Referenced by GBT_find_next_tree(), MG_transfer_tree(), reorder_trees_cb(), and transfer_tree().
Definition at line 1042 of file adtree.cxx.
References ensure_trees_have_order(), GBT_get_tree_data(), get_tree_behind_idx(), and get_tree_with_idx().
Referenced by GBT_find_next_tree(), MG_transfer_tree(), and reorder_trees_cb().
Definition at line 1050 of file adtree.cxx.
References ensure_trees_have_order(), GBT_get_tree_data(), and get_tree_infrontof_idx().
Referenced by GBT_name_of_bottom_tree(), reorder_trees_cb(), and transfer_tree().
Definition at line 1056 of file adtree.cxx.
References GBT_find_tree(), GBT_get_tree_name(), and get_first_tree().
Referenced by popup_new_main_window().
Definition at line 1063 of file adtree.cxx.
References gb_assert, GB_get_root(), GBT_find_top_tree(), GBT_tree_behind(), and NULp.
Referenced by TreeAdmin::delete_tree_cb(), and MG_transfer_tree().
Definition at line 1079 of file adtree.cxx.
References gb_assert, GB_read_key_pntr(), is_tree(), and NULp.
Referenced by TreeAdmin::delete_tree_cb(), GBT_existing_tree(), GBT_name_of_bottom_tree(), GBT_name_of_largest_tree(), and MG_transfer_tree().
Definition at line 1085 of file adtree.cxx.
References error(), GB_check_key(), GBS_global_string(), and NO_TREE_SELECTED.
Referenced by di_calculate_tree_cb(), GBT_read_tree_and_size(), gbt_write_tree(), and get_source_and_check_target_tree().
Definition at line 1103 of file adtree.cxx.
References find_largest_tree(), and GBT_get_tree_name().
Referenced by AP_create_pos_var_pars_window(), GBT_compress_sequence_tree2(), and NT_create_database_optimization_window().
Definition at line 1107 of file adtree.cxx.
References GBT_find_bottom_tree(), and GBT_get_tree_name().
Referenced by NT_select_bottom_tree().
Definition at line 1114 of file adtree.cxx.
References GB_entry(), GB_export_errorf(), GB_give_other_buffer(), GB_read_char_pntr(), GB_read_int(), GB_read_security_write(), GB_warningf(), GBS_global_string(), GBT_find_tree(), NULp, and result.
Referenced by AWT_tree_selection::fill().
Definition at line 1162 of file adtree.cxx.
References GB_entry(), GB_read_int(), and GBT_find_tree().
Referenced by pars_check_size().
void GBT_get_tree_names | ( | ConstStrArray & | names, |
GBDATA * | gb_main, | ||
bool | sorted | ||
) |
Definition at line 1187 of file adtree.cxx.
References ensure_trees_have_order(), error(), gb_assert, GB_child(), GB_nextChild(), GB_number_of_subentries(), GB_read_key_pntr(), GBK_terminatef(), GBT_get_tree_data(), get_tree_idx(), indexed_name::idx, indexed_name::name, ConstStrArray::put(), CharPtrArray::reserve(), reserve_tree_idx(), and set_tree_idx().
Referenced by collect_searched_trees(), AWT_tree_selection::fill(), GBT_commit_rename_session(), and NT_alltree_remove_leafs().
NOT4PERL GB_ERROR GBT_move_tree | ( | GBDATA * | gb_moved_tree, |
GBT_ORDER_MODE | mode, | ||
GBDATA * | gb_target_tree | ||
) |
Definition at line 1245 of file adtree.cxx.
References ensure_trees_have_order(), error(), gb_assert, GB_get_father(), GBT_BEHIND, get_tree_idx(), reserve_tree_idx(), and set_tree_idx().
Referenced by reorder_trees_cb(), and transfer_tree().
|
static |
Definition at line 1263 of file adtree.cxx.
References gb_assert, GBS_global_string(), GBT_check_tree_name(), GBT_find_tree(), NO_TREE_SELECTED, and NULp.
Referenced by GBT_copy_tree(), and GBT_rename_tree().
|
static |
Definition at line 1291 of file adtree.cxx.
References gb_assert, GB_await_error(), GB_copy_dropProtectMarksAndTempstate(), GB_create_container(), and GB_get_father().
Referenced by GBT_copy_tree(), and GBT_rename_tree().
Definition at line 1302 of file adtree.cxx.
References copy_tree_container(), error(), GB_get_father(), get_source_and_check_target_tree(), get_tree_idx(), reserve_tree_idx(), and set_tree_idx().
Referenced by TreeAdmin::tree_copy_or_rename_cb().
Definition at line 1320 of file adtree.cxx.
References copy_tree_container(), error(), GB_delete(), GB_test_delete_possible(), GBS_global_string(), and get_source_and_check_target_tree().
Referenced by TreeAdmin::tree_copy_or_rename_cb().
Definition at line 1340 of file adtree.cxx.
References TreeNode::is_leaf(), and TreeNode::name.
Referenced by GBT_get_names_of_species_in_tree().
Definition at line 1350 of file adtree.cxx.
References fill_species_name_array(), gb_assert, GBT_count_leafs(), IF_ASSERTION_USED, and result.
Referenced by TreeContainer::add(), mark_action(), and st_ml_check_sequence_quality().
|
static |
Definition at line 1365 of file adtree.cxx.
References GBS_strstruct::cat(), format(), gb_assert, TreeNode::get_branchlength(), TreeNode::get_remark(), group, if, TreeNode::is_keeled_group(), TreeNode::is_leaf(), TreeNode::is_normal_group(), TreeNode::is_root_node(), KEELED_INDICATOR, TreeNode::name, nGROUP, nLENGTH, GBS_strstruct::nprintf(), GBS_strstruct::nput(), nREMARK, NULp, nWRAP, and GBS_strstruct::put().
Referenced by GBT_tree_2_newick().
char* GBT_tree_2_newick | ( | const TreeNode * | tree, |
NewickFormat | format, | ||
bool | compact | ||
) |
Definition at line 1412 of file adtree.cxx.
References error(), gb_assert, GBS_regreplace(), NULp, nWRAP, GBS_strstruct::put(), GBS_strstruct::release(), result, RUNNING_TEST, and tree2newick().