Skip to content
Snippets Groups Projects
Commit 572f3abf authored by Birte Kehr's avatar Birte Kehr
Browse files

Adding total read count in BAM file to command line output.

parent 8720de82
No related merge requests found
......@@ -406,6 +406,7 @@ crop_unmapped(double & avgCov,
// Iterate over the input file.
BamAlignmentRecord record;
unsigned totalReads = 0;
unsigned long alignedBaseCount = 0;
while (!atEnd(inStream))
{
......@@ -416,6 +417,9 @@ crop_unmapped(double & avgCov,
if (hasFlagDuplicate(record) or hasFlagSecondary(record) or
hasFlagQCNoPass(record) or hasFlagSupplementary(record)) continue;
// Count 'interesting' reads..
totalReads += 1;
if (!hasFlagUnmapped(record))
alignedBaseCount += length(record.seq);
......@@ -447,6 +451,10 @@ crop_unmapped(double & avgCov,
avgCov = (double)alignedBaseCount / (double)genomeLength;
std::ostringstream msg;
msg << "BAM file lists alignments for " << totalReads << " reads after duplicate removal and filtering on QC pass flag.";
printStatus(msg);
msg.str("");
msg << "Map of low quality mates has " << otherReads.size() << " records.";
printStatus(msg);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment