diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 654553a1b..86ed2561a 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -21,6 +21,13 @@ jobs: fail-fast: false matrix: include: + - name: "gcc12 bifm" + install: "g++-12" + cxx: "g++-12" + cmake_flags: "-DLAMBDA_WITH_BIFM=1" + cc: "gcc-12" + build_type: Release + - name: "gcc12" install: "g++-12" cxx: "g++-12" @@ -94,7 +101,7 @@ jobs: run: | mkdir build cd build - cmake ../lambda -DLAMBDA_COMPILE_THREADS=2 -DLAMBDA_NATIVE_BUILD=OFF -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache + cmake ../lambda -DLAMBDA_COMPILE_THREADS=2 -DLAMBDA_NATIVE_BUILD=OFF ${{ matrix.cmake_flags }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache - name: Build tests if: matrix.name != 'clang_format' diff --git a/CMakeLists.txt b/CMakeLists.txt index 464471be2..5c1e1d8bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,16 @@ if (NOT CMAKE_BUILD_TYPE) FORCE) endif () +# ---------------------------------------------------------------------------- +# Options +# ---------------------------------------------------------------------------- + +option (LAMBDA_WITH_BIFM "Include codepaths for bidirectional indexes." OFF) + +if (LAMBDA_WITH_BIFM) + add_definitions (-DLAMBDA_WITH_BIFM=1) +endif () + # ---------------------------------------------------------------------------- # Begin of dependency detection # ---------------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d54b3a563..447998966 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ message ("\n${ColourBold}Build configuration${ColourReset}") message (STATUS "LAMBDA version is: ${SEQAN_APP_VERSION}") option (LAMBDA_STATIC_BUILD "Include all libraries in the binaries." OFF) +option (LAMBDA_WITH_BIFM "Include codepaths for bidirectional indexes." OFF) if (LAMBDA_STATIC_BUILD) add_definitions (-DLAMBDA_STATIC_BUILD=1) @@ -47,9 +48,13 @@ if (LAMBDA_STATIC_BUILD) endif (CMAKE_SYSTEM_NAME MATCHES "Linux") endif (LAMBDA_STATIC_BUILD) +if (LAMBDA_WITH_BIFM) + add_definitions (-DLAMBDA_WITH_BIFM=1) +endif () message(STATUS "The following options are selected for the build:") message( " LAMBDA_STATIC_BUILD ${LAMBDA_STATIC_BUILD}") +message( " LAMBDA_WITH_BIFM ${LAMBDA_WITH_BIFM}") message(STATUS "Run 'cmake -LH' to get a comment on each option.") message(STATUS "Remove CMakeCache.txt and re-run cmake with -DOPTIONNAME=ON|OFF to change an option.") diff --git a/src/mkindex.cpp b/src/mkindex.cpp index 915667cef..5de6b079e 100644 --- a/src/mkindex.cpp +++ b/src/mkindex.cpp @@ -103,7 +103,12 @@ void argConv0(LambdaIndexerOptions & options) case DbIndexType::FM_INDEX: return argConv1(options); case DbIndexType::BI_FM_INDEX: +#if LAMBDA_WITH_BIFM return argConv1(options); +#else + throw std::runtime_error{ + "To create bidirectional indexes, you need to rebuild lambda with LAMBDA_WITH_BIFM=1 ."}; +#endif default: throw 42; } diff --git a/src/search.cpp b/src/search.cpp index 374dd1f88..a25e94a8c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -248,7 +248,12 @@ void argConv0(LambdaOptions & options) case DbIndexType::FM_INDEX: return argConv1(options); case DbIndexType::BI_FM_INDEX: +#if LAMBDA_WITH_BIFM return argConv1(options); +#else + throw std::runtime_error{ + "To open bidirectional indexes, you need to rebuild lambda with LAMBDA_WITH_BIFM=1 ."}; +#endif default: throw 52; } diff --git a/src/shared_definitions.hpp b/src/shared_definitions.hpp index e6512914c..4e1e4e4a2 100644 --- a/src/shared_definitions.hpp +++ b/src/shared_definitions.hpp @@ -51,6 +51,10 @@ #include "view_duplicate.hpp" #include "view_reduce_to_bisulfite.hpp" +#ifndef LAMBDA_WITH_BIFM +# define LAMBDA_WITH_BIFM 0 +#endif + // ========================================================================== // DbIndexType // ========================================================================== diff --git a/test/cli/index_test.cpp b/test/cli/index_test.cpp index 5673fc2df..09d33b84e 100644 --- a/test/cli/index_test.cpp +++ b/test/cli/index_test.cpp @@ -135,44 +135,48 @@ TEST_F(index_test, nucl_fm) run_index_test("mkindexn", "db_nucl.fasta.gz", "db_nucl_fm_test.fasta.gz.lba", "fm", "", "db_nucl_fm.fasta.gz.lba"); } -TEST_F(index_test, nucl_bifm) -{ - run_index_test("mkindexn", "db_nucl.fasta.gz", "db_nucl_bifm_test.fasta.gz.lba", "bifm", "", - "db_nucl_bifm.fasta.gz.lba"); -} - TEST_F(index_test, nucl_bs_fm) { run_index_test("mkindexbs", "db_nucl_bs.fasta.gz", "db_nucl_bs_fm_test.fasta.gz.lba", "fm", "", "db_nucl_bs_fm.fasta.gz.lba"); } -TEST_F(index_test, nucl_bs_bifm) -{ - run_index_test("mkindexbs", "db_nucl_bs.fasta.gz", "db_nucl_bs_bifm_test.fasta.gz.lba", "bifm", "", - "db_nucl_bs_bifm.fasta.gz.lba"); -} - TEST_F(index_test, prot_fm) { run_index_test("mkindexp", "db_prot.fasta.gz", "db_prot_fm_test.fasta.gz.lba", "fm", "li10", "db_prot_fm.fasta.gz.lba"); } -TEST_F(index_test, prot_bifm) -{ - run_index_test("mkindexp", "db_prot.fasta.gz", "db_prot_bifm_test.fasta.gz.lba", "bifm", "li10", - "db_prot_bifm.fasta.gz.lba"); -} - TEST_F(index_test, trans_fm) { run_index_test("mkindexp", "db_nucl.fasta.gz", "db_trans_fm_test.fasta.gz.lba", "fm", "li10", "db_trans_fm.fasta.gz.lba"); } +#if LAMBDA_WITH_BIFM + +TEST_F(index_test, nucl_bifm) +{ + run_index_test("mkindexn", "db_nucl.fasta.gz", "db_nucl_bifm_test.fasta.gz.lba", "bifm", "", + "db_nucl_bifm.fasta.gz.lba"); +} + +TEST_F(index_test, nucl_bs_bifm) +{ + run_index_test("mkindexbs", "db_nucl_bs.fasta.gz", "db_nucl_bs_bifm_test.fasta.gz.lba", "bifm", "", + "db_nucl_bs_bifm.fasta.gz.lba"); +} + +TEST_F(index_test, prot_bifm) +{ + run_index_test("mkindexp", "db_prot.fasta.gz", "db_prot_bifm_test.fasta.gz.lba", "bifm", "li10", + "db_prot_bifm.fasta.gz.lba"); +} + TEST_F(index_test, trans_bifm) { run_index_test("mkindexp", "db_nucl.fasta.gz", "db_trans_bifm_test.fasta.gz.lba", "bifm", "li10", "db_trans_bifm.fasta.gz.lba"); } + +#endif diff --git a/test/cli/search_test.cpp b/test/cli/search_test.cpp index e23853d9f..35beef929 100644 --- a/test/cli/search_test.cpp +++ b/test/cli/search_test.cpp @@ -395,6 +395,8 @@ TEST_F(search_test, tblastx_fm_bam) // Search with bi-directional index +#if LAMBDA_WITH_BIFM + // TEST_F(search_test, blastn_bifm_m8) // { // run_search_test("mkindexn", "db_nucl.fasta.gz", "db_nucl_bifm.fasta.gz.lba", "bifm", "", "searchn", @@ -467,6 +469,8 @@ TEST_F(search_test, tblastx_bifm_sam) "queries_nucl.fasta.gz", "none", "output_tblastx_bifm_test.sam", "sam", "output_tblastx_fm.sam"); } +#endif + // Fast mode TEST_F(search_test, blastn_fm_fast_m8)