#include #include #include #include "tree.hpp" #include "vxheaven_parse.hpp" int main() { std::ifstream ifs("./testdata/samples.sort"); vxorg::VxHeavenTree tree; vxorg::parse_into_tree(tree, ifs); // walk the resulting tree tree.walk([](auto* node) { auto tab_count = node->parent_count(); auto& data = node->data(); for(auto i = 0; i < tab_count; ++i) std::printf("\t"); if(data.name.empty()) { std::printf("(root)\n"); } else { if(data.is_sample) { std::string sample_name = vxorg::get_sample_name(node); std::printf("%s (sample %s)\n", data.name.c_str(), sample_name.c_str()); } else { std::printf("%s\n", data.name.c_str()); } } }); return 0; }