Mercurial > repos > estrain > sum_fastqc
diff sum_fastqc.pl @ 4:d47775122e78 draft
Uploaded
author | estrain |
---|---|
date | Wed, 17 Oct 2018 16:29:11 -0400 |
parents | 8256c1d0d63b |
children | 7df018757d26 |
line wrap: on
line diff
--- 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; +}