diff --git a/.github/workflows/racon.yml b/.github/workflows/racon.yml new file mode 100644 index 0000000..c0832bb --- /dev/null +++ b/.github/workflows/racon.yml @@ -0,0 +1,53 @@ +name: racon CI + +on: + push: + pull_request: + branches: + - master + +env: + BUILD_TYPE: Release + +jobs: + test: + strategy: + matrix: + compiler: + - g++ + - g++-4.8 + - clang++ + - clang++-4.0 + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + + - if: ${{ matrix.compiler == 'g++-4.8' }} + name: Setup GCC + uses: egor-tensin/setup-gcc@v1 + with: + version: "4.8" + platform: x64 + + - if: ${{ matrix.compiler == 'clang++-4.0' }} + name: Setup Clang + uses: egor-tensin/setup-clang@v1 + with: + version: "4.0" + platform: x64 + + - name: Configure CMake + run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} + env: + CXX: ${{ matrix.compiler }} + + - name: Build + run: cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} + + - name: Test + working-directory: ${{ github.workspace }}/build + run: | + bin/racon --version + bin/racon_test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fef0b99..0000000 --- a/.travis.yml +++ /dev/null @@ -1,47 +0,0 @@ -dist: trusty - -language: cpp - -matrix: - include: - - name: "GCC 4.8 (Linux)" # GCC 4.8.5 & CMake 3.9.2 - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 - - cmake - env: - - SET_COMPILER="export CC=gcc-4.8 && export CXX=g++-4.8" - - - name: "Clang 3.5 (Linux)" # Clang 3.5.0 & CMake 3.9.2 - os: linux - addons: - apt: - sources: - - llvm-toolchain-trusty-3.5 - packages: - - clang-3.5 - - cmake - env: - - SET_COMPILER="export CC=clang-3.5 && export CXX=clang++-3.5" - -before_install: - - eval "${SET_COMPILER}" - - git clone https://github.com/google/googletest && cd googletest && mkdir build && cd build && git checkout 703bd9c - - cmake -DCMAKE_CXX_FLAGS="-std=c++11" .. && make && sudo make install - - cd ../../ - -install: - - mkdir build && cd build - - cmake -Dspoa_build_executable=ON -Dracon_build_tests=ON -Dracon_build_wrapper=ON -DCMAKE_BUILD_TYPE=Release .. && make - -script: - - ./bin/racon --version - - ./bin/racon_test - -notifications: - email: - on_failure: always diff --git a/CMakeLists.txt b/CMakeLists.txt index 194c31d..9332c7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,152 +1,266 @@ -cmake_minimum_required(VERSION 3.2) -project(racon) -set(racon_version 1.4.22) +cmake_minimum_required(VERSION 3.11) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) +project(racon VERSION 1.5.0 + LANGUAGES CXX + DESCRIPTION "Racon is a consensus module for de novo genome assembly.") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -option(racon_build_tests "Build racon unit tests" OFF) -option(racon_build_wrapper "Build racon wrapper" OFF) -option(racon_enable_cuda "Build racon with NVIDIA CUDA support" OFF) - -# Check CUDA compatibility. -if(racon_enable_cuda) - find_package(CUDA 9.0 QUIET REQUIRED) - if(NOT ${CUDA_FOUND}) - message(FATAL_ERROR "CUDA not detected on system. Please install") - else() - message(STATUS "Using CUDA ${CUDA_VERSION} from ${CUDA_TOOLKIT_ROOT_DIR}") - set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -lineinfo") - endif() -endif() +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + +include(FetchContent) +include(GNUInstallDirs) + +if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + set(racon_main_project ON) +endif () +option(racon_build_tests "Build unit tests" ${racon_main_project}) +option(racon_build_wrapper "Build wrapper" OFF) +option(racon_enable_cuda "Build with NVIDIA CUDA support" OFF) + +find_package(bioparser 3.0.15 QUIET) +if (NOT bioparser_FOUND) + FetchContent_Declare( + bioparser + GIT_REPOSITORY https://github.com/rvaser/bioparser + GIT_TAG 3.0.15) + + FetchContent_GetProperties(bioparser) + if (NOT bioparser_POPULATED) + FetchContent_Populate(bioparser) + add_subdirectory( + ${bioparser_SOURCE_DIR} + ${bioparser_BINARY_DIR} + EXCLUDE_FROM_ALL) + endif () +endif () + +find_package(edlib 1.2.7 QUIET) +if (NOT edlib_FOUND) + FetchContent_Declare( + edlib + GIT_REPOSITORY https://github.com/martinsos/edlib + GIT_TAG v1.2.7) + + FetchContent_GetProperties(edlib) + if (NOT edlib_POPULATED) + FetchContent_Populate(edlib) + add_subdirectory( + ${edlib_SOURCE_DIR} + ${edlib_BINARY_DIR} + EXCLUDE_FROM_ALL) + endif () +endif () -include_directories(${PROJECT_SOURCE_DIR}/src) +find_package(spoa 4.0.8 QUIET) +if (NOT spoa_FOUND) + FetchContent_Declare( + spoa + GIT_REPOSITORY https://github.com/rvaser/spoa + GIT_TAG 4.0.8) + + FetchContent_GetProperties(spoa) + if (NOT spoa_POPULATED) + FetchContent_Populate(spoa) + add_subdirectory( + ${spoa_SOURCE_DIR} + ${spoa_BINARY_DIR} + EXCLUDE_FROM_ALL) + endif () +endif () + +find_package(thread_pool 4.0.0 QUIET) +if (NOT thread_pool_FOUND) + FetchContent_Declare( + thread_pool + GIT_REPOSITORY https://github.com/rvaser/thread_pool + GIT_TAG 4.0.0) + + FetchContent_GetProperties(thread_pool) + if (NOT thread_pool_POPULATED) + FetchContent_Populate(thread_pool) + add_subdirectory( + ${thread_pool_SOURCE_DIR} + ${thread_pool_BINARY_DIR} + EXCLUDE_FROM_ALL) + endif () +endif () + +if (racon_build_tests) + find_package(GTest 1.10.0 QUIET) + if (NOT GTest_FOUND) + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest + GIT_TAG release-1.10.0) + + FetchContent_GetProperties(googletest) + if (NOT googletest_POPULATED) + FetchContent_Populate(googletest) + add_subdirectory( + ${googletest_SOURCE_DIR} + ${googletest_BINARY_DIR} + EXCLUDE_FROM_ALL) + add_library(GTest::Main ALIAS gtest_main) + endif () + endif () +endif () + +if (racon_build_wrapper) + find_package(rampler 2.0.0 QUIET) + if (NOT rampler_FOUND) + FetchContent_Declare( + rampler + GIT_REPOSITORY https://github.com/rvaser/rampler + GIT_TAG 2.0.0) + + FetchContent_GetProperties(rampler) + if (NOT rampler_POPULATED) + FetchContent_Populate(rampler) + add_subdirectory( + ${rampler_SOURCE_DIR} + ${rampler_BINARY_DIR}) + endif () + endif () +endif () + +if (racon_enable_cuda) + find_package(CUDA 9.0 QUIET REQUIRED) + if (NOT ${CUDA_FOUND}) + message(FATAL_ERROR "CUDA not detected on system. Please install") + else () + message(STATUS "Using CUDA ${CUDA_VERSION} from ${CUDA_TOOLKIT_ROOT_DIR}") + set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -lineinfo") + endif () + if (DEFINED CLARAGENOMICSANALYSIS_SDK_PATH) + list(APPEND CMAKE_PREFIX_PATH "${CLARAGENOMICSANALYSIS_SDK_PATH}/cmake") + find_package(cudapoa REQUIRED) + find_package(cudaaligner REQUIRED) + elseif (DEFINED CLARAGENOMICSANALYSIS_SRC_PATH) + if (NOT TARGET cudapoa) + add_subdirectory( + ${CLARAGENOMICSANALYSIS_SRC_PATH} + ${CMAKE_CURRENT_BINARY_DIR}/GenomeWorks + EXCLUDE_FROM_ALL) + endif () + if (NOT TARGET cudaaligner) + add_subdirectory( + ${CLARAGENOMICSANALYSIS_SRC_PATH} + ${CMAKE_CURRENT_BINARY_DIR}/GenomeWorks + EXCLUDE_FROM_ALL) + endif () + else () + FetchContent_Declare( + genomeworks + GIT_REPOSITORY https://github.com/clara-parabricks/GenomeWorks + GIT_TAG v0.5.3) + + FetchContent_GetProperties(genomeworks) + if (NOT genomeworks_POPULATED) + FetchContent_Populate(genomeworks) + add_subdirectory( + ${genomeworks_SOURCE_DIR} + ${genomeworks_BINARY_DIR} + EXCLUDE_FROM_ALL) + endif () + endif () +endif () set(racon_sources - src/main.cpp - src/logger.cpp - src/polisher.cpp - src/overlap.cpp - src/sequence.cpp - src/window.cpp) - -if(racon_enable_cuda) - list(APPEND racon_sources src/cuda/cudapolisher.cpp src/cuda/cudabatch.cpp src/cuda/cudaaligner.cpp) - cuda_add_executable(racon ${racon_sources}) - target_compile_definitions(racon PRIVATE CUDA_ENABLED) -else() - add_executable(racon ${racon_sources}) -endif() + src/logger.cpp + src/polisher.cpp + src/overlap.cpp + src/sequence.cpp + src/window.cpp) -# Add version information to bibary. -target_compile_definitions(racon PRIVATE RACON_VERSION="v${racon_version}") +if (racon_enable_cuda) + include_directories(${PROJECT_SOURCE_DIR}/src) + list(APPEND racon_sources + src/cuda/cudapolisher.cpp + src/cuda/cudabatch.cpp + src/cuda/cudaaligner.cpp) + + cuda_add_library(racon + ${racon_sources}) + + target_compile_definitions(racon + PRIVATE CUDA_ENABLED) +else () + add_library(racon + ${racon_sources}) +endif () + +target_link_libraries(racon + bioparser::bioparser + edlib::edlib + spoa::spoa + thread_pool::thread_pool) -if (NOT TARGET bioparser) - add_subdirectory(vendor/spoa/vendor/bioparser EXCLUDE_FROM_ALL) -endif() -if (NOT TARGET spoa) - add_subdirectory(vendor/spoa EXCLUDE_FROM_ALL) -endif() -if (NOT TARGET thread_pool) - add_subdirectory(vendor/thread_pool EXCLUDE_FROM_ALL) -endif() -if (NOT TARGET edlib) - add_subdirectory(vendor/edlib EXCLUDE_FROM_ALL) -endif() if (racon_enable_cuda) - if (DEFINED CLARAGENOMICSANALYSIS_SDK_PATH) - list(APPEND CMAKE_PREFIX_PATH "${CLARAGENOMICSANALYSIS_SDK_PATH}/cmake") - find_package(cudapoa REQUIRED) - find_package(cudaaligner REQUIRED) - elseif (DEFINED CLARAGENOMICSANALYSIS_SRC_PATH) - if (NOT TARGET cudapoa) - add_subdirectory(${CLARAGENOMICSANALYSIS_SRC_PATH} ${CMAKE_CURRENT_BINARY_DIR}/GenomeWorks EXCLUDE_FROM_ALL) - endif() - if (NOT TARGET cudaaligner) - add_subdirectory(${CLARAGENOMICSANALYSIS_SRC_PATH} ${CMAKE_CURRENT_BINARY_DIR}/GenomeWorks EXCLUDE_FROM_ALL) - endif() - elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/vendor/GenomeWorks) - if (NOT TARGET cudapoa) - add_subdirectory(vendor/GenomeWorks ${CMAKE_CURRENT_BINARY_DIR}/GenomeWorks EXCLUDE_FROM_ALL) - endif() - if (NOT TARGET cudaaligner) - add_subdirectory(vendor/GenomeWorks ${CMAKE_CURRENT_BINARY_DIR}/GenomeWorks EXCLUDE_FROM_ALL) - endif() - else() - if (NOT TARGET cudapoa) - add_subdirectory(../GenomeWorks ${CMAKE_CURRENT_BINARY_DIR}/GenomeWorks EXCLUDE_FROM_ALL) - endif() - if (NOT TARGET cudaaligner) - add_subdirectory(../GenomeWorks ${CMAKE_CURRENT_BINARY_DIR}/GenomeWorks EXCLUDE_FROM_ALL) - endif() - endif() -endif() + target_link_libraries(racon + cudapoa + cudaaligner) +endif () + +target_include_directories(racon PUBLIC + $) + +add_executable(racon_exe + src/main.cpp) + +target_link_libraries(racon_exe + racon) -target_link_libraries(racon bioparser spoa thread_pool edlib_static) if (racon_enable_cuda) - target_link_libraries(racon cudapoa cudaaligner) -endif() + target_compile_definitions(racon_exe + PRIVATE CUDA_ENABLED) +endif () + +target_compile_definitions(racon_exe PRIVATE VERSION="${PROJECT_VERSION}") +set_property(TARGET racon_exe PROPERTY OUTPUT_NAME racon) -install(TARGETS racon DESTINATION bin) +install(TARGETS racon_exe DESTINATION ${CMAKE_INSTALL_BINDIR}) if (racon_build_tests) - find_package(GTest REQUIRED) - set(racon_test_data_path ${PROJECT_SOURCE_DIR}/test/data/) - configure_file("${PROJECT_SOURCE_DIR}/test/racon_test_config.h.in" - "${PROJECT_BINARY_DIR}/config/racon_test_config.h") - include_directories(${PROJECT_BINARY_DIR}/config) - include_directories(${PROJECT_SOURCE_DIR}/src) - - set(racon_test_sources - test/racon_test.cpp - src/logger.cpp - src/polisher.cpp - src/overlap.cpp - src/sequence.cpp - src/window.cpp) - - if (racon_enable_cuda) - list(APPEND racon_test_sources src/cuda/cudapolisher.cpp src/cuda/cudabatch.cpp src/cuda/cudaaligner.cpp) - cuda_add_executable(racon_test ${racon_test_sources}) - target_compile_definitions(racon_test PRIVATE CUDA_ENABLED) - else() - add_executable(racon_test ${racon_test_sources}) - endif() - - target_link_libraries(racon_test bioparser spoa thread_pool edlib_static GTest::Main) - if (racon_enable_cuda) - target_link_libraries(racon_test cudapoa cudaaligner) - endif() + add_executable(racon_test + test/racon_test.cpp) + + target_link_libraries(racon_test + racon + GTest::Main) + + target_compile_definitions(racon_test + PRIVATE TEST_DATA="${PROJECT_SOURCE_DIR}/test/data/") + + if (racon_enable_cuda) + target_compile_definitions(racon_test + PRIVATE CUDA_ENABLED) + endif () endif() if (racon_build_wrapper) - set(racon_path ${PROJECT_BINARY_DIR}/bin/racon) - set(rampler_path ${PROJECT_BINARY_DIR}/vendor/rampler/bin/rampler) - if (racon_enable_cuda) - set(racon_wrapper_enable_cuda True) - else () - set(racon_wrapper_enable_cuda False) - endif () - configure_file(${PROJECT_SOURCE_DIR}/scripts/racon_wrapper.py - ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/racon_wrapper) - file(COPY ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/racon_wrapper - DESTINATION ${PROJECT_BINARY_DIR}/bin - FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE) - - if (NOT TARGET rampler) - add_subdirectory(vendor/rampler) - endif() + set(racon_path ${PROJECT_BINARY_DIR}/bin/racon) + set(rampler_path ${PROJECT_BINARY_DIR}/_deps/rampler-build/bin/rampler) + if (racon_enable_cuda) + set(racon_wrapper_enable_cuda True) + else () + set(racon_wrapper_enable_cuda False) + endif () + configure_file(${PROJECT_SOURCE_DIR}/scripts/racon_wrapper.py + ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/racon_wrapper) + file(COPY ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/racon_wrapper + DESTINATION ${PROJECT_BINARY_DIR}/bin + FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE) endif() # Add Debian packaging SET(CPACK_GENERATOR "DEB") SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Robert Vaser") -set(CPACK_PACKAGE_VERSION "${racon_version}") +set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") include(CPack) diff --git a/Makefile b/Makefile index c989b14..54da13c 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,31 @@ -.PHONY: all clean meson cmake debug dist modules +.PHONY: all clean meson cmake debug dist all: meson clean: rm -rf build build-meson -meson: modules +VENDOR_FILES=vendor/thread_pool/README.md vendor/spoa/README.md vendor/rampler/README.md vendor/GenomeWorks/README.md + +meson: ${VENDOR_FILES} @echo "[Invoking Meson]" @mkdir -p build-meson && cd build-meson && meson --buildtype=release -Dc_args=-O3 -Dtests=true && ninja -rebuild: modules +rebuild: ${VENDOR_FILES} @echo "[Running Ninja only]" @ninja -C build-meson -cmake: modules +cmake: ${VENDOR_FILES} @echo "[Invoking CMake]" @mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -Dracon_build_tests=ON .. && make -debug: modules +debug: ${VENDOR_FILES} @echo "[Invoking Meson]" @mkdir -p build-debug && cd build-debug && (meson --buildtype=debugoptimized -Db_sanitize=address -Dtests=true) && ninja dist: release cd build && ninja-dist -modules: +vendor/%/README.md: @echo "[Fetching submodules]" @git submodule update --init diff --git a/README.md b/README.md index 8dd8fc3..3458765 100644 --- a/README.md +++ b/README.md @@ -31,22 +31,14 @@ A **wrapper script** is also available to enable easier usage to the end-user fo To install Racon run the following commands: ```bash -git clone --recursive https://github.com/lbcb-sci/racon.git racon -cd racon -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Release .. -make +git clone https://github.com/lbcb-sci/racon && cd racon && mkdir build && cd build +cmake -DCMAKE_BUILD_TYPE=Release .. && make ``` -After successful installation, an executable named `racon` will appear in `build/bin`. +After successful installation, an executable named `racon` will appear in `build/bin` (alongside unit tests `racon_test`). Optionally, you can run `sudo make install` to install racon executable to your machine. -***Note***: if you omitted `--recursive` from `git clone`, run `git submodule update --init --recursive` before proceeding with compilation. - -To build unit tests add `-Dracon_build_tests=ON` while running `cmake` (Gtest required). After installation, an executable named `racon_test` will be created in `build/bin`. - To build the wrapper script add `-Dracon_build_wrapper=ON` while running `cmake`. After installation, an executable named `racon_wrapper` (python script) will be created in `build/bin`. ### CUDA Support diff --git a/meson.build b/meson.build index 6d7e10a..50439d2 100644 --- a/meson.build +++ b/meson.build @@ -1,13 +1,13 @@ project( 'Racon', 'cpp', - version : '1.4.13', + version : '1.5.0', default_options : [ 'buildtype=release', 'warning_level=3', 'cpp_std=c++11'], license : 'MIT', - meson_version : '>= 0.48') + meson_version : '>= 0.50.0') cpp = meson.get_compiler('cpp') @@ -19,6 +19,7 @@ opt_compile_with_tests = get_option('tests') racon_warning_flags = [] racon_cpp_flags = [] +racon_macros = ['-DVERSION="' + meson.project_version() + '"'] ################ # Dependencies # @@ -101,7 +102,7 @@ racon_dep = declare_dependency( link_with: [racon_lib, vendor_lib], dependencies: [racon_thread_dep, racon_zlib_dep], version: meson.project_version(), - compile_args: racon_warning_flags + racon_cpp_flags) + compile_args: racon_warning_flags + racon_cpp_flags + racon_macros) if not meson.is_subproject() racon_bin = executable( @@ -111,12 +112,13 @@ if not meson.is_subproject() dependencies : [racon_thread_dep, racon_zlib_dep], include_directories : vendor_include_directories + racon_include_directories, link_with : [racon_lib], - cpp_args : [racon_warning_flags, racon_cpp_flags]) + cpp_args : [racon_warning_flags, racon_cpp_flags, racon_macros]) ###################### # Tests # ###################### if opt_compile_with_tests + racon_test_macros = ['-DTEST_DATA="' + meson.source_root() + '/test/data/"'] if gtest_dep.found() tests_bin = executable( 'racon_test', @@ -124,7 +126,7 @@ if not meson.is_subproject() dependencies : [racon_thread_dep, racon_zlib_dep, gtest_dep], include_directories : racon_include_directories + vendor_include_directories + racon_test_include_directories, link_with : [racon_lib, vendor_lib], - cpp_args : [racon_warning_flags, racon_cpp_flags, racon_test_extra_flags]) + cpp_args : [racon_warning_flags, racon_cpp_flags, racon_macros, racon_test_extra_flags, racon_test_macros]) endif endif diff --git a/scripts/racon_wrapper.py b/scripts/racon_wrapper.py index bd5d3c7..d95003a 100644 --- a/scripts/racon_wrapper.py +++ b/scripts/racon_wrapper.py @@ -134,7 +134,6 @@ def run(self): '--cudaaligner-band-width', str(self.cudaaligner_band_width), '--cudaaligner-batches', str(self.cudaaligner_batches), '-c', str(self.cudapoa_batches)]) - print(racon_params) for target_sequences_part in self.split_target_sequences: eprint('[RaconWrapper::run] processing data with racon') diff --git a/src/cuda/cudapolisher.cpp b/src/cuda/cudapolisher.cpp index 619b786..abfd0be 100644 --- a/src/cuda/cudapolisher.cpp +++ b/src/cuda/cudapolisher.cpp @@ -360,7 +360,7 @@ void CUDAPolisher::polish(std::vector>& dst, { thread_failed_windows.emplace_back(thread_pool_->Submit( [&](uint64_t j) -> bool { - auto it = thread_pool_->thread_ids().find(std::this_thread::get_id()); + auto it = thread_pool_->thread_map().find(std::this_thread::get_id()); return window_consensus_status_.at(j) = windows_[j]->generate_consensus( alignment_engines_[it->second], trim_); }, i)); diff --git a/src/main.cpp b/src/main.cpp index a6b1b48..74837da 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,11 +12,6 @@ #include "cuda/cudapolisher.hpp" #endif -#ifndef RACON_VERSION -#error "Undefined version for Racon. Please pass version using -DRACON_VERSION macro." -#endif - -static const char* version = RACON_VERSION; static const int32_t CUDAALIGNER_INPUT_CODE = 10000; static const int32_t CUDAALIGNER_BAND_WIDTH_INPUT_CODE = 10001; @@ -105,7 +100,7 @@ int main(int argc, char** argv) { num_threads = atoi(optarg); break; case 'v': - printf("%s\n", version); + printf("%s\n", VERSION); exit(0); case 'h': help(); diff --git a/src/polisher.cpp b/src/polisher.cpp index 46c4d02..a5826c5 100644 --- a/src/polisher.cpp +++ b/src/polisher.cpp @@ -496,7 +496,7 @@ void Polisher::polish(std::vector>& dst, for (uint64_t i = 0; i < windows_.size(); ++i) { thread_futures.emplace_back(thread_pool_->Submit( [&](uint64_t j) -> bool { - auto it = thread_pool_->thread_ids().find(std::this_thread::get_id()); // NOLINT + auto it = thread_pool_->thread_map().find(std::this_thread::get_id()); // NOLINT return windows_[j]->generate_consensus( alignment_engines_[it->second], trim_); }, i)); diff --git a/test/meson.build b/test/meson.build index 86d7c7b..e9ac3f1 100644 --- a/test/meson.build +++ b/test/meson.build @@ -8,7 +8,3 @@ racon_test_extra_flags = [] racon_test_config_h_vars = configuration_data() racon_test_config_h_vars.set('racon_test_data_path', meson.source_root() + '/test/data/') -racon_test_config_h = configure_file( - input : files('racon_test_config.h.in'), - output : 'racon_test_config.h', - configuration : racon_test_config_h_vars) diff --git a/test/racon_test.cpp b/test/racon_test.cpp index ea08aff..6f9626e 100644 --- a/test/racon_test.cpp +++ b/test/racon_test.cpp @@ -4,8 +4,6 @@ * @brief Racon unit test source file */ -#include "racon_test_config.h" - #include "sequence.hpp" #include "polisher.hpp" @@ -71,23 +69,23 @@ TEST(RaconInitializeTest, SequencesPathExtensionError) { } TEST(RaconInitializeTest, OverlapsPathExtensionError) { - EXPECT_DEATH((racon::createPolisher(racon_test_data_path + "sample_reads.fastq.gz", + EXPECT_DEATH((racon::createPolisher(std::string(TEST_DATA) + "sample_reads.fastq.gz", "", "", racon::PolisherType::kC, 500, 0, 0, 0, 0, 0, 0, 0)), ".racon::createPolisher. error: file has unsupported format extension " ".valid extensions: .mhap, .mhap.gz, .paf, .paf.gz, .sam, .sam.gz.!"); } TEST(RaconInitializeTest, TargetPathExtensionError) { - EXPECT_DEATH((racon::createPolisher(racon_test_data_path + "sample_reads.fastq.gz", - racon_test_data_path + "sample_overlaps.paf.gz", "", racon::PolisherType::kC, + EXPECT_DEATH((racon::createPolisher(std::string(TEST_DATA) + "sample_reads.fastq.gz", + std::string(TEST_DATA) + "sample_overlaps.paf.gz", "", racon::PolisherType::kC, 500, 0, 0, 0, 0, 0, 0, 0)), ".racon::createPolisher. error: file has " "unsupported format extension .valid extensions: .fasta, .fasta.gz, .fna, " ".fna.gz, .fa, .fa.gz, .fastq, .fastq.gz, .fq, .fq.gz.!"); } TEST_F(RaconPolishingTest, ConsensusWithQualities) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_overlaps.paf.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_overlaps.paf.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 5, -4, -8); initialize(); @@ -99,7 +97,7 @@ TEST_F(RaconPolishingTest, ConsensusWithQualities) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -109,8 +107,8 @@ TEST_F(RaconPolishingTest, ConsensusWithQualities) { } TEST_F(RaconPolishingTest, ConsensusWithoutQualities) { - SetUp(racon_test_data_path + "sample_reads.fasta.gz", racon_test_data_path + - "sample_overlaps.paf.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fasta.gz", std::string(TEST_DATA) + + "sample_overlaps.paf.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 5, -4, -8); initialize(); @@ -122,7 +120,7 @@ TEST_F(RaconPolishingTest, ConsensusWithoutQualities) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -133,8 +131,8 @@ TEST_F(RaconPolishingTest, ConsensusWithoutQualities) { } TEST_F(RaconPolishingTest, ConsensusWithQualitiesAndAlignments) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_overlaps.sam.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_overlaps.sam.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 5, -4, -8); initialize(); @@ -146,7 +144,7 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesAndAlignments) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -156,8 +154,8 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesAndAlignments) { } TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesAndWithAlignments) { - SetUp(racon_test_data_path + "sample_reads.fasta.gz", racon_test_data_path + - "sample_overlaps.sam.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fasta.gz", std::string(TEST_DATA) + + "sample_overlaps.sam.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 5, -4, -8); initialize(); @@ -169,7 +167,7 @@ TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesAndWithAlignments) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -179,8 +177,8 @@ TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesAndWithAlignments) { } TEST_F(RaconPolishingTest, ConsensusWithQualitiesLargerWindow) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_overlaps.paf.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_overlaps.paf.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 1000, 10, 0.3, 5, -4, -8); initialize(); @@ -192,7 +190,7 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesLargerWindow) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -202,8 +200,8 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesLargerWindow) { } TEST_F(RaconPolishingTest, ConsensusWithQualitiesEditDistance) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_overlaps.paf.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_overlaps.paf.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 1, -1, -1); initialize(); @@ -215,7 +213,7 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesEditDistance) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -225,8 +223,8 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesEditDistance) { } TEST_F(RaconPolishingTest, FragmentCorrectionWithQualities) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_ava_overlaps.paf.gz", racon_test_data_path + "sample_reads.fastq.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_ava_overlaps.paf.gz", std::string(TEST_DATA) + "sample_reads.fastq.gz", racon::PolisherType::kC, 500, 10, 0.3, 1, -1, -1); initialize(); @@ -243,8 +241,8 @@ TEST_F(RaconPolishingTest, FragmentCorrectionWithQualities) { } TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesFull) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_ava_overlaps.paf.gz", racon_test_data_path + "sample_reads.fastq.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_ava_overlaps.paf.gz", std::string(TEST_DATA) + "sample_reads.fastq.gz", racon::PolisherType::kF, 500, 10, 0.3, 1, -1, -1); initialize(); @@ -261,8 +259,8 @@ TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesFull) { } TEST_F(RaconPolishingTest, FragmentCorrectionWithoutQualitiesFull) { - SetUp(racon_test_data_path + "sample_reads.fasta.gz", racon_test_data_path + - "sample_ava_overlaps.paf.gz", racon_test_data_path + "sample_reads.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fasta.gz", std::string(TEST_DATA) + + "sample_ava_overlaps.paf.gz", std::string(TEST_DATA) + "sample_reads.fasta.gz", racon::PolisherType::kF, 500, 10, 0.3, 1, -1, -1); initialize(); @@ -279,8 +277,8 @@ TEST_F(RaconPolishingTest, FragmentCorrectionWithoutQualitiesFull) { } TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesFullMhap) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_ava_overlaps.mhap.gz", racon_test_data_path + "sample_reads.fastq.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_ava_overlaps.mhap.gz", std::string(TEST_DATA) + "sample_reads.fastq.gz", racon::PolisherType::kF, 500, 10, 0.3, 1, -1, -1); initialize(); @@ -298,8 +296,8 @@ TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesFullMhap) { #ifdef CUDA_ENABLED TEST_F(RaconPolishingTest, ConsensusWithQualitiesCUDA) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_overlaps.paf.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_overlaps.paf.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 5, -4, -8, 1); initialize(); @@ -311,7 +309,7 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesCUDA) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -321,8 +319,8 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesCUDA) { } TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesCUDA) { - SetUp(racon_test_data_path + "sample_reads.fasta.gz", racon_test_data_path + - "sample_overlaps.paf.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fasta.gz", std::string(TEST_DATA) + + "sample_overlaps.paf.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 5, -4, -8, 1); initialize(); @@ -334,7 +332,7 @@ TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesCUDA) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -344,8 +342,8 @@ TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesCUDA) { } TEST_F(RaconPolishingTest, ConsensusWithQualitiesAndAlignmentsCUDA) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_overlaps.sam.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_overlaps.sam.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 5, -4, -8, 1); initialize(); @@ -357,7 +355,7 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesAndAlignmentsCUDA) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -367,8 +365,8 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesAndAlignmentsCUDA) { } TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesAndWithAlignmentsCUDA) { - SetUp(racon_test_data_path + "sample_reads.fasta.gz", racon_test_data_path + - "sample_overlaps.sam.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fasta.gz", std::string(TEST_DATA) + + "sample_overlaps.sam.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 5, -4, -8, 1); initialize(); @@ -380,7 +378,7 @@ TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesAndWithAlignmentsCUDA) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -390,8 +388,8 @@ TEST_F(RaconPolishingTest, ConsensusWithoutQualitiesAndWithAlignmentsCUDA) { } TEST_F(RaconPolishingTest, ConsensusWithQualitiesLargerWindowCUDA) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_overlaps.paf.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_overlaps.paf.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 1000, 10, 0.3, 5, -4, -8, 1); initialize(); @@ -403,7 +401,7 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesLargerWindowCUDA) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -413,8 +411,8 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesLargerWindowCUDA) { } TEST_F(RaconPolishingTest, ConsensusWithQualitiesEditDistanceCUDA) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_overlaps.paf.gz", racon_test_data_path + "sample_layout.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_overlaps.paf.gz", std::string(TEST_DATA) + "sample_layout.fasta.gz", racon::PolisherType::kC, 500, 10, 0.3, 1, -1, -1, 1); initialize(); @@ -426,7 +424,7 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesEditDistanceCUDA) { polished_sequences[0]->create_reverse_complement(); auto parser = bioparser::Parser::Create( - racon_test_data_path + "sample_reference.fasta.gz"); + std::string(TEST_DATA) + "sample_reference.fasta.gz"); auto reference = parser->Parse(-1); EXPECT_EQ(reference.size(), 1); @@ -436,8 +434,8 @@ TEST_F(RaconPolishingTest, ConsensusWithQualitiesEditDistanceCUDA) { } TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesCUDA) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_ava_overlaps.paf.gz", racon_test_data_path + "sample_reads.fastq.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_ava_overlaps.paf.gz", std::string(TEST_DATA) + "sample_reads.fastq.gz", racon::PolisherType::kC, 500, 10, 0.3, 1, -1, -1, 1); initialize(); @@ -454,8 +452,8 @@ TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesCUDA) { } TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesFullCUDA) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_ava_overlaps.paf.gz", racon_test_data_path + "sample_reads.fastq.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_ava_overlaps.paf.gz", std::string(TEST_DATA) + "sample_reads.fastq.gz", racon::PolisherType::kF, 500, 10, 0.3, 1, -1, -1, 1); initialize(); @@ -472,8 +470,8 @@ TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesFullCUDA) { } TEST_F(RaconPolishingTest, FragmentCorrectionWithoutQualitiesFullCUDA) { - SetUp(racon_test_data_path + "sample_reads.fasta.gz", racon_test_data_path + - "sample_ava_overlaps.paf.gz", racon_test_data_path + "sample_reads.fasta.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fasta.gz", std::string(TEST_DATA) + + "sample_ava_overlaps.paf.gz", std::string(TEST_DATA) + "sample_reads.fasta.gz", racon::PolisherType::kF, 500, 10, 0.3, 1, -1, -1, 1); initialize(); @@ -490,8 +488,8 @@ TEST_F(RaconPolishingTest, FragmentCorrectionWithoutQualitiesFullCUDA) { } TEST_F(RaconPolishingTest, FragmentCorrectionWithQualitiesFullMhapCUDA) { - SetUp(racon_test_data_path + "sample_reads.fastq.gz", racon_test_data_path + - "sample_ava_overlaps.mhap.gz", racon_test_data_path + "sample_reads.fastq.gz", + SetUp(std::string(TEST_DATA) + "sample_reads.fastq.gz", std::string(TEST_DATA) + + "sample_ava_overlaps.mhap.gz", std::string(TEST_DATA) + "sample_reads.fastq.gz", racon::PolisherType::kF, 500, 10, 0.3, 1, -1, -1, 1); initialize(); diff --git a/test/racon_test_config.h.in b/test/racon_test_config.h.in deleted file mode 100644 index f5d24a4..0000000 --- a/test/racon_test_config.h.in +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * @file racon_test_config.h.in - * - * @brief Racon test configuration file - */ - -#include - -const std::string racon_test_data_path = "@racon_test_data_path@"; diff --git a/vendor/meson.build b/vendor/meson.build index 99c1621..219f8bf 100644 --- a/vendor/meson.build +++ b/vendor/meson.build @@ -4,9 +4,9 @@ vendor_cpp_sources = files([ 'rampler/src/sampler.cpp', 'spoa/src/alignment_engine.cpp', - 'spoa/src/dispatcher.cpp', 'spoa/src/graph.cpp', 'spoa/src/simd_alignment_engine_dispatch.cpp', + 'spoa/src/simd_alignment_engine_dispatcher.cpp', 'spoa/src/sisd_alignment_engine.cpp', ])