Previous changeset 3:8256c1d0d63b (2018-10-17) Next changeset 5:7df018757d26 (2018-10-18) |
Commit message:
Uploaded |
modified:
sum_fastqc.pl |
b |
diff -r 8256c1d0d63b -r d47775122e78 sum_fastqc.pl --- a/sum_fastqc.pl Wed Oct 17 11:10:03 2018 -0400 +++ b/sum_fastqc.pl Wed Oct 17 16:29:11 2018 -0400 |
[ |
@@ -16,7 +16,7 @@ $qscore=~s/\s+//g; my(@qlist)=split(/\,/,$qscore); -print "Input\tFile\tFastQC\tPass-Fail\tReads\tPoor_Reads\tGC"; +print "Input\tFile\tFastQC\tPass-Fail\tReads\tPoor_Reads\tGC\tMeanQ"; foreach(@qlist) { print "\tQ".$_; } @@ -53,7 +53,8 @@ print $pass[1]."\t"; print $nreads[1]."\t"; print $npoor[1]."\t"; - print $gc[1]; + print $gc[1]."\t"; + print readmean($nreads[1],\@qlines); foreach $qs (@qlist) { print "\t"; print qcal($nreads[1],$qs,\@qlines); @@ -77,3 +78,17 @@ $qmean = sprintf("%.2f", 100 * $sum / $nreads); return $qmean; } + +sub readmean { + $nreads=shift(@_); + @qarray=@{$_[0]}; + my($sum) = 0; + + foreach $item (@qarray) { + my($qval,$q)=split(/\t/,$item); + $sum += $q*$qval; + } + + $readq = sprintf("%.2f", $sum / $nreads); + return $readq; +} |