41 #define AWAR_TREE_SAV "ad_tree/"
42 #define AWAR_TREE_TMP "tmp/ad_tree/"
44 #define AWAR_TREE_SECURITY AWAR_TREE_TMP "tree_security"
45 #define AWAR_TREE_REM AWAR_TREE_TMP "tree_rem"
46 #define AWAR_TREE_IMPORT AWAR_TREE_TMP "import_tree"
48 #define AWAR_GROUPXFER_SAV AWAR_TREE_SAV "groupxfer/"
50 #define AWAR_GROUPXFER_SOURCE AWAR_GROUPXFER_SAV "restrict"
51 #define AWAR_GROUPXFER_OVERWRITE_MODE AWAR_GROUPXFER_SAV "overwrite"
52 #define AWAR_GROUPXFER_INGROUP_ABS AWAR_GROUPXFER_SAV "ingroup/abs"
53 #define AWAR_GROUPXFER_INGROUP_REL AWAR_GROUPXFER_SAV "ingroup/rel"
54 #define AWAR_GROUPXFER_INGROUP_LIM AWAR_GROUPXFER_SAV "ingroup/lim"
55 #define AWAR_GROUPXFER_OUTGROUP_ABS AWAR_GROUPXFER_SAV "outgroup/abs"
56 #define AWAR_GROUPXFER_OUTGROUP_REL AWAR_GROUPXFER_SAV "outgroup/rel"
57 #define AWAR_GROUPXFER_OUTGROUP_LIM AWAR_GROUPXFER_SAV "outgroup/lim"
58 #define AWAR_GROUPXFER_UNKNOWN_ABS AWAR_GROUPXFER_SAV "unknown"
59 #define AWAR_GROUPXFER_KEELING AWAR_GROUPXFER_SAV "keeling"
60 #define AWAR_GROUPXFER_ACI AWAR_GROUPXFER_SAV "aci"
62 #define AWAR_TREE_EXPORT_FILEBASE AWAR_TREE_TMP "export_tree"
63 #define AWAR_TREE_EXPORT_FILTER AWAR_TREE_EXPORT_FILEBASE "/filter"
64 #define AWAR_TREE_EXPORT_NAME AWAR_TREE_EXPORT_FILEBASE "/file_name"
66 #define AWAR_TREE_EXPORT_SAV AWAR_TREE_SAV "export_tree/"
68 #define AWAR_TREE_EXPORT_FORMAT AWAR_TREE_EXPORT_SAV "format"
69 #define AWAR_TREE_EXPORT_NDS AWAR_TREE_EXPORT_SAV "NDS"
70 #define AWAR_TREE_EXPORT_INCLUDE_BOOTSTRAPS AWAR_TREE_EXPORT_SAV "bootstraps"
71 #define AWAR_TREE_EXPORT_INCLUDE_BRANCHLENS AWAR_TREE_EXPORT_SAV "branchlens"
72 #define AWAR_TREE_EXPORT_INCLUDE_GROUPNAMES AWAR_TREE_EXPORT_SAV "groupnames"
73 #define AWAR_TREE_EXPORT_HIDE_FOLDED_GROUPS AWAR_TREE_EXPORT_SAV "hide_folded"
74 #define AWAR_TREE_EXPORT_QUOTEMODE AWAR_TREE_EXPORT_SAV "quote_mode"
75 #define AWAR_TREE_EXPORT_NON_ASCII AWAR_TREE_EXPORT_SAV "non_ASCII"
76 #define AWAR_TREE_EXPORT_REPLACE AWAR_TREE_EXPORT_SAV "replace"
79 #define AWAR_TREE_CONSENSE_TMP AWAR_TREE_TMP "consense/"
80 #define AWAR_TREE_CONSENSE_SAV AWAR_TREE_SAV "consense/"
82 #define AWAR_TREE_CONSENSE_TREE AWAR_TREE_CONSENSE_SAV "tree"
83 #define AWAR_TREE_CONSENSE_SELECTED AWAR_TREE_CONSENSE_TMP "selected"
128 char *treename_nopath = strrchr(treename,
'/');
130 if (treename_nopath) {
134 treename_nopath = treename;
137 char *fname =
GBS_string_eval(treename_nopath,
"*.tree=tree_*1:*.ntree=tree_*1:*.xml=tree_*1:.=:-=_: =_");
179 const char *filter_type =
NULp;
262 if (!tree_name || !strlen(tree_name)) {
263 error =
"Please select a tree first";
277 switch (exportType) {
326 AW_window_simple *aws =
new AW_window_simple;
327 aws->init(root,
"SAVETREE",
"TREE SAVE");
332 aws->create_button(
"CLOSE",
"CLOSE",
"C");
336 aws->create_button(
"HELP",
"HELP",
"H");
341 aws->label(
"Tree format");
346 aws->update_option_menu();
349 aws->label(
"Tree labels");
354 aws->update_option_menu();
357 aws->label(
"Label quoting (Newick only)");
364 aws->update_option_menu();
374 aws->button_length(10);
376 aws->create_button(
"SAVE",
"SAVE",
"o");
388 char tempFile[] =
"newickXXXXXX";
389 int createTempFile = mkstemp(tempFile);
391 if (createTempFile) {
397 for (
char *tok = strtok(tmpFname,
"/"); tok;) {
399 tok = strtok(
NULp,
"/");
422 printf(
"Failed to create Temporary File to Parse xml file!\n");
435 if (strcmp(pcTreeFormat,
"xml") == 0) {
458 AW_window_simple *aws =
new AW_window_simple;
459 aws->init(root,
"LOAD_TREE",
"TREE LOAD");
464 aws->create_button(
"CLOSE",
"CLOSE",
"C");
468 aws->create_button(
"HELP",
"HELP",
"H");
472 aws->insert_default_option(
"Newick",
"t",
"tree");
473 aws->insert_option(
"XML",
"x",
"xml");
474 aws->update_option_menu();
477 aws->label(
"Tree name");
484 aws->create_button(
"LOAD",
"LOAD",
"o");
494 char *log_file =
NULp;
500 if (transferGroups) {
519 if (transferGroups) {
536 if (!canvas_showing_dest) {
538 "Press the right 'Display' button to view that tree", dst_tree));
587 static bool firstCall =
true;
608 AW_window_simple *aws =
new AW_window_simple;
609 aws->init(root, winId, winTitle);
610 aws->load_xfig(
"ad_one_tree.fig");
613 aws->auto_space(10, 3);
616 aws->create_button(
"CLOSE",
"Close",
"C");
620 aws->create_button(
"HELP",
"Help",
"H");
628 aws->callback(makeWindowCallback(
copy_tree_awar_cb, awar_displayed_tree, awar_other_tree)); aws->create_autosize_button(
"SELECT_DISPLAYED",
"Use");
629 aws->callback(makeWindowCallback(
copy_tree_awar_cb, awar_other_tree, awar_displayed_tree)); aws->create_autosize_button(
"DISPLAY_SELECTED",
"Display");
637 AW_window_simple *aws =
new AW_window_simple;
638 aws->init(root,
"CMP_TOPOLOGY",
"Compare tree topologies");
643 aws->create_button(
"CLOSE",
"Close",
"C");
647 aws->create_button(
"HELP",
"Help",
"H");
653 aws->create_autosize_button(
"CMP_TOPOLOGY",
"Compare topologies");
679 {
"*only_perfect_groups",
"Only copy perfectly matching groups with\n * 100% ingroup ratio and\n * 0% outgroup ratio",
"ingroup_lim='100';outgroup_lim='0'" },
681 {
"*maximize_ingroup_ratio",
"Maximize ingroup ratio \n over outgroup ratio.\n(Note: diff of factor 10 is maybe too strong)",
"ingroup_abs='0';ingroup_rel='100';outgroup_abs='0';outgroup_rel='10'" },
682 {
"*minimize_outgroup_ratio",
"Minimize outgroup ratio \n over ingroup ratio.\n(Note: diff of factor 10 is maybe too strong)",
"ingroup_abs='0';ingroup_rel='10';outgroup_abs='0';outgroup_rel='100'" },
684 {
"*report2name",
"custom target group name:\n * add prefix \"XFRD_\" (allows to distinguish newly transferred from existing groups)\n * add suffix reporting penalty",
"aci='\"XFRD_\";groupname;\" {penalty = \";penalty;\"}\"'" },
692 AW_window_simple *aws =
new AW_window_simple;
693 aws->init(root,
"COPY_NODE_INFO_OF_TREE",
"Move groups");
696 aws->button_length(11);
700 aws->create_button(
"CLOSE",
"Close",
"C");
704 aws->create_button(
"HELP",
"Help",
"H");
706 const int FLOAT_COLUMNS = 10;
707 const int PERCENT_COLUMNS = 5;
724 aws->update_option_menu();
729 aws->insert_option(
"keep \"newname [was: oldname]\"",
"k",
KEEP_OLD_NAMES);
730 aws->update_option_menu();
739 aws->create_button(
"GO",
"GO",
"G");
757 if (!gb_moved_tree) {
758 error =
"No tree selected";
768 if (gb_target_tree)
break;
778 if (gb_target_tree)
break;
786 if (gb_target_tree && gb_target_tree != gb_moved_tree) {
787 error =
GBT_move_tree(gb_moved_tree, move_mode, gb_target_tree);
796 static AW_window_simple *aws =
NULp;
801 aws =
new AW_window_simple;
802 aws->init(aw_root,
"TREE_ADMIN",
"TREE ADMIN");
803 aws->load_xfig(
"ad_tree.fig");
807 aws->create_button(
"CLOSE",
"CLOSE",
"C");
811 aws->create_button(
"HELP",
"HELP",
"H");
813 aws->button_length(40);
820 aws->insert_option(
"0",
"0", 0);
821 aws->insert_option(
"1",
"1", 1);
822 aws->insert_option(
"2",
"2", 2);
823 aws->insert_option(
"3",
"3", 3);
824 aws->insert_option(
"4",
"4", 4);
825 aws->insert_option(
"5",
"5", 5);
826 aws->insert_default_option(
"6",
"6", 6);
827 aws->update_option_menu();
833 aws->button_length(20);
838 aws->help_text(
"treeadm.hlp");
840 aws->create_button(
"DELETE",
"Delete",
"D");
843 aws->help_text(
"treeadm.hlp");
845 aws->create_button(
"RENAME",
"Rename",
"R");
848 aws->help_text(
"treeadm.hlp");
850 aws->create_button(
"COPY",
"Copy",
"C");
853 aws->help_text(
"tr_export.hlp");
855 aws->create_button(
"EXPORT",
"Export",
"E");
858 aws->help_text(
"tr_import.hlp");
860 aws->create_button(
"IMPORT",
"Import",
"I");
862 aws->button_length(0);
883 if (!cons_tree_name || !cons_tree_name[0]) {
884 error =
"No name specified for the consensus tree";
890 if (tree_names.size()<2) {
891 error =
"Not enough trees selected (at least 2 needed)";
901 progress.
subtitle(
"loading input trees");
902 for (
size_t t = 0; t<tree_names.size() && !
error; ++t) {
909 tree_builder.
add(tree, tree_names[t], 1.0);
914 size_t species_count;
915 TreeNode *cons_tree = tree_builder.
get(species_count, error);
917 if (!error && progress.
aborted()) {
918 error =
"user abort";
921 nt_assert(contradicted(cons_tree, error));
930 if (error) progress.
done();
932 error = ta.
close(error);
949 static AW_window_simple *aws =
NULp;
951 aws =
new AW_window_simple;
952 aws->init(aw_root,
"CONSENSE_TREE",
"Consensus Tree");
953 aws->load_xfig(
"ad_cons_tree.fig");
955 aws->auto_space(10, 10);
959 aws->create_button(
"CLOSE",
"CLOSE",
"C");
963 aws->create_button(
"HELP",
"HELP",
"H");
972 aws->button_length(0);
974 aws->create_button(
"USE_AS_TARGET",
"#moveLeft.xpm");
978 aws->create_autosize_button(
"BUILD",
"Build consensus tree",
"B");
999 : source(c1.source, c2.source),
1000 target(c1.target, c2.target)
1008 return target.
compare(right.target);
1010 return source.
compare(right.source);
1019 static const char *smallest_leafname;
1022 smallest_leafname = node->
name;
1028 const char *smallest_left = smallest_leafname;
1029 CombinedPosInfo rightInfo = reorder_subtree_rec(node->get_rightson());
1030 const char *smallest_right = smallest_leafname;
1032 bool left_leafname_bigger = strcmp(smallest_left, smallest_right)>0;
1033 smallest_leafname = left_leafname_bigger ? smallest_right : smallest_left;
1037 if (cmp>0 || (cmp == 0 && left_leafname_bigger)) {
1051 #if defined(UNIT_TESTS)
1058 reorder_subtree_rec(tree);
1091 aws->create_autosize_button(
"RESORT",
"Sort according to source tree");
1099 #define AWAR_MFURC "tree/multifurc/"
1100 #define AWAR_MFURC_CONSIDER_BOOTSTRAP AWAR_MFURC "use_bs"
1101 #define AWAR_MFURC_CONSIDER_LENGTH AWAR_MFURC "use_len"
1102 #define AWAR_MFURC_CONSIDER_TERMINALS AWAR_MFURC "terminals"
1103 #define AWAR_MFURC_LENGTH_LIMIT AWAR_MFURC "len"
1104 #define AWAR_MFURC_BOOTSTRAP_LIMIT AWAR_MFURC "bs"
1116 float below_bootstrap = 101.0;
1117 float below_length = 1000000.0;
1126 AW_window_simple *aws =
new AW_window_simple;
1128 aws->init(aw_root, ntw->
aww->
local_id(
"multifurcate"),
"Multifurcate tree");
1130 aws->auto_space(10, 10);
1133 aws->create_button(
"CLOSE",
"CLOSE",
"C");
1136 aws->create_button(
"HELP",
"HELP",
"H");
1138 const int LABEL_LENGTH = 46;
1139 aws->label_length(LABEL_LENGTH);
1142 aws->label(
"Multifurcate branches with branchlength below");
1147 aws->label(
" AND bootstrap below");
1151 aws->label_length(0);
1153 aws->label(
"Also apply to terminal branches");
1158 aws->create_autosize_button(
"MULTIFURCATE",
"Multifurcate",
"M");
1170 static const char *getTreeComment(
GBDATA *
gb_main,
const char *treeName) {
1175 #define TEST_EXPECT_TREE_COMMENT_CONTAINS(treeName,expected) TEST_EXPECT_CONTAINS(getTreeComment(gb_main,treeName),expected)
1176 #define TEST_EXPECT_TREE_COMMENT_DOESNT_CONTAIN(treeName,expected) TEST_EXPECT_DOESNT_CONTAIN(getTreeComment(gb_main,treeName),expected)
1177 #define TEST_EXPECT_TREE_COMMENT_DOESNT_CONTAIN__BROKEN(treeName,expected) TEST_EXPECT_DOESNT_CONTAIN__BROKEN(getTreeComment(gb_main,treeName),expected)
1185 Tree->compute_tree();
1193 void TEST_sort_tree_by_other_tree() {
1198 const char *topo_test =
"(((((((CloTyro3:1.046,CloTyro4:0.061):0.026,CloTyro2:0.017):0.017,CloTyrob:0.009):0.274,CloInnoc:0.371):0.057,CloBifer:0.388):0.124,(((CloButy2:0.009,CloButyr:0.000):0.564,CloCarni:0.120):0.010,CloPaste:0.179):0.131):0.081,((((CorAquat:0.084,CurCitre:0.058):0.103,CorGluta:0.522):0.053,CelBiazo:0.059):0.207,CytAquat:0.711):0.081);";
1199 const char *topo_center =
"(((CloPaste:0.179,((CloButy2:0.009,CloButyr:0.000):0.564,CloCarni:0.120):0.010):0.131,((CloInnoc:0.371,((CloTyro2:0.017,(CloTyro3:1.046,CloTyro4:0.061):0.026):0.017,CloTyrob:0.009):0.274):0.057,CloBifer:0.388):0.124):0.081,((CelBiazo:0.059,((CorAquat:0.084,CurCitre:0.058):0.103,CorGluta:0.522):0.053):0.207,CytAquat:0.711):0.081);";
1200 const char *topo_bottom =
"((CytAquat:0.711,(CelBiazo:0.059,(CorGluta:0.522,(CorAquat:0.084,CurCitre:0.058):0.103):0.053):0.207):0.081,((CloPaste:0.179,(CloCarni:0.120,(CloButy2:0.009,CloButyr:0.000):0.564):0.010):0.131,(CloBifer:0.388,(CloInnoc:0.371,(CloTyrob:0.009,(CloTyro2:0.017,(CloTyro3:1.046,CloTyro4:0.061):0.026):0.017):0.274):0.057):0.124):0.081);";
1202 const char *topo_vs_nj_bs =
"(((((((CloTyro3:1.046,CloTyro4:0.061):0.026,CloTyro2:0.017):0.017,CloTyrob:0.009):0.274,CloInnoc:0.371):0.057,CloBifer:0.388):0.124,(((CloButyr:0.000,CloButy2:0.009):0.564,CloCarni:0.120):0.010,CloPaste:0.179):0.131):0.081,(((CorGluta:0.522,(CorAquat:0.084,CurCitre:0.058):0.103):0.053,CelBiazo:0.059):0.207,CytAquat:0.711):0.081);";
1221 const double EPSILON = 0.0001;
1230 TEST_REJECT(sbt.sourcePos(
"Un-Known").is_known());
1249 TEST_EXPECT_ERROR_CLEAR();
1250 TEST_EXPECT_SAVED_NEWICK(
nALL, gb_main,
"tree_loaded",
"(((s1:0.200,s2:0.400):0.600,(s3:0.300,s 4:0.100):0.100):0.000,(s5:0.020,s-6:0.040):0.060);");
1251 TEST_EXPECT_TREE_COMMENT_CONTAINS(
"tree_loaded",
"covering most of tree reader code");
1256 void TEST_move_node_info() {
1260 const char *treeTarget1 =
"tree_removal";
1261 const char *treeTarget2 =
"tree_test";
1262 const char *treeSortby1 =
"tree_removal_copy";
1263 const char *treeSortby2 =
"tree_test_copy";
1265 const char *treeSource1 = treeSortby2;
1266 const char *treeSource2 =
"tree_tree2";
1267 const char *treeSource3 =
"tree_groups";
1269 #define GROUP_TEST "(CloTyrob,(CloTyro2,(CloTyro3,CloTyro4)))"
1270 #define GROUP_TEST_FLIPPED "(((CloTyro3,CloTyro4),CloTyro2),CloTyrob)"
1272 #define NAMED_GROUP_TEST GROUP_TEST "'test'"
1273 #define OVERWRITTEN_GROUP_TEST GROUP_TEST "'g2 [was: test]'"
1275 const char *org_topo1 =
"((CloInnoc," GROUP_TEST
"),(CloBifer,((CloCarni,CurCitre),((CloPaste,(Zombie1,(CloButy2,CloButyr))),(CytAquat,(CelBiazo,(CorGluta,(CorAquat,Zombie2))))))));";
1276 const char *org_topo2 =
"((((" GROUP_TEST_FLIPPED
",CloInnoc),CloBifer),(((CloButy2,CloButyr),CloCarni),CloPaste)),((((CorAquat,CurCitre),CorGluta),CelBiazo),CytAquat));";
1279 const char *unwanted_topo11 =
"((CytAquat,(CelBiazo,(CorGluta,(CorAquat,Zombie2)))),((CloPaste,(Zombie1,(CloButy2,CloButyr))),((CloCarni,CurCitre),(CloBifer,(CloInnoc," NAMED_GROUP_TEST
")))));";
1280 const char *unwanted_topo21 =
"((CloButy2,CloButyr),(Zombie1,(CloPaste,((((CloInnoc," OVERWRITTEN_GROUP_TEST
"),CloBifer),(CloCarni,CurCitre)),(CytAquat,(CelBiazo,(CorGluta,(CorAquat,Zombie2)))))))'outer');";
1282 const char *sorted_topo11 =
"(((((CloInnoc," NAMED_GROUP_TEST
"),CloBifer),(CloCarni,CurCitre)),(CloPaste,(Zombie1,(CloButy2,CloButyr)))),(CytAquat,(CelBiazo,(CorGluta,(CorAquat,Zombie2)))));";
1283 const char *sorted_topo21 =
"(((((((CloInnoc," OVERWRITTEN_GROUP_TEST
"),CloBifer),(CloCarni,CurCitre)),(CytAquat,(CelBiazo,(CorGluta,(CorAquat,Zombie2))))),CloPaste),Zombie1)'outer',(CloButy2,CloButyr));";
1284 const char *topo32 =
"((CloButy2,CloButyr)'upper',(((((" GROUP_TEST_FLIPPED
"'low2',CloInnoc),CloBifer),((((CorAquat,CurCitre),CorGluta),CelBiazo),CytAquat)'low1'),CloPaste),CloCarni));";
1285 const char *topo32_rc =
"((CloButy2,CloButyr)'upper',(((((" GROUP_TEST_FLIPPED
"'low2',CloInnoc),CloBifer),((((CorAquat,CurCitre),CorGluta),CelBiazo),CytAquat)'low1'),CloPaste),CloCarni)'lower');";
1286 const char *topo32_rel =
"((CloButy2,CloButyr)" ",(((((" GROUP_TEST_FLIPPED
"'low2 [p=0.250000;ir=100.0%;3->4]',CloInnoc),CloBifer)'low1 [p=0.232222;ir=100.0%;7->6]',((((CorAquat,CurCitre),CorGluta),CelBiazo),CytAquat)'upper [p=0.510000;ir=100.0%;5->5]'),CloPaste),CloCarni)'lower [p=0.230769;ir=100.0%;10->13]');";
1287 const char *topo32_li =
"((CloButy2,CloButyr)" ",(((((" GROUP_TEST_FLIPPED
"'low2',CloInnoc),CloBifer),((((CorAquat,CurCitre),CorGluta),CelBiazo),CytAquat)'low1'),CloPaste),CloCarni)'lower');";
1289 const char *compared_topo =
"(((((((CloInnoc,(CloTyrob,(CloTyro2,(CloTyro3,CloTyro4)))),CloBifer),(CloCarni,CurCitre)'# 2')'# 2',(CytAquat,(CelBiazo,(CorGluta,(CorAquat,Zombie2)'# 1')'# 1')'# 1')'# 1')'# 1',CloPaste),Zombie1),(CloButy2,CloButyr));";
1291 const char *
LOG =
"move_node_info.log";
1294 #if defined(TEST_AUTO_UPDATE)
1295 # define TEST_LOGS_EXPECTED(expected) TEST_COPY_FILE(LOG, expected)
1297 # define TEST_LOGS_EXPECTED(expected) TEST_EXPECT_TEXTFILES_EQUAL(expected, LOG)
1298 #endif // TEST_AUTO_UPDATE
1306 const char *resetComment =
"<comment reset>";
1322 const char *comment_added =
"Copied node info from tree_test_copy";
1323 TEST_EXPECT_TREE_COMMENT_DOESNT_CONTAIN(treeTarget1, comment_added);
1326 TEST_LOGS_EXPECTED(
"group_xfer_11.log.expected");
1330 TEST_EXPECT_TREE_COMMENT_CONTAINS(treeTarget1, comment_added);
1339 const char *comment_added =
"Copied node info from tree_groups";
1340 TEST_EXPECT_TREE_COMMENT_DOESNT_CONTAIN(treeTarget2, comment_added);
1343 TEST_LOGS_EXPECTED(
"group_xfer_32.log.expected");
1346 TEST_EXPECT_TREE_COMMENT_CONTAINS(treeTarget2, comment_added);
1351 TEST_LOGS_EXPECTED(
"group_xfer_32_rc.log.expected");
1360 "groupname;\" [p=\";penalty;\";ir=\";ingroup;\";\";oldsize;\"->\";newsize;\"]\""));
1361 TEST_LOGS_EXPECTED(
"group_xfer_32_rel.log.expected");
1381 TEST_LOGS_EXPECTED(
"group_xfer_32_li.log.expected");
1388 const char *comment_added =
"Added node info from tree_tree2";
1389 TEST_EXPECT_TREE_COMMENT_DOESNT_CONTAIN(treeTarget1, comment_added);
1392 TEST_LOGS_EXPECTED(
"group_xfer_21.log.expected");
1396 TEST_EXPECT_TREE_COMMENT_CONTAINS(treeTarget1, comment_added);
1407 const char *comment_added =
"Compared topology with tree_test";
1408 TEST_EXPECT_TREE_COMMENT_DOESNT_CONTAIN(treeTarget1, comment_added);
1412 TEST_EXPECT_TREE_COMMENT_CONTAINS(treeTarget1, comment_added);
1417 #define DOESNT_MATTER_ARGS gb_main,treeSource2,treeTarget1,LOG,REMOVE_EXISTING_GROUPS,XFER_ALL_GROUPS
1434 #undef DOESNT_MATTER_ARGS
1493 TEST_EXPECT(brotherUp.counter_next().dest() == grandpa);
1508 TEST_EXPECT(toLeaf.counter_next().dest() == node);
1512 TEST_EXPECT(fromLeaf.counter_previous().dest() == left);
1526 for (
int i = 0; i<EDGES; ++i) {
1532 TEST_EXPECT(e[i].counter_next().counter_previous() == e[i]);
1533 TEST_EXPECT(e[i].counter_previous().counter_next() == e[i]);
1537 TEST_EXPECT(e[i].counter_next().inverse().next() == inv);
1538 TEST_EXPECT(e[i].counter_previous().inverse().previous() == inv);
1539 TEST_EXPECT(e[i].next().inverse().counter_next() == inv);
1540 TEST_EXPECT(e[i].previous().inverse().counter_previous() == inv);
1545 const double EPSILON = 0.000001;
1547 const double NLEN = 0.025806;
1548 const double BLEN = 0.017316;
1549 const double PLEN = 0.017167;
1550 const double LLEN = 1.045690;
1551 const double RLEN = 0.060606;
1568 const double MOD_NLEN = 0.123456;
1569 const double MOD_LLEN = 0.246802;
1571 toLeaf.set_length(MOD_LLEN);
1585 void TEST_remove_bootstraps() {
1595 const char *topo_org =
"(((((((CloTyro3,CloTyro4)'40%',CloTyro2)'0%',CloTyrob)'97%',CloInnoc)'0%',CloBifer)'53%',(((CloButy2,CloButyr),CloCarni)'33%',CloPaste)'97%'),((((CorAquat,CurCitre),CorGluta)'17%',CelBiazo)'40%',CytAquat));";
1596 const char *topo_rem =
"(((((((CloTyro3,CloTyro4)" ",CloTyro2)" ",CloTyrob)" ",CloInnoc)" ",CloBifer)" ",(((CloButy2,CloButyr),CloCarni)" ",CloPaste)" "),((((CorAquat,CurCitre),CorGluta)" ",CelBiazo)" ",CytAquat));";
1609 void TEST_multifurcate_tree() {
1614 const char *topo_test =
"(((((((CloTyro3:1.046,CloTyro4:0.061)'40%':0.026,CloTyro2:0.017)'0%':0.017,CloTyrob:0.009)'97%:test':0.274,CloInnoc:0.371)'0%':0.057,CloBifer:0.388)'53%':0.124,(((CloButy2:0.009,CloButyr:0.000):0.564,CloCarni:0.120)'33%':0.010,CloPaste:0.179)'97%':0.131):0.081,((((CorAquat:0.084,CurCitre:0.058):0.103,CorGluta:0.522)'17%':0.053,CelBiazo:0.059)'40%':0.207,CytAquat:0.711):0.081);";
1616 const char *topo_single =
"(((((((CloTyro3:1.046,CloTyro4:0.061)'40%':0.026,CloTyro2:0.017)'0%':0.017,CloTyrob:0.009)'97%:test':0.581,CloInnoc:0.000)'0%':0.121,CloBifer:0.388)'53%':0.124,(((CloButy2:0.009,CloButyr:0.000):0.564,CloCarni:0.120)'33%':0.010,CloPaste:0.179)'97%':0.131):0.081,((((CorAquat:0.084,CurCitre:0.058):0.103,CorGluta:0.522)'17%':0.053,CelBiazo:0.059)'40%':0.207,CytAquat:0.711):0.081);";
1617 const char *topo_bs_less_101_005 =
"(((((((CloTyro3:1.098,CloTyro4:0.064)" ":0.000,CloTyro2:0.000)" ":0.000,CloTyrob:0.000)'97%:test':0.287,CloInnoc:0.371)'0%':0.057,CloBifer:0.388)'53%':0.124,(((CloButy2:0.000,CloButyr:0.000):0.578,CloCarni:0.121)" ":0.000,CloPaste:0.181)'97%':0.132):0.081,((((CorAquat:0.084,CurCitre:0.058):0.103,CorGluta:0.522)'17%':0.053,CelBiazo:0.059)'40%':0.207,CytAquat:0.711):0.081);";
1618 const char *topo_bs_less_101_005_NT =
"(((((((CloTyro3:1.078,CloTyro4:0.062)" ":0.000,CloTyro2:0.018)" ":0.000,CloTyrob:0.009)'97%:test':0.282,CloInnoc:0.371)'0%':0.057,CloBifer:0.388)'53%':0.124,(((CloButy2:0.009,CloButyr:0.000):0.570,CloCarni:0.121)" ":0.000,CloPaste:0.181)'97%':0.132):0.081,((((CorAquat:0.084,CurCitre:0.058):0.103,CorGluta:0.522)'17%':0.053,CelBiazo:0.059)'40%':0.207,CytAquat:0.711):0.081);";
1619 const char *topo_bs_less_30_005 =
"(((((((CloTyro3:1.046,CloTyro4:0.061)'40%':0.027,CloTyro2:0.018)" ":0.000,CloTyrob:0.009)'97%:test':0.288,CloInnoc:0.371)'0%':0.057,CloBifer:0.388)'53%':0.124,(((CloButy2:0.009,CloButyr:0.000):0.564,CloCarni:0.120)'33%':0.010,CloPaste:0.179)'97%':0.131):0.081,((((CorAquat:0.084,CurCitre:0.058):0.103,CorGluta:0.522)'17%':0.053,CelBiazo:0.059)'40%':0.207,CytAquat:0.711):0.081);";
1620 const char *topo_bs_less_30 =
"(((((((CloTyro3:1.046,CloTyro4:0.061)'40%':0.027,CloTyro2:0.018)" ":0.000,CloTyrob:0.009)'97%:test':0.302,CloInnoc:0.390)" ":0.000,CloBifer:0.407)'53%':0.131,(((CloButy2:0.009,CloButyr:0.000):0.564,CloCarni:0.120)'33%':0.010,CloPaste:0.179)'97%':0.131):0.081,((((CorAquat:0.084,CurCitre:0.058):0.109,CorGluta:0.554)" ":0.000,CelBiazo:0.062)'40%':0.220,CytAquat:0.711):0.081);";
1621 const char *topo_all =
"(((((((CloTyro3:0.000,CloTyro4:0.000)" ":0.000,CloTyro2:0.000)" ":0.000,CloTyrob:0.000)'" "test':0.000,CloInnoc:0.000)" ":0.000,CloBifer:0.000)" ":0.000,(((CloButy2:0.000,CloButyr:0.000):0.000,CloCarni:0.000)" ":0.000,CloPaste:0.000)" ":0.000):0.000,((((CorAquat:0.000,CurCitre:0.000):0.000,CorGluta:0.000)" ":0.000,CelBiazo:0.000)" ":0.000,CytAquat:0.000):0.000);";
1623 const double STABLE_LENGTH = 5.362750;
1624 const double EPSILON = 0.000001;
1626 for (
int test = 1; test<=6; ++test) {
1683 void TEST_TreeNode_attributes() {
1758 #endif // UNIT_TESTS
GBDATA * GBT_find_bottom_tree(GBDATA *gb_main)
NOT4PERL GB_ERROR GBT_move_tree(GBDATA *gb_moved_tree, GBT_ORDER_MODE mode, GBDATA *gb_target_tree)
GB_ERROR NT_with_displayed_tree_do(TREE_canvas *ntw, bool(*displayed_tree_cb)(TreeNode *tree, GB_ERROR &error))
#define AWAR_TREE_EXPORT_NDS
GBDATA * GB_open(const char *path, const char *opent)
void GB_remove_on_exit(const char *filename)
AW_awar * set_srt(const char *srt)
#define AWAR_TREE_EXPORT_REPLACE
AW_window * create_rename_window(AW_root *root, const Spec *spec)
GB_ERROR TREE_write_XML(GBDATA *gb_main, const char *db_name, const char *tree_name, const TreeLabeler &labeler, bool skip_folded, const char *path)
#define TEST_EXPECT_SIMILAR(expr, want, epsilon)
GB_ERROR GBT_write_tree_with_remark(GBDATA *gb_main, const char *tree_name, TreeNode *tree, const char *remark)
#define AWAR_TREE_EXPORT_FILTER
AW_window * NT_create_moveGroupInfo_window(AW_root *root)
TreeNode * findLeafNamed(const char *wantedName)
static void tree_vars_callback(AW_root *aw_root)
#define AWAR_TREE_EXPORT_NAME
void load_xfig(const char *file, bool resize=true)
static void multifurcation_cb(UNFIXED, TREE_canvas *ntw)
static char * readXmlTree(char *fname)
void AWT_registerTreeAwarSimple(AW_awar *awar)
void AW_edit(const char *path)
#define AWAR_GROUPXFER_ACI
void GB_unlink_or_warn(const char *path, GB_ERROR *error)
void reorder_subtree(TreeNode *tree)
GBDATA * GBT_tree_behind(GBDATA *gb_tree)
AW_selection * awt_create_subset_selection_list(AW_window *aww, AW_selection_list *parent_selection, const char *at_box, const char *at_add, const char *at_sort, bool autocorrect_subselection, SubsetChangedCb subChanged_cb, AW_CL cl_user)
#define AWAR_GROUPXFER_OUTGROUP_LIM
char * get_tree_remark() const
GB_ERROR TREE_load_to_db(GBDATA *gb_main, const char *treefile, const char *tree_name)
void AW_create_standard_fileselection(AW_window *aws, const char *awar_prefix)
ARB_edge_type get_type() const
char * ARB_strdup(const char *str)
void AWT_insert_config_manager(AW_window *aww, AW_default default_file_, const char *id, const StoreConfigCallback &store_cb, const RestoreConfigCallback &load_or_reset_cb, const char *macro_id, const AWT_predefined_config *predef)
#define AWAR_GROUPXFER_SOURCE
static void swap_source_dest_cb(AW_window *aww)
TreeNode * GBT_read_tree(GBDATA *gb_main, const char *tree_name, TreeRoot *troot)
AW_window * NT_create_multifurcate_tree_window(AW_root *aw_root, TREE_canvas *ntw)
#define AWAR_MFURC_CONSIDER_LENGTH
#define AWAR_TREE_CONSENSE_TREE
NOT4PERL long * GBT_readOrCreate_int(GBDATA *gb_container, const char *fieldpath, long default_value)
const char * GBS_global_string(const char *templat,...)
#define SRT_AUTOCORRECT_TREENAME
#define AWAR_MFURC_CONSIDER_TERMINALS
AW_DB_selection * awt_create_TREE_selection_list(GBDATA *gb_main, AW_window *aws, const char *varname)
char * GBS_string_eval(const char *insource, const char *icommand)
void AW_POPDOWN(AW_window *window)
static void update_default_treename_cb(AW_root *aw_root)
#define AWAR_GROUPXFER_INGROUP_LIM
ARB_edge previous() const
void cat(const char *from)
GBDATA * GBT_get_tree_data(GBDATA *gb_main)
int GB_unlink(const char *path)
void get_values(StrArray &intoArray)
ARB_edge rootEdge(TreeRoot *root)
#define ARRAY_ELEMS(array)
int compare(const CombinedPosInfo &right) const
#define AWAR_GROUPXFER_OUTGROUP_REL
static AWT_config_mapping_def moveGroupInfo_mapping[]
GB_CSTR GB_getenvARBHOME(void)
static void ad_tree_set_security(AW_root *aw_root)
AW_window * NT_create_sort_tree_by_other_tree_window(AW_root *aw_root, TREE_canvas *ntw)
#define DOWNCAST(totype, expr)
AW_awar * add_callback(const RootCallback &cb)
struct Unfixed_cb_parameter * UNFIXED
ARB_edge parentEdge(TreeNode *son)
void setPerErrorPenalties(double ingroup_pep, double outgroup_pep, double unfound_pep)
GB_ERROR GBT_write_tree_remark(GBDATA *gb_main, const char *tree_name, const char *remark)
#define TEST_EXPECT_SAVED_NEWICK__BROKEN(format, gb_main, treename, expected_newick)
const char * read_char_pntr() const
GB_ERROR GB_await_error()
static AW_root * SINGLETON
#define AWAR_TREE_EXPORT_FORMAT
WindowCallback makeHelpCallback(const char *helpfile)
#define TEST_EXPECT(cond)
char * GB_create_tempfile(const char *name)
static void tree_save_cb(AW_window *aww)
void popup_tree_admin_window(AW_window *awp)
bool in_other_branch_than(const TreeNode *other) const
#define TEST_EXPECT_NEWICK(format, tree, expected_newick)
AW_window * NT_create_consense_window(AW_root *aw_root)
const TreeNode * ancestor_common_with(const TreeNode *other) const
static void reorder_trees_cb(AW_window *aww, awt_reorder_mode dest)
int compare(const TreeRelativePosition &right) const
AW_awar * awar_float(const char *var_name, float default_value=0.0, AW_default default_file=AW_ROOT_DEFAULT)
AW_awar * dest_tree_awar(AW_root *root)
#define AWAR_GROUPXFER_INGROUP_REL
void create_awars(AW_root *root, AW_default aw_def, bool registerTreeAwar)
AW_window * NT_create_compareTopologies_window(AW_root *root)
const char * GBT_tree_info_string(GBDATA *gb_main, const char *tree_name, int maxTreeNameLen)
static void copy_tree_awar_cb(UNFIXED, AW_awar *aw_source, AW_awar *aw_dest)
int GB_read_security_write(GBDATA *gbd)
static void tree_load_cb(AW_window *aww)
static AWT_config_mapping_def tree_export_config_mapping[]
GBDATA * GBT_find_top_tree(GBDATA *gb_main)
void delete_tree_cb(AW_window *aww, const Spec *spec)
void setRelativePenalties(double ingroup_inv_relpen, double outgroup_relpen)
GB_ERROR GBT_write_tree(GBDATA *gb_main, const char *tree_name, TreeNode *tree)
void add(SizeAwareTree *&tree, const char *treename, double weight)
void setLimits(const RatioLimits &ingroupLimits, const RatioLimits &outgroupLimits)
#define TEST_REJECT(cond)
#define TEST_REJECT_NULL(n)
#define AWAR_TREE_EXPORT_INCLUDE_GROUPNAMES
static void error(const char *msg)
#define AWAR_TREE_EXPORT_QUOTEMODE
void AW_create_fileselection_awars(AW_root *awr, const char *awar_base, const char *directories, const char *filter, const char *file_name)
TreeNode * TREE_load(const char *path, TreeRoot *troot, char **commentPtr, bool allow_length_scaling, char **warningPtr)
static bool sort_dtree_by_other_tree_cb(TreeNode *tree, GB_ERROR &error)
GB_ERROR GBT_copy_tree(GBDATA *gb_main, const char *source_name, const char *dest_name)
void NT_create_twoTreeSelection(AW_window *aws)
static AWT_predefined_config moveGroupInfo_predef[]
bool in_same_branch_as(const TreeNode *other) const
TREE_canvas * NT_get_canvas_showing_tree(const char *tree_name, bool forceDisplay)
ARB_edge counter_previous() const
static void update_filter_cb(AW_root *root)
#define AWAR_GROUPXFER_OUTGROUP_ABS
void multifurcate_whole_tree(const multifurc_limits &below)
NOT4PERL GB_ERROR GB_xcmd(const char *cmd, XCMD_TYPE exectype) __ATTR__USERESULT_TODO
#define AWAR_GROUPXFER_UNKNOWN_ABS
#define AWAR_MFURC_BOOTSTRAP_LIMIT
bool is_son_of(const TreeNode *Father) const
char * read_string() const
GB_ERROR GB_write_security_write(GBDATA *gbd, unsigned long level)
static void create_consense_tree_cb(AW_window *aww, AW_selection *selected_trees)
AW_awar * awar(const char *awar)
void awt_create_order_buttons(AW_window *aws, awt_orderfun reorder_cb, AW_CL cl_user)
GB_ERROR TREE_write_Newick(GBDATA *gb_main, const char *tree_name, const TreeLabeler &labeler, bool save_branchlengths, bool save_bootstraps, bool save_groupnames, bool pretty, LabelQuoting quoteMode, const char *path)
SortByTopo(const TreeNode *by)
void AW_refresh_fileselection(AW_root *awr, const char *awar_prefix)
bool is_ancestor_of(const TreeNode *descendant) const
void create_autosize_button(const char *macro_name, AW_label label, const char *mnemonic=NULp, unsigned xtraSpace=1)
#define __ATTR__REDUCED_OPTIMIZE
#define AWAR_TREE_CONSENSE_SELECTED
#define AWAR_MFURC_CONSIDER_BOOTSTRAP
#define AWAR_GROUPXFER_INGROUP_ABS
void NT_create_multifurcate_tree_awars(AW_root *aw_root, AW_default props)
void create_trees_var(AW_root *aw_root, AW_default aw_def)
char * GB_unique_filename(const char *name_prefix, const char *suffix)
int GB_read_security_delete(GBDATA *gbd)
static AW_window_simple * create_select_other_tree_window(AW_root *root, const char *winId, const char *winTitle, const char *helpFile, AW_awar *awar_displayed_tree)
static void ad_move_tree_info(AW_window *aww, bool transferGroups)
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
void auto_space(int xspace, int yspace)
GB_ERROR close(GB_ERROR error)
#define AWAR_GROUPXFER_KEELING
static AW_window * create_tree_export_window(AW_root *root)
bool is_inside(const TreeNode *subtree) const
AW_awar * source_tree_awar(AW_root *root)
#define AWAR_TREE_EXPORT_INCLUDE_BRANCHLENS
SizeAwareTree * get(size_t &different_species, GB_ERROR &error)
AW_window * create_copy_window(AW_root *root, const Spec *spec)
AW_awar * map(const char *awarn)
void subtitle(const char *stitle)
GB_ERROR GB_write_security_delete(GBDATA *gbd, unsigned long level)
GBT_LEN sum_child_lengths() const
#define TEST_EXPECT_NO_ERROR(call)
void aw_message(const char *msg)
ARB_edge counter_next() const
#define TEST_EXPECT_SAVED_NEWICK(format, gb_main, treename, expected_newick)
static GB_ERROR sort_tree_by_other_tree(GBDATA *gb_main, TreeNode *tree, const char *other_tree)
#define TEST_EXPECT_ERROR_CONTAINS(call, part)
CombinedPosInfo(const CombinedPosInfo &c1, const CombinedPosInfo &c2)
GB_ERROR write_string(const char *aw_string)
#define TEST_EXPECT_DIFFERENT(expr, want)
const char * get_data() const
GB_ERROR NTREE_move_tree_info(GBDATA *gb_main, const char *tree_source, const char *tree_dest, const char *log_file, GroupTransferMode mode, GroupsToTransfer what, const GroupMatchScorer &scorer, const char *aci)
#define AWAR_MFURC_LENGTH_LIMIT
const char * local_id(const char *id) const
GBT_LEN get_branchlength() const
#define AWAR_TREE_EXPORT_INCLUDE_BOOTSTRAPS
GBDATA * GBT_find_tree(GBDATA *gb_main, const char *tree_name)
GB_transaction ta(gb_var)
void callback(const WindowCallback &cb)
#define AWAR_TREE_EXPORT_HIDE_FOLDED_GROUPS
void destroy(TreeNode *that)
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
void set_length(GBT_LEN len)
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
#define AWAR_TREE_EXPORT_FILEBASE
void hide_or_notify(const char *error)
void NT_deselect_group(AW_root *awr)
#define AWAR_TREE_SECURITY
static void sort_tree_by_other_tree_cb(UNFIXED, TREE_canvas *ntw)
static void use_selected_as_target_cb(AW_window *aww)
#define AWAR_TREE_EXPORT_NON_ASCII
AW_awar * awar_pointer(const char *var_name, GBDATA *default_value=NULp, AW_default default_file=AW_ROOT_DEFAULT)
static AW_window * create_tree_import_window(AW_root *root)
AW_awar * get_awar_tree() const
CombinedPosInfo(const TreeRelativePosition &s, const TreeRelativePosition &t)
TreeRelativePosition relative(const char *name) const
GBDATA * GB_entry(GBDATA *father, const char *key)
AW_selection_list * get_sellist()
GBDATA * GBT_tree_infrontof(GBDATA *gb_tree)
void aw_message_if(GB_ERROR error)
char * GBS_global_string_copy(const char *templat,...)
void GB_close(GBDATA *gbd)
TreeNode * source() const
void NT_multifurcate_tree(TREE_canvas *ntw, const TreeNode::multifurc_limits &below)
#define AWAR_GROUPXFER_OVERWRITE_MODE
GB_write_int const char s