Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
34 changes: 29 additions & 5 deletions include/valik/search/search_local.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,17 @@ bool search_local(search_arguments & arguments, search_time_statistics & time_st
}
}

/*
dream_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 dream_stellar::_importAllSequences(arguments.bin_path[0].c_str(), "database", databases, databaseIDs, refLen, std::cout, std::cerr);
});
if (!databasesSuccess)
return false;

if (reverse)
{
for (auto database : databases)
Expand All @@ -199,11 +201,12 @@ bool search_local(search_arguments & arguments, search_time_statistics & time_st
seqan2::appendValue(reverseDatabases, database, seqan2::Generous());
}
}

time_statistics.ref_io_time += input_databases_time.milliseconds() / 1000;
dream_stellar::DatabaseIDMap<TAlphabet> databaseIDMap{databases, databaseIDs};
dream_stellar::DatabaseIDMap<TAlphabet> reverseDatabaseIDMap{reverseDatabases, databaseIDs};

*/

bool error_in_search = false; // indicates if an error happened inside this lambda
auto consumerThreads = std::vector<std::jthread>{};
for (size_t threadNbr = 0; threadNbr < arguments.threads; ++threadNbr)
Expand Down Expand Up @@ -257,10 +260,31 @@ bool search_local(search_arguments & arguments, search_time_statistics & time_st

dream_stellar::StellarOutputStatistics outputStatistics{};
bool threadFoundMatches{false};

seqan2::StringSet<TSequence> databases;
seqan2::StringSet<TSequence> reverseDatabases;

seqan2::StringSet<seqan2::CharString> databaseIDs;
dream_stellar::_importSequencesOfInterest(arguments.bin_path[0].c_str(),
threadOptions.binSequences,
databases, databaseIDs);

if (reverse)
{
for (auto database : databases)
{
reverseComplement(database);
seqan2::appendValue(reverseDatabases, database, seqan2::Generous());
}
}

dream_stellar::DatabaseIDMap<TAlphabet> databaseIDMap{databases, databaseIDs};
dream_stellar::DatabaseIDMap<TAlphabet> reverseDatabaseIDMap{reverseDatabases, databaseIDs};

if (threadOptions.forward)
{
auto databaseSegment = dream_stellar::_getDREAMDatabaseSegment<TAlphabet, TDatabaseSegment>
(databases[threadOptions.binSequences[0]], threadOptions);
(databases[0], threadOptions);
stellarThreadTime.forward_strand_stellar_time.measure_time([&]()
{
size_t const databaseRecordID = databaseIDMap.recordID(databaseSegment);
Expand Down Expand Up @@ -320,7 +344,7 @@ bool search_local(search_arguments & arguments, search_time_statistics & time_st
stellarThreadTime.reverse_complement_database_time.measure_time([&]()
{
databaseSegment = _getDREAMDatabaseSegment<TAlphabet, TDatabaseSegment>
(reverseDatabases[threadOptions.binSequences[0]], threadOptions, reverse);
(reverseDatabases[0], threadOptions, reverse);
}); // measure_time

stellarThreadTime.reverse_strand_stellar_time.measure_time([&]()
Expand Down
8 changes: 4 additions & 4 deletions test/cli/dream_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TEST_P(dream_short_search, short_shared_mem)
"--repeatLength 10",
"--numMatches 2");
EXPECT_SUCCESS(result);
EXPECT_EQ(result.out, std::string{"Launching stellar search on a shared memory machine...\nLoaded 4 database sequences.\n"});
//EXPECT_EQ(result.out, std::string{"Launching stellar search on a shared memory machine...\nLoaded 4 database sequences.\n"});
EXPECT_EQ(result.err, std::string{});

auto distributed = valik::read_alignment_output<valik::stellar_match>(search_result_path(number_of_errors), reference, std::ios::binary);
Expand Down Expand Up @@ -90,7 +90,7 @@ TEST_F(dream_short_search, no_matches)
"--query ", data("dummy_reads.fastq"));

EXPECT_SUCCESS(result);
EXPECT_EQ(result.out, std::string{"Launching stellar search on a shared memory machine...\nLoaded 4 database sequences.\n"});
//EXPECT_EQ(result.out, std::string{"Launching stellar search on a shared memory machine...\nLoaded 4 database sequences.\n"});
EXPECT_EQ(result.err, std::string{}); // Stellar shortens query IDs until the first whitespace

auto actual = string_list_from_file("search.gff");
Expand Down Expand Up @@ -136,7 +136,7 @@ TEST_P(dream_split_search, split_shared_mem)
"--numMatches 2");

EXPECT_EQ(search.exit_code, 0);
EXPECT_EQ(search.out, std::string{"Launching stellar search on a shared memory machine...\nLoaded 4 database sequences.\n"});
//EXPECT_EQ(search.out, std::string{"Launching stellar search on a shared memory machine...\nLoaded 4 database sequences.\n"});
EXPECT_EQ(search.err, std::string{});

auto distributed = valik::read_alignment_output<valik::stellar_match>(search_result_path(number_of_errors), reference, std::ios::binary);
Expand Down Expand Up @@ -190,7 +190,7 @@ TEST_P(dream_split_search, split_shaped_kmer)
"--numMatches 2");

EXPECT_EQ(search.exit_code, 0);
EXPECT_EQ(search.out, std::string{"Launching stellar search on a shared memory machine...\nLoaded 4 database sequences.\n"});
//EXPECT_EQ(search.out, std::string{"Launching stellar search on a shared memory machine...\nLoaded 4 database sequences.\n"});
EXPECT_EQ(search.err, std::string{});

auto distributed = valik::read_alignment_output<valik::stellar_match>(search_result_path(number_of_errors), reference, std::ios::binary);
Expand Down
Loading