Skip to content

Commit

Permalink
--support: check that reference tree is bifurcating, and replicate tr…
Browse files Browse the repository at this point in the history
…ees are complete
  • Loading branch information
amkozlov committed Aug 7, 2020
1 parent 8ff61c4 commit 8db6413
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ TreeTopology Tree::topology() const
size_t branches = 0;
for (auto n: subnodes())
{
assert(n);
if (n->node_index < n->back->node_index)
{
topol.edges.at(n->pmatrix_index) = TreeBranch(n->node_index, n->back->node_index, n->length);
Expand Down
11 changes: 11 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,7 @@ void generate_bootstraps(RaxmlInstance& instance, const CheckpointFile& checkp)
instance.bs_start_trees.emplace_back(move(tree));
}
}
RAXML_UNUSED(checkp); // might need it again for re-using previously computed replicates
}

void init_ancestral(RaxmlInstance& instance)
Expand Down Expand Up @@ -1896,6 +1897,13 @@ TreeTopologyList read_newick_trees(Tree& ref_tree, const std::string& fname,

assert(!ref_tip_ids.empty());

if (tree.num_tips() != ref_tree.num_tips())
{
throw runtime_error(tree_kind_cap + " tree #" + to_string(bs_num+1) +
" contains wrong number of tips: " + to_string(tree.num_tips()) +
" (expected: " + to_string(ref_tree.num_tips()) + ")");
}

if (!tree.binary())
{
LOG_DEBUG << "REF #branches: " << ref_tree.num_branches()
Expand Down Expand Up @@ -1984,6 +1992,9 @@ void command_support(RaxmlInstance& instance)

LOG_INFO << "Reference tree size: " << to_string(ref_tree.num_tips()) << endl << endl;

if (!ref_tree.binary())
throw runtime_error("Reference tree contains multifurcations, this is not supported!");

/* read all bootstrap trees from a Newick file */
auto bs_trees = read_bootstrap_trees(instance, ref_tree);

Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define RAXML_VERSION "1.0.0-master"
#define RAXML_DATE "06.08.2020"
#define RAXML_DATE "07.08.2020"

0 comments on commit 8db6413

Please sign in to comment.