Skip to content

Commit

Permalink
Always call next() on both tokenizers, to make sure both r1 and r2 fi…
Browse files Browse the repository at this point in the history
…les are read to the end

* Tokenizer.next() fix for Illumina#41

* Also fix alignDualFastq

Illumina#53
  • Loading branch information
lgruen authored and edmundmiller committed Dec 7, 2023
1 parent 043388f commit e6dea0a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/lib/workflow/DualFastq2SamWorkflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ align::InsertSizeParameters DualFastq2SamWorkflow::requestInsertSizeInfo(

align::InsertSizeParameters ret;
bool retDone = false;
while (r1Tokenizer.next() && r2Tokenizer.next()) {
while (true) {
// Always call next() on both tokenizers, to make sure both files are read to the end.
const bool r1Next = r1Tokenizer.next();
const bool r2Next = r2Tokenizer.next();
if (!r1Next || !r2Next) {
break;
}

const auto& r1Token = r1Tokenizer.token();
const auto& r2Token = r2Tokenizer.token();
// std::cout << "token: " << r1Token << "-" << r2Token << "\n";
Expand Down Expand Up @@ -89,7 +96,14 @@ void DualFastq2SamWorkflow::alignDualFastq(
align::Aligner::ReadPair pair;

int64_t fragmentId = 0;
while (r1Tokenizer.next() && r2Tokenizer.next()) {
while (true) {
// Always call next() on both tokenizers, to make sure both files are read to the end.
const bool r1Next = r1Tokenizer.next();
const bool r2Next = r2Tokenizer.next();
if (!r1Next || !r2Next) {
break;
}

const auto& r1Token = r1Tokenizer.token();
const auto& r2Token = r2Tokenizer.token();
// std::cout << "token: " << r1Token << "-" << r2Token << "\n";
Expand Down

0 comments on commit e6dea0a

Please sign in to comment.