diff --git a/include/valik/search/search_local.hpp b/include/valik/search/search_local.hpp index a1cda6ce..327c6d43 100644 --- a/include/valik/search/search_local.hpp +++ b/include/valik/search/search_local.hpp @@ -78,18 +78,16 @@ bool search_local(search_arguments const & arguments, search_time_statistics & t } } - std::cout << "Launching stellar search on a shared memory machine...\n"; - stellar::stellar_runtime input_databases_time{}; - auto bin_paths = index.bin_path(); if (bin_paths.size() > 1 || bin_paths[0].size() > 1) throw std::runtime_error("Multiple reference files can not be searched in shared memory mode. " "Add --distribute argument to launch multiple distributed instances of DREAM-Stellar search."); + stellar::stellar_runtime input_databases_time{}; bool const databasesSuccess = input_databases_time.measure_time([&]() { std::cout << "Launching stellar search on a shared memory machine...\n"; - return stellar::_importAllSequences(bin_paths[0].c_str(), "database", databases, databaseIDs, refLen, std::cout, std::cerr); + return stellar::_importAllSequences(bin_paths[0][0].c_str(), "database", databases, databaseIDs, refLen, std::cout, std::cerr); }); if (!databasesSuccess) return false; diff --git a/test/cli/CMakeLists.txt b/test/cli/CMakeLists.txt index 22e1bf03..18f014c3 100644 --- a/test/cli/CMakeLists.txt +++ b/test/cli/CMakeLists.txt @@ -16,6 +16,7 @@ target_use_datasources (valik_options_test FILES bin_2.fasta) target_use_datasources (valik_options_test FILES bin_3.fasta) target_use_datasources (valik_options_test FILES query.fq) target_use_datasources (valik_options_test FILES various_chromosome_lengths.fasta) +target_use_datasources (valik_options_test FILES 150overlap4bins.txt) add_cli_test (valik_test.cpp) target_use_datasources (valik_test FILES bin_0.fasta) diff --git a/test/cli/valik_options_test.cpp b/test/cli/valik_options_test.cpp index 6d4e32a4..8e753995 100644 --- a/test/cli/valik_options_test.cpp +++ b/test/cli/valik_options_test.cpp @@ -291,3 +291,29 @@ TEST_F(argparse_search, pattern_window) EXPECT_EQ(result.out, std::string{}); EXPECT_EQ(result.err, std::string{"[Error] The minimiser window cannot be bigger than the pattern.\n"}); } + +TEST_F(argparse_search, not_dist_no_meta) +{ + cli_test_result const result = execute_app("valik", "search", + "--query ", data("query.fq"), + "--index ", data("8bins19window.ibf"), + "--output search.gff", + "--pattern 100"); + EXPECT_NE(result.exit_code, 0); + EXPECT_EQ(result.out, std::string{}); + EXPECT_EQ(result.err, std::string{"[Error] Provide --ref-meta to search a single genome or launch a --distribute run to search multiple reference files instead.\n"}); +} + +TEST_F(argparse_search, shared_mem_metagenome) +{ + cli_test_result const result = execute_app("valik", "search", + "--query ", data("query.fq"), + "--index ", data("8bins19window.ibf"), + "--output search.gff", + "--ref-meta ", data("150overlap4bins.txt"), + "--pattern 100"); + EXPECT_NE(result.exit_code, 0); + EXPECT_EQ(result.out, std::string{}); + EXPECT_EQ(result.err, std::string{"[Error] Multiple reference files can not be searched in shared memory mode. " + "Add --distribute argument to launch multiple distributed instances of DREAM-Stellar search.\n"}); +} \ No newline at end of file