Skip to content

Commit

Permalink
Merge pull request #216 from h-2/bifm_macro
Browse files Browse the repository at this point in the history
[misc] deactivate BIFM by default
  • Loading branch information
sarahet committed Jul 13, 2023
2 parents 35e7204 + 79f0bf0 commit 40fff6c
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 19 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ----------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.")

Expand Down
5 changes: 5 additions & 0 deletions src/mkindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ void argConv0(LambdaIndexerOptions & options)
case DbIndexType::FM_INDEX:
return argConv1<DbIndexType::FM_INDEX>(options);
case DbIndexType::BI_FM_INDEX:
#if LAMBDA_WITH_BIFM
return argConv1<DbIndexType::BI_FM_INDEX>(options);
#else
throw std::runtime_error{
"To create bidirectional indexes, you need to rebuild lambda with LAMBDA_WITH_BIFM=1 ."};
#endif
default:
throw 42;
}
Expand Down
5 changes: 5 additions & 0 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,12 @@ void argConv0(LambdaOptions & options)
case DbIndexType::FM_INDEX:
return argConv1<DbIndexType::FM_INDEX>(options);
case DbIndexType::BI_FM_INDEX:
#if LAMBDA_WITH_BIFM
return argConv1<DbIndexType::BI_FM_INDEX>(options);
#else
throw std::runtime_error{
"To open bidirectional indexes, you need to rebuild lambda with LAMBDA_WITH_BIFM=1 ."};
#endif
default:
throw 52;
}
Expand Down
4 changes: 4 additions & 0 deletions src/shared_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ==========================================================================
Expand Down
40 changes: 22 additions & 18 deletions test/cli/index_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions test/cli/search_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 40fff6c

Please sign in to comment.