Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
fa48ebd
callback example
yceh Jun 28, 2022
9e78f6d
Merge branch 'larch-dev' of https://github.com/yatisht/usher into cal…
yceh Jul 8, 2022
e9665dc
make callback do the filtering
yceh Jul 8, 2022
5e65616
Merge pull request #253 from yceh/callback
yatisht Jul 8, 2022
f4104fe
give the callback list of change in major allele set (Fitch set)
yceh Jul 12, 2022
be0b8c0
filter away empty changes
yceh Jul 12, 2022
de012d3
Merge pull request #255 from yceh/callback
yatisht Aug 28, 2022
1eb0933
Merge remote-tracking branch 'origin/larch-dev' into add-usher-callback
ognian- Oct 3, 2022
9e40e6a
Added callback parameter
ognian- Oct 4, 2022
876c54a
Added missing callback params
ognian- Oct 4, 2022
9d29766
Passing move by reference
ognian- Oct 12, 2022
ae610f8
Fixed warnings in ASAN,UBSAN
ognian- Oct 31, 2022
c376675
fix destination node side split node, by Cheng Ye
ognian- Feb 21, 2023
4cfb3f6
Commented unnecessary assert
ognian- Apr 21, 2023
e892138
Fixed capture bug
ognian- Jun 6, 2023
8597b82
added routine to update MAT node_idx attribute correctly
marybarker Oct 9, 2023
e1b0e10
Fixed uninitialized objects
ognian- Nov 3, 2023
59c69f4
Added get_node_idx()
ognian- Oct 24, 2024
d5f44c8
Merge remote-tracking branch 'origin/master' into usher_sync
ognian- Jun 27, 2025
8e09cec
Moved callback to last parameter; default provided
ognian- Jul 10, 2025
a74eedf
Applied TBB update
ognian- Jul 10, 2025
105a28f
Merge remote-tracking branch 'origin/tbb_update' into tbb-update
ognian- Jul 16, 2025
b767492
Initial TBB migration
ognian- Jul 16, 2025
3cb0174
Migrated matOptimize
ognian- Jul 18, 2025
f90359b
Migrated matUtils
ognian- Jul 18, 2025
28d708b
Migrated usher-sampled
ognian- Jul 18, 2025
f3487be
Migrated usher
ognian- Jul 18, 2025
e9dc2d3
Migrated ripples and ripples-fast
ognian- Jul 18, 2025
30694ed
Migrated compareVCF
ognian- Jul 18, 2025
1491906
Migrated check_samples_place
ognian- Jul 18, 2025
ef2aa65
Migrated transpose_vcf
ognian- Jul 18, 2025
8bf8d46
Migrated transpose_vcf_to*
ognian- Jul 18, 2025
bb75b90
Merge branch 'yatisht:master' into tbb-update
ognian- Jul 21, 2025
f074b65
Updated TBB version to latest
ognian- Jul 21, 2025
0f8f173
Fixed min cmake version and FindBoost warning
ognian- Jul 23, 2025
0a6963b
Fixed sampler recursive tasks
ognian- Jul 25, 2025
a5b4c58
Removed spin locks; Protobuf linking fix; Fixed unitialized variable
ognian- Jul 31, 2025
4675834
Fix for boost 1.88
ognian- Aug 19, 2025
135947c
Fix for buffer overflow
ognian- Aug 21, 2025
b5f704c
Merge remote-tracking branch 'origin/master' into tbb-update
ognian- Sep 18, 2025
39f0030
Reducing allocations for task_group
ognian- Sep 24, 2025
5c32e0a
Adding taskflow
ognian- Oct 14, 2025
782937c
Adding taskflow: place_sample_follower
ognian- Oct 14, 2025
db2839c
Trial for main_mapper
ognian- Oct 17, 2025
f490cb1
Revert "Trial for main_mapper"
ognian- Oct 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
73 changes: 42 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 3.14)
cmake_policy(SET CMP0069 NEW)
project(usher)
if(NOT CMAKE_BUILD_TYPE)
Expand All @@ -16,14 +16,28 @@ if ("${VERSION_PATCH}" MATCHES "[0-9]+")
endif()
message(STATUS "${usher_VERSION}")

