diff --git a/src/htmlreporter.cpp b/src/htmlreporter.cpp
index f6ac7f9..961c113 100644
--- a/src/htmlreporter.cpp
+++ b/src/htmlreporter.cpp
@@ -58,6 +58,10 @@ void HtmlReporter::printSummary(ofstream& ofs, FilterResult* result, Stats* preS
if(preStats2)
pre_q30_bases += preStats2->getQ30();
+ long pre_total_gc = preStats1->getGCNumber();
+ if(preStats2)
+ pre_total_gc += preStats2->getGCNumber();
+
long post_total_reads = postStats1->getReads();
if(postStats2)
post_total_reads += postStats2->getReads();
@@ -74,6 +78,10 @@ void HtmlReporter::printSummary(ofstream& ofs, FilterResult* result, Stats* preS
if(postStats2)
post_q30_bases += postStats2->getQ30();
+ long post_total_gc = postStats1->getGCNumber();
+ if(postStats2)
+ post_total_gc += postStats2->getGCNumber();
+
string sequencingInfo = mOptions->isPaired()?"paired end":"single end";
if(mOptions->isPaired()) {
sequencingInfo += " (" + to_string(preStats1->getCycles()) + " cycles + " + to_string(preStats2->getCycles()) + " cycles)";
@@ -98,6 +106,7 @@ void HtmlReporter::printSummary(ofstream& ofs, FilterResult* result, Stats* preS
outputRow(ofs, "total bases:", formatNumber(pre_total_bases));
outputRow(ofs, "Q20 bases:", formatNumber(pre_q20_bases) + " (" + getPercents(pre_q20_bases,pre_total_bases) + "%)");
outputRow(ofs, "Q30 bases:", formatNumber(pre_q30_bases) + " (" + getPercents(pre_q30_bases, pre_total_bases) + "%)");
+ outputRow(ofs, "GC content:", getPercents(pre_total_gc,pre_total_bases) + "%");
ofs << "\n";
ofs << "
After filtering
\n";
@@ -106,6 +115,7 @@ void HtmlReporter::printSummary(ofstream& ofs, FilterResult* result, Stats* preS
outputRow(ofs, "total bases:", formatNumber(post_total_bases));
outputRow(ofs, "Q20 bases:", formatNumber(post_q20_bases) + " (" + getPercents(post_q20_bases, post_total_bases) + "%)");
outputRow(ofs, "Q30 bases:", formatNumber(post_q30_bases) + " (" + getPercents(post_q30_bases, post_total_bases) + "%)");
+ outputRow(ofs, "GC content:", getPercents(post_total_gc,post_total_bases) + "%");
ofs << "\n";
if(result) {
diff --git a/src/jsonreporter.cpp b/src/jsonreporter.cpp
index 58a4006..883c07d 100644
--- a/src/jsonreporter.cpp
+++ b/src/jsonreporter.cpp
@@ -30,6 +30,10 @@ void JsonReporter::report(FilterResult* result, Stats* preStats1, Stats* postSta
if(preStats2)
pre_q30_bases += preStats2->getQ30();
+ long pre_total_gc = preStats1->getGCNumber();
+ if(preStats2)
+ pre_total_gc += preStats2->getGCNumber();
+
long post_total_reads = postStats1->getReads();
if(postStats2)
post_total_reads += postStats2->getReads();
@@ -46,6 +50,10 @@ void JsonReporter::report(FilterResult* result, Stats* preStats1, Stats* postSta
if(postStats2)
post_q30_bases += postStats2->getQ30();
+ long post_total_gc = postStats1->getGCNumber();
+ if(postStats2)
+ post_total_gc += postStats2->getGCNumber();
+
// summary
ofs << "\t" << "\"summary\": {" << endl;
@@ -55,7 +63,8 @@ void JsonReporter::report(FilterResult* result, Stats* preStats1, Stats* postSta
ofs << "\t\t\t" << "\"q20_bases\":" << pre_q20_bases << "," << endl;
ofs << "\t\t\t" << "\"q30_bases\":" << pre_q30_bases << "," << endl;
ofs << "\t\t\t" << "\"q20_rate\":" << (pre_total_bases == 0?0.0:(double)pre_q20_bases / (double)pre_total_bases) << "," << endl;
- ofs << "\t\t\t" << "\"q30_rate\":" << (pre_total_bases == 0?0.0:(double)pre_q30_bases / (double)pre_total_bases) << endl;
+ ofs << "\t\t\t" << "\"q30_rate\":" << (pre_total_bases == 0?0.0:(double)pre_q30_bases / (double)pre_total_bases) << "," << endl;
+ ofs << "\t\t\t" << "\"gc_content\":" << (pre_total_bases == 0?0.0:(double)pre_total_gc / (double)pre_total_bases) << endl;
ofs << "\t\t" << "}," << endl;
ofs << "\t\t" << "\"after_filtering\": {" << endl;
@@ -64,7 +73,8 @@ void JsonReporter::report(FilterResult* result, Stats* preStats1, Stats* postSta
ofs << "\t\t\t" << "\"q20_bases\":" << post_q20_bases << "," << endl;
ofs << "\t\t\t" << "\"q30_bases\":" << post_q30_bases << "," << endl;
ofs << "\t\t\t" << "\"q20_rate\":" << (post_total_bases == 0?0.0:(double)post_q20_bases / (double)post_total_bases) << "," << endl;
- ofs << "\t\t\t" << "\"q30_rate\":" << (post_total_bases == 0?0.0:(double)post_q30_bases / (double)post_total_bases) << endl;
+ ofs << "\t\t\t" << "\"q30_rate\":" << (post_total_bases == 0?0.0:(double)post_q30_bases / (double)post_total_bases) << "," << endl;
+ ofs << "\t\t\t" << "\"gc_content\":" << (post_total_bases == 0?0.0:(double)post_total_gc / (double)post_total_bases) << endl;
ofs << "\t\t" << "}" << endl;
ofs << "\t" << "}," << endl;
diff --git a/src/stats.cpp b/src/stats.cpp
index 0d18b15..4f5a13d 100644
--- a/src/stats.cpp
+++ b/src/stats.cpp
@@ -328,6 +328,12 @@ long Stats::getQ30() {
return mQ30Total;
}
+long Stats::getGCNumber() {
+ if(!summarized)
+ summarize();
+ return mBaseContents['G' & 0x07] + mBaseContents['C' & 0x07];
+}
+
void Stats::print() {
if(!summarized) {
summarize();
@@ -474,8 +480,8 @@ void Stats::reportHtmlKMER(ofstream& ofs, string filteringType, string readName)
string title = "";
ofs << "" + subsection + "
\n";
- ofs << "Darker background means higher counts. The count will be shown on mouse over.
\n";
- ofs << "\n";
+ ofs << "Darker background means larger counts. The count will be shown on mouse over.
\n";
+ ofs << "\n";
ofs << "";
ofs << " | ";
// the heading row
diff --git a/src/stats.h b/src/stats.h
index 8dfd860..a266c23 100644
--- a/src/stats.h
+++ b/src/stats.h
@@ -20,6 +20,7 @@ class Stats{
long getBases();
long getQ20();
long getQ30();
+ long getGCNumber();
// by default the qualified qual score is Q20 ('5')
void statRead(Read* r, int& lowQualNum, int& nBaseNum, char qualifiedQual = '5');