Skip to content

Commit

Permalink
reload high-copy kmers if tmp maps are used
Browse files Browse the repository at this point in the history
  • Loading branch information
gf777 committed May 9, 2024
1 parent 91a3803 commit 0ee2f65
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/kreeq.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class DBG : public Kmap<UserInputKreeq, DBGkmer, uint8_t> {

bool mergeTmpMaps(uint16_t m);

bool reloadMap32(uint16_t m);

bool dumpMap(std::string prefix, uint16_t m);

bool loadMap(std::string prefix, uint16_t m);
Expand Down
21 changes: 20 additions & 1 deletion src/graph-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,10 @@ bool DBG::processBuffers(uint16_t m) {
delete buf;
alloc += mapSize(*maps[m]) - map_size;

if (freeMemory || !bufFile || bufFile.peek() == EOF)
if (freeMemory || !bufFile || bufFile.peek() == EOF) {
dumpTmpMap(userInput.prefix, m);
reloadMap32(m);
}
}

bufFile.close();
Expand Down Expand Up @@ -486,6 +488,23 @@ bool DBG::mergeTmpMaps(uint16_t m) { // a single job merging maps with the same

}

bool DBG::reloadMap32(uint16_t m) {

parallelMap& map = *maps[m]; // the map associated to this buffer
parallelMap32& map32 = *maps32[m];

for (auto pair : map32) {

DBGkmer dbgkmer;
dbgkmer.cov = 255;
auto newPair = std::make_pair(pair.first, dbgkmer);
map.insert(newPair);
}

return true;

}

bool DBG::dumpMap(std::string prefix, uint16_t m) {

prefix.append("/.map." + std::to_string(m) + ".bin");
Expand Down

0 comments on commit 0ee2f65

Please sign in to comment.