Bio-Grid-Run-SGE
view release on metacpan or search on metacpan
bin/distribution view on Meta::CPAN
# how many times this key occurred in the input
my $count = $valuesDict->{$sortedKeys[$i]};
# determine the bar width based on key occurence
if ($logarithmic) {
$barWidth->[$i] = log($count) / $maxLog;
} else {
$barWidth->[$i] = $count / $maxVal;
}
# determine the percent of key frequency
my $percentile = $count / $totalValues * 100;
# graph axis labels, really
$ctText->[$i] = sprintf ("%d", $count);
$pctText->[$i] = $count > 0 ? sprintf ("(%3.02f%%)", $percentile) : '';
$preBarLen = length ($ctText->[$i]) + length ($pctText->[$i]);
# determine the longest key name and longest count/percent text for
# aligning the output
if ($preBarLen > $maxPreBarLen) { $maxPreBarLen = $preBarLen; }
if (length ($sortedKeys[$i]) > $maxKeyLen) { $maxKeyLen = length ($sortedKeys[$i]); }
}
my $endTime = time() * 1000;
my $totalMillis = sprintf ("%.2f", ($endTime - $startTime));
if ($verbose) {
print STDERR "tokens/lines examined: $totalObjects\n";
bin/distribution view on Meta::CPAN
print STDERR "No input! ";
}
print STDERR "No histogram for you.\n";
exit 255;
}
}
# the arrays, hashes, variables must be all-correct for this to
# work, TODO: list out which ones they are, convert to functional
# keyText->[] - list of the keys
# pctText->[] - list of the percents
# ctText->[] - list of the counts
# barWidth->[] - list of the widths of the bars
sub outputGraph {
# print a header with alignment from key names
print STDERR "min";
for ($j = 4; $j <= $maxKeyLen; $j++) { print STDERR " "; }
print STDERR "|Ct (Pct)";
for ($j = 7; $j <= $maxPreBarLen; $j++) { print STDERR " "; }
print STDERR "Histogram";
bin/distribution view on Meta::CPAN
print " --height=N height of histogram, headers non-inclusive, overrides --size\n";
print " --help get help\n";
print " --logarithmic logarithmic graph\n";
print " --match=RE only match lines (or tokens) that match this regexp, some substitutions follow:\n";
print " word ^[A-Z,a-z]+\$ - tokens/lines must be entirely alphabetic\n";
print " num ^\\d+\$ - tokens/lines must be entirely numeric\n";
print " --numonly[=N] input is numerics, simply graph values without labels\n";
print " abs input is absolute values (default)\n";
print " mon input monotonically-increasing, graph differences (of 2nd and later values)\n";
print " --palette=P comma-separated list of ANSI colour values for portions of the output\n";
print " in this order: regular, key, count, percent, graph. implies --color.\n";
print " --rcfile=F use this rcfile instead of \$HOME/.distributionrc - must be first argument!\n";
print " --size=S size of histogram, can abbreviate to single character, overridden by --width/--height\n";
print " small 40x10\n";
print " medium 80x20\n";
print " large 120x30\n";
print " full terminal width x terminal height (approximately)\n";
print " --tokenize=RE split input on regexp RE and make histogram of all resulting tokens\n";
print " word [^\\w] - split on non-word characters like colons, brackets, commas, etc\n";
print " white \\s - split on whitespace\n";
print " --width=N width of the histogram report, N characters, overrides --size\n";
( run in 0.417 second using v1.01-cache-2.11-cpan-709fd43a63f )