Skip to content

Commit

Permalink
Don't warn about minimizer caches if one has already been found
Browse files Browse the repository at this point in the history
  • Loading branch information
Xian Chang committed Jun 11, 2023
1 parent 8d61ee8 commit 17cd880
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/minimizer_mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,25 @@ vector<Alignment> MinimizerMapper::map_from_extensions(Alignment& aln) {

if (seeds.size() > 0 && seeds.front().minimizer_cache == MIPayload::NO_CODE){
//If there is no payload
if (!warned_about_minimizer_payload.test_and_set()) {
bool found_minimizer = found_minimizer_payload.test_and_set();
if (!found_minimizer &&
!warned_about_minimizer_payload.test_and_set()) {
cerr << "warning[vg::giraffe]: Running giraffe without distance hints in the minimizers." << endl;
cerr << " Mapping will be slow." << endl;
cerr << " To include distance hints, rebuilt the minimizers with vg minimizer -d" << endl;
}

//TODO: C++ 20 will let us use found_minimizer_payload.test(),
//which won't set the value to true.
//For now, check if it was false before getting set to true
//and reset it if necessary
if (!found_minimizer) {
found_minimizer_payload.clear();
}
} else {
//If we found a payload, make sure we remember it so we don't
//warn about it later
found_minimizer_payload.test_and_set();
}

// Cluster the seeds. Get sets of input seed indexes that go together.
Expand Down
9 changes: 9 additions & 0 deletions src/minimizer_mapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ class MinimizerMapper : public AlignerClient {

///Have we complained about minimizer not including distance hints?
atomic_flag warned_about_minimizer_payload = ATOMIC_FLAG_INIT;

//Some minimizer payloads are too big and don't get stored, so
//we might encounter empty ones even though we have the rest.
//Remember if we've seen any payloads so we don't complain about
//an anomalous empty one. This isn't perfect since it might warn
//about empty payloads if the first one is empty, but this is
//unlikely
///Have we found a minimizer payload yet?
atomic_flag found_minimizer_payload = ATOMIC_FLAG_INIT;

//////////////
// Alignment-from-gapless-extension/short read Giraffe specific parameters:
Expand Down

1 comment on commit 17cd880

@adamnovak
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vg CI tests complete for branch warn-minimizers. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 10924 seconds

Please sign in to comment.