include(FetchContent)
set(TBB_VERSION "v2022.2.0")
FetchContent_Declare(oneTBB
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB
GIT_TAG ${TBB_VERSION}
GIT_SHALLOW true
GIT_PROGRESS true
UPDATE_DISCONNECTED true
CMAKE_ARGS -DTBB_TEST:BOOL=OFF
)
set(TBB_TEST OFF CACHE INTERNAL "" FORCE)
FetchContent_MakeAvailable(oneTBB)

configure_file(src/version.hpp.in version.hpp)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -pipe -g -ggdb3 -Wno-unused-function -Wno-deprecated-declarations")
#-DDEBUG_PARSIMONY_SCORE_CHANGE_CORRECT -fsanitize=address -DCHECK_PAR_MAIN -DEASY_DEBUG -DSTOP_ON_ERROR -DDETAILED_MERGER_CHECK -O0
set(CMAKE_CXX_FLAGS_DEBUG " -fno-eliminate-unused-debug-symbols -O0")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O3")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 ")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--copy-dt-needed-entries")

if(DEFINED Protobuf_PATH)
find_package(Protobuf REQUIRED HINTS ${Protobuf_PATH})
Expand All @@ -39,11 +53,7 @@ find_package(MPI REQUIRED)
include_directories(SYSTEM ${MPI_INCLUDE_PATH})
include_directories(${Protobuf_INCLUDE_DIRS})

include(${TBB_DIR}/cmake/TBBBuild.cmake)
tbb_build(TBB_ROOT ${TBB_DIR} CONFIG_DIR TBB_DIR MAKE_ARGS tbb_cpf=1)
find_package(TBB REQUIRED tbbmalloc tbbmalloc_proxy tbb_preview)

FIND_PACKAGE(Boost COMPONENTS program_options iostreams filesystem date_time REQUIRED)
FIND_PACKAGE(Boost COMPONENTS program_options iostreams filesystem date_time REQUIRED CONFIG)

#find_package(OpenMP REQUIRED)

Expand Down Expand Up @@ -475,47 +485,48 @@ endif()

