Open sicotte opened 10 years ago
Not sure I want to fix it that way. If you have a zero here then your input data is insufficient, as it is not a per segment calculation, but rather all segments. I guess I would want it to die here with a more informative message. I don't want it to continue.
A few lines above, the program skips segments with 0 variants.. next if(!$count);
you might want to switch this test to testing for at least one variant (also). ... and keep the fix I suggested (there were two typos.. here is the correct version)
if($cov_L_max>$cov_L_min) { $cov_L_sum = (1 * ($cov_L_sum-$cov_L_min)/($cov_L_max-$cov_L_min)); } if($maf_L_max>$maf_L_min) { $maf_L_sum = (1 * ($maf_L_sum-$maf_L_min)/($maf_L_max-$maf_L_min)); }
It should. The segments in question are not the user supplied segments, but rather discovery segments from large multimegabase windows. If they are all empty then there are problems with your data.
Line5696 There is a problem (divide by 0) when L_min and L_max are equal $cov_L_sum = (1 * ($cov_L_sum-$cov_L_min)/($cov_L_max-$cov_L_min)); $maf_L_sum = (1 * ($maf_L_sum-$maf_L_min)/($maf_L_max-$maf_L_min));
Which can happen when there is a single variant per segment. Solution if($cov_L_max>$cov_L_min) { $cov_L_sum = (1 * ($cov_L_sum-$cov_L_min)/($cov_L_max-$cov_L_min); } if($maf_L_max>$maf_L_min) { $maf_L_sum = (1 * ($maf_L_sum-$maf_L_min)/($maf_L_max-$maf_L_min+1e-10)); }