Skip to content

Commit

Permalink
Fix off by one in kmermatcher #274 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-steinegger committed Feb 26, 2020
1 parent d1607bc commit aa175d6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/linclust/kmerindexdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int kmerindexdb(int argc, const char **argv, const Command &command) {
// compute splits
size_t splits = static_cast<size_t>(std::ceil(static_cast<float>(totalSizeNeeded) / memoryLimit));
size_t totalKmersPerSplit = std::max(static_cast<size_t>(1024+1),
static_cast<size_t>(std::min(totalSizeNeeded, memoryLimit)/sizeof(KmerPosition<short>)));
static_cast<size_t>(std::min(totalSizeNeeded, memoryLimit)/sizeof(KmerPosition<short>))+1);
std::vector<std::pair<size_t, size_t>> hashRanges = setupKmerSplits<short>(par, subMat, seqDbr, totalKmersPerSplit, splits);

Debug(Debug::INFO) << "Process file into " << hashRanges.size() << " parts\n";
Expand Down
2 changes: 1 addition & 1 deletion src/linclust/kmermatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ int kmermatcherInner(Parameters& par, DBReader<unsigned int>& seqDbr) {
// compute splits
size_t splits = static_cast<size_t>(std::ceil(static_cast<float>(totalSizeNeeded) / memoryLimit));
size_t totalKmersPerSplit = std::max(static_cast<size_t>(1024+1),
static_cast<size_t>(std::min(totalSizeNeeded, memoryLimit)/sizeof(KmerPosition<T>)));
static_cast<size_t>(std::min(totalSizeNeeded, memoryLimit)/sizeof(KmerPosition<T>))+1);

std::vector<std::pair<size_t, size_t>> hashRanges = setupKmerSplits<T>(par, subMat, seqDbr, totalKmersPerSplit, splits);
if(splits > 1){
Expand Down
2 changes: 1 addition & 1 deletion src/linclust/kmersearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ int kmersearch(int argc, const char **argv, const Command &command) {
// compute splits
size_t splits = static_cast<size_t>(std::ceil(static_cast<float>(totalSizeNeeded) / memoryLimit));
size_t totalKmersPerSplit = std::max(static_cast<size_t>(1024+1),
static_cast<size_t>(std::min(totalSizeNeeded, memoryLimit)/sizeof(KmerPosition<short>)));
static_cast<size_t>(std::min(totalSizeNeeded, memoryLimit)/sizeof(KmerPosition<short>))+1);

std::vector<std::pair<size_t, size_t>> hashRanges = setupKmerSplits<short>(par, subMat, queryDbr, totalKmersPerSplit, splits);

Expand Down

0 comments on commit aa175d6

Please sign in to comment.