Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always distribute metagenome search #135

Merged
merged 1 commit into from
Dec 12, 2024
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
8 changes: 1 addition & 7 deletions include/valik/search/search_local.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ static inline dream_stellar::StellarOptions make_thread_options(search_arguments
threadOptions.referenceLength = refLen;
threadOptions.searchSegment = true;
auto seg = ref_meta.segment_from_bin(bin_id);
//!TODO: deal with metagenome database
threadOptions.binSequences.emplace_back(seg.seq_vec[0]);
threadOptions.segmentBegin = seg.start;
threadOptions.segmentEnd = seg.start + seg.len;
Expand Down Expand Up @@ -66,10 +65,6 @@ static inline dream_stellar::StellarOptions make_thread_options(search_arguments
template <bool is_split, bool stellar_only>
bool search_local(search_arguments & arguments, search_time_statistics & time_statistics)
{
if (arguments.bin_path.size() > 1 || (arguments.bin_path.size() > 0 && arguments.bin_path[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.");

using index_structure_t = index_structure::ibf;
auto index = valik_index<index_structure_t>{};

Expand All @@ -90,7 +85,7 @@ bool search_local(search_arguments & arguments, search_time_statistics & time_st

auto prefilter_bin_count = ref_meta.seg_count;
split_arguments stellar_dist_arguments;
// distribute stellar search
// stellar search without prefiltering

// for some number of reference sequences split sequences into as many segments as is the next multiple of thread count
if (ref_meta.seq_count % arguments.threads > 0)
Expand Down Expand Up @@ -188,7 +183,6 @@ bool search_local(search_arguments & arguments, search_time_statistics & time_st
bool const databasesSuccess = input_databases_time.measure_time([&]()
{
std::cout << "Launching stellar search on a shared memory machine...\n";
//!TODO: allow metagenome database
return dream_stellar::_importAllSequences(arguments.bin_path[0][0].c_str(), "database", databases, databaseIDs, refLen, std::cout, std::cerr);
});
if (!databasesSuccess)
Expand Down
1 change: 0 additions & 1 deletion include/valik/shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ struct search_profile_arguments
//!TODO: deduce this automatically
bool split_query{false};
bool manual_parameters{false};
//!TODO: make fourth option: MINIMISER
search_kind search_type{search_kind::LEMMA};
double fnr;

Expand Down
2 changes: 2 additions & 0 deletions src/argument_parsing/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ void run_search(sharg::parser & parser)
arguments.shape_weight = arguments.shape.count();
arguments.window_size = tmp.window_size();
arguments.bin_path = tmp.bin_path();
if (arguments.bin_path.size() > 1)
arguments.distribute = true;
}

// ==========================================
Expand Down
15 changes: 0 additions & 15 deletions test/cli/valik_options_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,18 +307,3 @@ TEST_F(argparse_search, not_manual_no_meta)
EXPECT_EQ(result.out, std::string{});
EXPECT_EQ(result.err, std::string{"[Error] Provide --ref-meta to deduce suitable search parameters or set --without-parameter-tuning and --pattern size.\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.bin"),
"--pattern 100",
"--without-parameter-tuning");
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"});
}
1 change: 0 additions & 1 deletion test/cli/valik_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ TEST_P(valik_search_clusters, search)

cli_test_result const result = execute_app("valik", "search",
"--output search.gff",
"--distribute",
"--pattern", std::to_string(pattern_size),
"--query-every", std::to_string(query_every),
"--error-rate ", std::to_string(error_rate),
Expand Down
Loading