if(SAVE_PROFILE)
if(DEBUG)
TARGET_COMPILE_OPTIONS(usher PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DSAVE_PROFILE=1 -DDEBUG=1)
TARGET_COMPILE_OPTIONS(usher PRIVATE -DSAVE_PROFILE=1 -DDEBUG=1)
else(DEBUG)
TARGET_COMPILE_OPTIONS(usher PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DSAVE_PROFILE=1)
TARGET_COMPILE_OPTIONS(usher PRIVATE -DSAVE_PROFILE=1)
endif(DEBUG)
else(SAVE_PROFILE)
if(DEBUG)
TARGET_COMPILE_OPTIONS(usher PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DDEBUG=1)
TARGET_COMPILE_OPTIONS(usher PRIVATE -DDEBUG=1)
else(DEBUG)
TARGET_COMPILE_OPTIONS(usher PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES)
TARGET_COMPILE_OPTIONS(usher PRIVATE )
endif(DEBUG)
endif(SAVE_PROFILE)
#set_property(TARGET matOptimize PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
TARGET_LINK_LIBRARIES(compareVCF PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(compareVCF PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)


TARGET_LINK_LIBRARIES(check_samples_place PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ${ISAL_LIB} ) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(matOptimize PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ${ISAL_LIB} ) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(usher-sampled PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ${ISAL_LIB} ) # OpenMP::OpenMP_CXX)
#TARGET_LINK_LIBRARIES(output_final_protobuf PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(transpose_vcf PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(transposed_vcf_to_vcf PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(transposed_vcf_to_fa PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(transposed_vcf_print_name PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(check_samples_place PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ${ISAL_LIB} ) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(matOptimize PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ${ISAL_LIB} ) # OpenMP::OpenMP_CXX)
target_include_directories(usher-sampled PUBLIC taskflow)
TARGET_LINK_LIBRARIES(usher-sampled PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ${ISAL_LIB} ) # OpenMP::OpenMP_CXX)
#TARGET_LINK_LIBRARIES(output_final_protobuf PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(transpose_vcf PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(transposed_vcf_to_vcf PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(transposed_vcf_to_fa PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(transposed_vcf_print_name PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)

TARGET_LINK_LIBRARIES(usher PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(usher PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
target_include_directories(usher PUBLIC "${PROJECT_BINARY_DIR}")

TARGET_COMPILE_OPTIONS(matUtils PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES)
TARGET_LINK_LIBRARIES(matUtils PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
TARGET_COMPILE_OPTIONS(matUtils PRIVATE)
TARGET_LINK_LIBRARIES(matUtils PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)

TARGET_LINK_LIBRARIES(ripplesUtils PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(ripplesInit PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(ripplesUtils PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(ripplesInit PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)

TARGET_COMPILE_OPTIONS(ripples PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES)
TARGET_LINK_LIBRARIES(ripples PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(ripples-fast PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
TARGET_COMPILE_OPTIONS(ripples PRIVATE)
TARGET_LINK_LIBRARIES(ripples PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(ripples-fast PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES}) # OpenMP::OpenMP_CXX)

if(USHER_SERVER)
TARGET_COMPILE_OPTIONS(usher_server PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES)
TARGET_LINK_LIBRARIES(usher_server PRIVATE stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(usher-sampled-server PRIVATE stdc++ ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ${ISAL_LIB} ) # OpenMP::OpenMP_CXX)
TARGET_COMPILE_OPTIONS(usher_server PRIVATE)
TARGET_LINK_LIBRARIES(usher_server PRIVATE stdc++ ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB) # OpenMP::OpenMP_CXX)
TARGET_LINK_LIBRARIES(usher-sampled-server PRIVATE stdc++ ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} TBB::tbb ${Protobuf_LIBRARIES} ZLIB::ZLIB ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} ${ISAL_LIB} ) # OpenMP::OpenMP_CXX)
install(TARGETS usher matUtils matOptimize ripples usher_server DESTINATION bin)
else()
install(TARGETS usher matUtils matOptimize ripples DESTINATION bin)
Expand Down
174 changes: 80 additions & 94 deletions src/check_samples_place/check_samples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <cstdio>
#include <string>
#include <tbb/concurrent_unordered_set.h>
#include <tbb/task.h>
#include <tbb/task_group.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
Expand Down Expand Up @@ -37,123 +37,109 @@ void ins_mut(Mutation_Set &parent_mutations,const Mutation_Annotated_Tree::Mutat
}
}
//functor for getting state of all leaves
struct insert_samples_worker:public tbb::task {
const Mutation_Annotated_Tree::Node *root; //starting node whose subtree need to be processed
Mutation_Set parent_mutations; //mutation of parent of "root" relative to the root of the entire tree
Original_State_t &samples; //output
insert_samples_worker(const Mutation_Annotated_Tree::Node *root,
void insert_samples_worker(const Mutation_Annotated_Tree::Node *root,
const Mutation_Set &parent_mutations,
Original_State_t &samples)
: root(root), parent_mutations(parent_mutations),
samples(samples) {}
tbb::task* execute() override {
//add mutation of "root"
for (const Mutation_Annotated_Tree::Mutation &m : root->mutations) {
if(m.is_valid()||root->is_leaf()) {
ins_mut(parent_mutations, m,root->is_leaf());
}
}
//output
if (root->is_leaf()) {
samples.insert(std::make_pair(root->node_id, parent_mutations));
}
//continuation
tbb::empty_task* empty=new(allocate_continuation()) tbb::empty_task();
//spawn a task for each children
empty->set_ref_count(root->children.size());
for (auto child : root->children) {
assert(child->parent==root);
empty->spawn(*new (empty->allocate_child())insert_samples_worker(child, parent_mutations, samples));
Original_State_t &samples,
tbb::task_group &tg) {
//add mutation of "root"
Mutation_Set local_parent_mutations = parent_mutations;
for (const Mutation_Annotated_Tree::Mutation &m : root->mutations) {
if(m.is_valid()||root->is_leaf()) {
ins_mut(local_parent_mutations, m,root->is_leaf());
}
//bypass the scheduler to execute continuation task directly to fix ref count
// if no child spawned (otherwise it will hang)
return root->children.empty()?empty:nullptr;
}
};
//output
if (root->is_leaf()) {
samples.insert(std::make_pair(root->node_id, local_parent_mutations));
}
//spawn a task for each children
for (auto child : root->children) {
assert(child->parent==root);
tg.run([=, &samples, &tg]() {
insert_samples_worker(child, local_parent_mutations, samples, tg);
});
}
}

//functor for checking state of all leaves
struct check_samples_worker:public tbb::task {
const Mutation_Annotated_Tree::Node *root;
Mutation_Set parent_mutations;
const Original_State_t &samples;
tbb::concurrent_unordered_set<size_t>& visited_samples;
const MAT::Tree* tree;
check_samples_worker(const Mutation_Annotated_Tree::Node *root,
void check_samples_worker(const Mutation_Annotated_Tree::Node *root,
const Mutation_Set& parent_mutations,
const Original_State_t &samples,
tbb::concurrent_unordered_set<size_t>& visited_samples
,const MAT::Tree* tree):root(root),parent_mutations(parent_mutations),samples(samples),visited_samples(visited_samples),tree(tree) {}
tbb::task* execute() override {
tbb::empty_task* empty=new(allocate_continuation()) tbb::empty_task();
empty->set_ref_count(root->children.size());
for (const Mutation_Annotated_Tree::Mutation &m : root->mutations) {
if(m.is_valid()||root->is_leaf()) {
ins_mut(parent_mutations, m,root->is_leaf());
};
}
tbb::concurrent_unordered_set<size_t>& visited_samples,
const MAT::Tree* tree,
tbb::task_group &tg) {
Mutation_Set local_parent_mutations = parent_mutations;
for (const Mutation_Annotated_Tree::Mutation &m : root->mutations) {
if(m.is_valid()||root->is_leaf()) {
ins_mut(local_parent_mutations, m,root->is_leaf());
};
}

if (root->is_leaf()) {
auto iter = samples.find(root->node_id);
if (iter == samples.end()) {
fprintf(stderr, "[ERROR] Extra Sample %s \n",
tree->get_node_name(root->node_id).c_str());
//raise(SIGTRAP);
} else {
Mutation_Set to_check(iter->second);
for (auto m : parent_mutations) {
auto m_iter = to_check.find(m);
if (m_iter == to_check.end()) {
fprintf(
stderr,
"[ERROR] Extra mutation to\t%c\%d\t of Sample\t%s at bfs_index %zu \n",
Mutation_Annotated_Tree::get_nuc(m.get_all_major_allele()), m.get_position(),
tree->get_node_name(root->node_id).c_str(),root->bfs_index);
//raise(SIGTRAP);
if (root->is_leaf()) {
auto iter = samples.find(root->node_id);
if (iter == samples.end()) {
fprintf(stderr, "[ERROR] Extra Sample %s \n",
tree->get_node_name(root->node_id).c_str());
//raise(SIGTRAP);
} else {
Mutation_Set to_check(iter->second);
for (auto m : local_parent_mutations) {
auto m_iter = to_check.find(m);
if (m_iter == to_check.end()) {
fprintf(
stderr,
"[ERROR] Extra mutation to\t%c\%d\t of Sample\t%s at bfs_index %zu \n",
Mutation_Annotated_Tree::get_nuc(m.get_all_major_allele()), m.get_position(),
tree->get_node_name(root->node_id).c_str(),root->bfs_index);
//raise(SIGTRAP);

} else {
if (!(m.get_all_major_allele()&m_iter->get_all_major_allele())) {
fprintf(stderr, "Mut Nuc Mismatch at \t %d of sample \t %s at bfs_index \t %zu: original \t %d , altered :\t %d \n",m.get_position(),tree->get_node_name(root->node_id).c_str(),root->bfs_index,(int)m_iter->get_all_major_allele(),(int)m.get_all_major_allele());
//raise(SIGTRAP);
}
to_check.erase(m_iter);
} else {
if (!(m.get_all_major_allele()&m_iter->get_all_major_allele())) {
fprintf(stderr, "Mut Nuc Mismatch at \t %d of sample \t %s at bfs_index \t %zu: original \t %d , altered :\t %d \n",m.get_position(),tree->get_node_name(root->node_id).c_str(),root->bfs_index,(int)m_iter->get_all_major_allele(),(int)m.get_all_major_allele());
//raise(SIGTRAP);
}
to_check.erase(m_iter);
}
}

for (auto m_left : to_check) {
if (m_left.get_all_major_allele()&m_left.get_par_one_hot()) {
continue;
}
fprintf(stderr,
"[ERROR] Lost mutation to\t%c\t%d\t of Sample\t%s at bfs_index %zu \n",
Mutation_Annotated_Tree::get_nuc(m_left.get_all_major_allele()),
m_left.get_position(), tree->get_node_name(root->node_id).c_str(),root->bfs_index);
//raise(SIGTRAP);
for (auto m_left : to_check) {
if (m_left.get_all_major_allele()&m_left.get_par_one_hot()) {
continue;
}

visited_samples.insert(iter->first);
fprintf(stderr,
"[ERROR] Lost mutation to\t%c\t%d\t of Sample\t%s at bfs_index %zu \n",
Mutation_Annotated_Tree::get_nuc(m_left.get_all_major_allele()),
m_left.get_position(), tree->get_node_name(root->node_id).c_str(),root->bfs_index);
//raise(SIGTRAP);
}
return empty;

visited_samples.insert(iter->first);
}
for (auto child : root->children) {
if (child->parent!=root) {
fprintf(stderr, "%lx\n", (long)child);
//std::raise(SIGTRAP);
}
empty->spawn(*new (empty->allocate_child())check_samples_worker(child, parent_mutations, samples,visited_samples,tree));
return;
}
for (auto child : root->children) {
if (child->parent!=root) {
fprintf(stderr, "%lx\n", (long)child);
//std::raise(SIGTRAP);
}
return nullptr;
tg.run([=, &samples, &visited_samples, &tg]() {
check_samples_worker(child, local_parent_mutations, samples, visited_samples, tree, tg);
});
}
};
}
//top level
void check_samples(const Mutation_Annotated_Tree::Node *root,
Original_State_t &samples,const MAT::Tree* tree,bool ignore_missed_samples) {
Mutation_Set mutations;
if (samples.empty()) {
tbb::task::spawn_root_and_wait(*new(tbb::task::allocate_root())
insert_samples_worker(root, mutations, samples));
tbb::task_group tg;
insert_samples_worker(root, mutations, samples, tg);
tg.wait();
} else {
tbb::concurrent_unordered_set<size_t> visited_sample;
tbb::task::spawn_root_and_wait(*new(tbb::task::allocate_root())check_samples_worker(root, mutations, samples,visited_sample,tree));
tbb::task_group tg;
check_samples_worker(root, mutations, samples, visited_sample, tree, tg);
tg.wait();
if (!ignore_missed_samples) {
bool have_missed=false;
for (auto s : samples) {
Expand Down
Loading