Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ endif(MPI_FOUND AND USE_MPI)

configure_file("${PROJECT_SOURCE_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/config.h")

set(core_SRCS ehhfinder.cpp ihsfinder.cpp hapmap.cpp hapbin.cpp)
set(core_SRCS ehhfinder.cpp ihsfinder.cpp ehhfinder.cpp hapmap.cpp hapbin.cpp ehhfinder-impl.hpp)
add_library(hapbin SHARED ${core_SRCS})
set_target_properties(hapbin PROPERTIES VERSION 0 SOVERSION 0.0.0)

Expand Down Expand Up @@ -109,7 +109,7 @@ install(TARGETS ihsbin DESTINATION bin)
install(TARGETS ehhbin DESTINATION bin)
install(TARGETS xpehhbin DESTINATION bin)
install(TARGETS hapbinconv DESTINATION bin)
install(FILES calcmpiselect.hpp calcnompiselect.hpp calcselect.hpp argparse.hpp hapmap.hpp hapbin.hpp ihsfinder.hpp ehhfinder.hpp DESTINATION include/hapbin)
install(FILES calcmpiselect.hpp calcnompiselect.hpp calcselect.hpp argparse.hpp hapmap.hpp hapbin.hpp ihsfinder.hpp ihsfinder-impl.hpp ehhfinder-impl.hpp DESTINATION include/hapbin)

include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hapbin is a fast and efficient implementation of EHH and iHS calculations using a bitwise algorithm.")
Expand Down
48 changes: 31 additions & 17 deletions src/calcmpiselect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ ParameterStream& operator>>(ParameterStream& in, XPEHH& info)

void calcIhsMpi(const std::string& hapfile,
const std::string& mapfile,
const std::string& outfile,
double cutoff,
double minMAF,
double scale,
unsigned long long maxExtend,
int binFactor)
const std::string& outfile,
double cutoff,
double minMAF,
double scale,
unsigned long long maxExtend,
int binFactor,
bool binom)
{
std::cout << "Calculating iHS using MPI." << std::endl;
HapMap hap;
Expand Down Expand Up @@ -101,7 +102,10 @@ void calcIhsMpi(const std::string& hapfile,
mpirpc::ObjectWrapperBase* mainihsfinder = *(manager->getObjectsOfType<IHSFinder>().cbegin());
mpirpc::FunctionHandle runEHH = manager->registerLambda([&](std::size_t start, std::size_t end) {
std::cout << "Computing EHH for " << (end-start) << " lines on rank " << manager->rank() << std::endl;
ihsfinder->run(&hap, start, end);
if (binom)
ihsfinder->run<true>(&hap, start, end);
else
ihsfinder->run<false>(&hap, start, end);
IHSFinder::LineMap fbl = ihsfinder->freqsByLine();
manager->invokeFunction(mainihsfinder, &IHSFinder::addData, false, fbl, ihsfinder->unStdIHSByLine(), ihsfinder->unStdIHSByFreq(), ihsfinder->numReachedEnd(), ihsfinder->numOutsideMaf(), ihsfinder->numNanResults());
manager->invokeFunction(0, done);
Expand Down Expand Up @@ -132,7 +136,10 @@ void calcIhsMpi(const std::string& hapfile,
std::size_t end = snpsPerRank;
if (manager->numProcs() == 1)
end = numSnps;
ihsfinder->run(&hap, 0UL, end);
if (binom)
ihsfinder->run<true>(&hap, 0UL, end);
else
ihsfinder->run<false>(&hap, 0UL, end);
--procsToGo;
}

Expand Down Expand Up @@ -178,13 +185,14 @@ void calcIhsMpi(const std::string& hapfile,

void calcXpehhMpi(const std::string& hapA,
const std::string& hapB,
const std::string& mapfile,
const std::string& outfile,
double cutoff,
double minMAF,
double scale,
unsigned long long maxExtend,
int binFactor)
const std::string& mapfile,
const std::string& outfile,
double cutoff,
double minMAF,
double scale,
unsigned long long maxExtend,
int binFactor,
bool binom)
{
std::cout << "Calculating XPEHH using MPI." << std::endl;
HapMap mA, mB;
Expand Down Expand Up @@ -229,7 +237,10 @@ void calcXpehhMpi(const std::string& hapA,
mpirpc::ObjectWrapperBase* mainihsfinder = *(manager->getObjectsOfType<IHSFinder>().cbegin());
mpirpc::FunctionHandle runXPEHH = manager->registerLambda([&](std::size_t start, std::size_t end) {
std::cout << "Computing XPEHH for " << (end-start) << " lines on rank " << manager->rank() << std::endl;
ihsfinder->runXpehh(&mA, &mB, start, end);
if (binom)
ihsfinder->runXpehh<true>(&mA, &mB, start, end);
else
ihsfinder->runXpehh<false>(&mA, &mB, start, end);
IHSFinder::LineMap fbl = ihsfinder->freqsByLine();
manager->invokeFunction(mainihsfinder, &IHSFinder::addXData, false, fbl, ihsfinder->unStdXIHSByLine(), ihsfinder->unStdIHSByFreq(), ihsfinder->numReachedEnd(), ihsfinder->numOutsideMaf(), ihsfinder->numNanResults());
manager->invokeFunction(0, done);
Expand Down Expand Up @@ -261,7 +272,10 @@ void calcXpehhMpi(const std::string& hapA,
std::size_t end = snpsPerRank;
if (manager->numProcs() == 1)
end = numSnps;
ihsfinder->runXpehh(&mA, &mB, 0ULL, end);
if (binom)
ihsfinder->runXpehh<true>(&mA, &mB, 0ULL, end);
else
ihsfinder->runXpehh<false>(&mA, &mB, 0ULL, end);
--procsToGo;
}

Expand Down
Loading