Skip to content

Commit

Permalink
Print the last successful mate parsed if mismatch in number of paired…
Browse files Browse the repository at this point in the history
…-end reads
  • Loading branch information
ch4rr0 committed May 7, 2024
1 parent 571eb96 commit 42281d7
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions pat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,18 @@ pair<bool, int> DualPatternComposer::nextBatch(PerThreadReadBuf& pt) {
assert_eq((*srca_)[cur]->readCount(),
(*srcb_)[cur]->readCount());
}
if(resa.second < resb.second) {
cerr << "Error, fewer reads in file specified with -1 "
<< "than in file specified with -2" << endl;
if (resa.second < resb.second) {
cerr << "Error, fewer reads in file specified with -1 "
<< "than in file specified with -2.";
if (resb.second > 0) {
const char *readOrigBuf = pt.bufb_[resb.second - 1].readOrigBuf.buf();
const char *newline = strchr(readOrigBuf, '\n');

size_t headerLength = newline - readOrigBuf;
string header = string(readOrigBuf, headerLength);
cerr << " Last successfully parsed mate: " << header << ".";
}
cerr << endl;
throw 1;
} else if(resa.second == 0 && resb.second == 0) {
ThreadSafe ts(mutex_m);
Expand All @@ -264,9 +273,19 @@ pair<bool, int> DualPatternComposer::nextBatch(PerThreadReadBuf& pt) {
}
cur = cur_; // Move on to next PatternSource
continue; // on to next pair of PatternSources
} else if(resb.second < resa.second) {
cerr << "Error, fewer reads in file specified with -2 "
<< "than in file specified with -1" << endl;
} else if (resb.second < resa.second) {
cerr << "Error, fewer reads in file specified with -2 "
<< "than in file specified with -1.";

if (resa.second > 0) {
const char *readOrigBuf = pt.bufa_[resa.second - 1].readOrigBuf.buf();
const char *newline = strchr(readOrigBuf, '\n');

size_t headerLength = newline - readOrigBuf;
string header = string(readOrigBuf, headerLength);
cerr << " Last successfully parsed mate: " << header << ".";
}
cerr << endl;
throw 1;
}
assert_eq(resa.first, resb.first);
Expand Down

0 comments on commit 42281d7

Please sign in to comment.