|
29 | 29 | my $verbose = 0; |
30 | 30 | my $tile_resolution = 0; |
31 | 31 | my $fai = ""; |
| 32 | +my $ambiguous_category = "Unknown"; |
32 | 33 |
|
33 | 34 | getopts('f:t:v:r:i:'); |
34 | 35 |
|
@@ -159,6 +160,9 @@ sub usage_page { |
159 | 160 | if($metric>$winmax){ |
160 | 161 | $winmax = $metric; |
161 | 162 | $winpop = $pp; |
| 163 | + }elsif($metric==$winmax){ ###do not assign tiles to a population if ambiguous |
| 164 | + $winmax = $metric; |
| 165 | + $winpop = $ambiguous_category; |
162 | 166 | } |
163 | 167 | } |
164 | 168 | $top->{$winpop} += $dw; |
@@ -217,12 +221,20 @@ sub usage_page { |
217 | 221 | $rank++; |
218 | 222 | my $k = $population . "_AF"; |
219 | 223 | my $percent = $top->{$population}/$total *100; |
220 | | - printf OUT "$population\t%.2f%%\t%.4f\t$xr\t$s->{$k}{'ct'}", ($percent, $s->{$k}{'prob'}); |
| 224 | + if ($population eq $ambiguous_category) { |
| 225 | + printf OUT "$population\t%.2f%%\tN/A\t$xr\tN/A", $percent; |
| 226 | + } else { |
| 227 | + printf OUT "$population\t%.2f%%\t%.4f\t$xr\t$s->{$k}{'ct'}", ($percent, $s->{$k}{'prob'}); |
| 228 | + } |
221 | 229 | if ($verbose) { |
222 | | - my $p = $s->{$k}{'sum'}/$xr; |
223 | | - my $c=$s->{$k}{'sum'}/$s->{$k}{'ct'}; |
224 | | - my $nzr=$s->{$k}{'ct'}/$xr; |
225 | | - printf OUT "\t%.2f\t%.4f\t%.4f\t%.4f\t%.2f\n", ($s->{$k}{'sum'}, $p, $c, $nzr, $s->{$k}{'fract'}); |
| 230 | + if ($population eq $ambiguous_category) { |
| 231 | + printf OUT "\tN/A\tN/A\tN/A\tN/A\tN/A\n"; |
| 232 | + } else { |
| 233 | + my $p = $s->{$k}{'sum'}/$xr; |
| 234 | + my $c=$s->{$k}{'sum'}/$s->{$k}{'ct'}; |
| 235 | + my $nzr=$s->{$k}{'ct'}/$xr; |
| 236 | + printf OUT "\t%.2f\t%.4f\t%.4f\t%.4f\t%.2f\n", ($s->{$k}{'sum'}, $p, $c, $nzr, $s->{$k}{'fract'}); |
| 237 | + } |
226 | 238 | } else { |
227 | 239 | printf OUT "\n"; |
228 | 240 | } |
|
0 commit comments