Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a warning to giraffe when using minimizers without distance hints #3985

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't warn about minimizer caches if one has already been found
  • Loading branch information
Xian Chang committed Jun 11, 2023
commit 17cd880461b6b0f985fa0ee8bdcb15079d1ee5a9
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