Skip to content

Commit

Permalink
feat: Change default overlap threshold to 1.0 with short-circuit opti…
Browse files Browse the repository at this point in the history
…mization
  • Loading branch information
ekg committed Nov 14, 2024
1 parent f8d4446 commit f4b929d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/interface/parse_args.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void parse_args(int argc,
if (overlap_threshold) {
map_parameters.overlap_threshold = args::get(overlap_threshold);
} else {
map_parameters.overlap_threshold = 0.5;
map_parameters.overlap_threshold = 1.0;
}

if (kmer_size) {
Expand Down
44 changes: 25 additions & 19 deletions src/map/include/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,19 @@ namespace skch
}
auto kit = it;

// Check for overlaps and mark bad if necessary
for ( ; it != L.end(); it++) {
if (it == L.begin()) continue;
int idx = *it;
for (auto it2 = L.begin(); it2 != kit; it2++) {
double overlap = get_overlap(idx, *it2);
if (overlap > overlapThreshold) {
vec[idx].overlapped = 1; // Mark as bad if it overlaps >50% with the best mapping
vec[idx].discard = 1;
break;
// Skip overlap checking if threshold is 1.0 (allow all overlaps)
if (overlapThreshold < 1.0) {
// Check for overlaps and mark bad if necessary
for ( ; it != L.end(); it++) {
if (it == L.begin()) continue;
int idx = *it;
for (auto it2 = L.begin(); it2 != kit; it2++) {
double overlap = get_overlap(idx, *it2);
if (overlap > overlapThreshold) {
vec[idx].overlapped = 1; // Mark as bad if overlaps more than threshold
vec[idx].discard = 1;
break;
}
}
}
}
Expand Down Expand Up @@ -393,15 +396,18 @@ namespace skch
}
auto kit = it;

// Check for overlaps and mark bad if necessary
for ( ; it != L.end(); it++) {
if (it == L.begin()) continue;
int idx = *it;
for (auto it2 = L.begin(); it2 != kit; it2++) {
if (get_overlap(idx, *it2) > overlapThreshold) {
vec[idx].overlapped = 1; // Mark as bad if it overlaps >50% with the best mapping
vec[idx].discard = 1;
break;
// Skip overlap checking if threshold is 1.0 (allow all overlaps)
if (overlapThreshold < 1.0) {
// Check for overlaps and mark bad if necessary
for ( ; it != L.end(); it++) {
if (it == L.begin()) continue;
int idx = *it;
for (auto it2 = L.begin(); it2 != kit; it2++) {
if (get_overlap(idx, *it2) > overlapThreshold) {
vec[idx].overlapped = 1; // Mark as bad if overlaps more than threshold
vec[idx].discard = 1;
break;
}
}
}
}
Expand Down

0 comments on commit f4b929d

Please sign in to comment.