Skip to content

Commit

Permalink
fix incorrect parsing flag on load
Browse files Browse the repository at this point in the history
  • Loading branch information
hmusta committed Dec 6, 2024
1 parent d21fa57 commit 4b0270b
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions metagraph/src/graph/representation/hash/dbg_sshash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ DBGSSHash::DBGSSHash(const std::string &input_filename, size_t k, Mode mode, siz

build_config.verbose = common::get_verbose();
build_config.num_threads = get_num_threads();
build_config.canonical_parsing = (mode != BASIC);

// silence sshash construction messages when not verbose
std::ios orig_state(nullptr);
Expand Down Expand Up @@ -406,8 +407,34 @@ bool DBGSSHash::load(std::istream &in) {
*this = DBGSSHash(k, mode);
num_nodes_ = num_nodes;

if (num_nodes_)
std::visit([&](auto &d) { d.visit(loader); }, dict_);
if (num_nodes_) {
std::visit([&](auto &d) {
d.visit(loader);

if (mode_ != BASIC) {
using kmer_t = get_kmer_t<decltype(d)>;

// TODO: HACK! this is for backwards compatibility
class dict_access {
public:
uint64_t m_size;
uint64_t m_seed;
uint16_t m_k;
uint16_t m_m;
uint16_t m_canonical_parsing;
sshash::minimizers m_minimizers;
sshash::buckets<kmer_t> m_buckets;
sshash::skew_index<kmer_t> m_skew_index;
sshash::weights m_weights;
};

static_assert(sizeof(decltype(d)) == sizeof(dict_access));

// overwrite canonical parsing variable;
reinterpret_cast<dict_access&>(d).m_canonical_parsing = true;
}
}, dict_);
}

return true;
}
Expand Down

0 comments on commit 4b0270b

Please sign in to comment.