62 bool keep_singleton_inner_nodes,
63 bool keep_inner_node_names,
68 for(
auto const& taxon : taxonomy ) {
69 auto const level = parent_level + 1;
71 if( max_level > -1 &&
taxon_level( taxon ) >=
static_cast<size_t>( max_level )) {
78 }
else if( ! keep_singleton_inner_nodes && taxon.size() == 1 ) {
84 taxon, keep_singleton_inner_nodes, keep_inner_node_names, max_level,
91 std::string
const tax_name = (
92 ( ! keep_inner_node_names && taxon.size() > 0 )
98 taxon, keep_singleton_inner_nodes, keep_inner_node_names, max_level,
107 bool keep_singleton_inner_nodes,
108 bool keep_inner_node_names,
118 if( taxonomy.
size() > 1 ) {
126 taxonomy, keep_singleton_inner_nodes, keep_inner_node_names, max_level, 1, broker
142 return nr.broker_to_tree( broker );
147 std::unordered_map<std::string, Taxopath>
const& extra_taxa,
148 bool keep_singleton_inner_nodes,
149 bool keep_inner_node_names,
151 bool add_extra_taxa_parents
155 auto copy = taxonomy;
156 for(
auto const& tp : extra_taxa ) {
158 if( add_extra_taxa_parents ) {
167 assert( ! add_extra_taxa_parents );
169 throw std::runtime_error(
"Taxopath " +
path +
" not found in Taxonomy." );
174 tax->add_child( tp.first );
177 return taxonomy_to_tree( copy, keep_singleton_inner_nodes, keep_inner_node_names, max_level );
181 std::unordered_map<std::string, Taxopath>
const& taxon_map,
182 bool keep_singleton_inner_nodes,
183 bool keep_inner_node_names,
189 tmp, taxon_map, keep_singleton_inner_nodes, keep_inner_node_names, max_level,
true