comparison sum_fastqc.pl @ 9:b3d943bc70ae draft default tip

Uploaded
author estrain
date Wed, 23 Feb 2022 14:35:40 +0000
parents 5a9a44e23dad
children
comparison
equal deleted inserted replaced
8:5a9a44e23dad 9:b3d943bc70ae
121 @larray=@{$_[0]}; 121 @larray=@{$_[0]};
122 my($sum) = 0; 122 my($sum) = 0;
123 123
124 foreach $item (@larray) { 124 foreach $item (@larray) {
125 my($lenrange,$count)=split(/\t/,$item); 125 my($lenrange,$count)=split(/\t/,$item);
126 my($l1,$l2)=split(/\-/,$lenrange); 126 my(@lvals)=split(/\-/,$lenrange);
127 $sum+=(($l1+$l2)/2)*$count; 127 if(@lvals==2) {
128 $sum+=(($lvals[0]+$lvals[1])/2)*$count;
129 } else {
130 $sum+=($lvals[0])*$count;
131 }
128 } 132 }
129 $sum = sprintf("%.1f",$sum/$nreads); 133 $sum = sprintf("%.1f",$sum/$nreads);
130 return $sum; 134 return $sum;
131 } 135 }