Skip to content

Commit

Permalink
feat: improve loadDB speeds
Browse files Browse the repository at this point in the history
  • Loading branch information
Taepper committed Aug 22, 2023
1 parent d1e4b2b commit 2b7cd7d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions include/silo/storage/sequence_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class NucPosition {
template <class Archive>
void serialize(Archive& archive, [[maybe_unused]] const uint32_t version) {
// clang-format off
archive & symbol_whose_bitmap_is_flipped;
archive & bitmaps;
archive & symbol_whose_bitmap_is_flipped;
// clang-format on
}

Expand All @@ -46,7 +46,7 @@ class NucPosition {
explicit NucPosition(std::optional<NUCLEOTIDE_SYMBOL> symbol);

SymbolMap<NUCLEOTIDE_SYMBOL, roaring::Roaring> bitmaps;
std::optional<NUCLEOTIDE_SYMBOL> symbol_whose_bitmap_is_flipped = std::nullopt;
std::optional<NUCLEOTIDE_SYMBOL> symbol_whose_bitmap_is_flipped;

std::optional<silo::NUCLEOTIDE_SYMBOL> flipMostNumerousBitmap(uint32_t sequence_count);
};
Expand All @@ -63,8 +63,8 @@ class SequenceStorePartition {
template <class Archive>
void serialize(Archive& archive, [[maybe_unused]] const uint32_t version) {
// clang-format off
archive & positions;
archive & indexing_differences_to_reference_genome;
archive & positions;
archive & nucleotide_symbol_n_bitmaps;
archive & sequence_count;
// clang-format on
Expand Down
10 changes: 5 additions & 5 deletions src/silo/storage/aa_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ std::optional<silo::AA_SYMBOL> silo::AAPosition::flipMostNumerousBitmap(uint32_t
}

silo::AAStorePartition::AAStorePartition(const std::vector<AA_SYMBOL>& reference_sequence)
: reference_sequence(reference_sequence) {
for (const AA_SYMBOL symbol : reference_sequence) {
positions.emplace_back(symbol);
}
}
: reference_sequence(reference_sequence) {}

size_t silo::AAStorePartition::fill(silo::ZstdFastaReader& input_file) {
static constexpr size_t BUFFER_SIZE = 1024;

for (const AA_SYMBOL symbol : reference_sequence) {
positions.emplace_back(symbol);
}

size_t read_sequences_count = 0;

std::vector<std::string> sequence_buffer;
Expand Down
10 changes: 5 additions & 5 deletions src/silo/storage/sequence_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ std::optional<silo::NUCLEOTIDE_SYMBOL> silo::NucPosition::flipMostNumerousBitmap
silo::SequenceStorePartition::SequenceStorePartition(
const std::vector<NUCLEOTIDE_SYMBOL>& reference_genome
)
: reference_genome(reference_genome) {
for (const NUCLEOTIDE_SYMBOL symbol : reference_genome) {
positions.emplace_back(symbol);
}
}
: reference_genome(reference_genome) {}

size_t silo::SequenceStorePartition::fill(silo::ZstdFastaReader& input_file) {
static constexpr size_t BUFFER_SIZE = 1024;

for (const NUCLEOTIDE_SYMBOL symbol : reference_genome) {
positions.emplace_back(symbol);
}

size_t read_sequences_count = 0;

std::vector<std::string> genome_buffer;
Expand Down
4 changes: 4 additions & 0 deletions src/silo_api/database_directory_watcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,8 @@ void silo_api::DatabaseDirectoryWatcher::checkDirectoryForData(Poco::Timer& /*ti

SPDLOG_INFO("New data version detected: {}", most_recent_database_state->first.string());
database_mutex.setDatabase(silo::Database::loadDatabaseState(most_recent_database_state->first));
SPDLOG_INFO(
"New database with version {} successfully loaded.",
most_recent_database_state->first.string()
);
}

0 comments on commit 2b7cd7d

Please sign in to comment.