Using toolic's code from Statistics on Tab Delimited File, I was able to adapt to what you seem to want.
use strict; use warnings; use Acme::Tools; use Text::Table; my %data; my %freq; while (<DATA>) { my ($organism, @vals) = (split)[2..5]; $freq{ $organism }++; my $col = 3; for my $val (@vals) { push @{ $data{$organism}{$col} }, $val; $col++; } } my @headers = qw/ Organism Frequency Median_Eval Median_Contig_Length + Median_Mapped_Length /; my $tb = Text::Table->new( map {title => $_}, @headers ); for my $test (sort {$freq{ $b } <=> $freq{ $a }} keys %freq) { my @row = ($test, $freq{ $test }); for my $col (sort keys %{ $data{$test} }) { push @row, median(@{ $data{$test}{$col} }); } $tb->load( [@row] ); } print $tb; __DATA__ contig1 AC344 organism1 1e-1 122 45 contig1 AC344 organism1 1e-2 122 45 contig1 AC346 organism2 1e-102 122 46 contig1 Ac346 organism2 1e-100 122 46 contig1 Ac346 organism2 1e-114 122 46 contig1 Ac346 organism2 1e-111 122 46 contig2 NC333 organism3 1e-2 155 90 contig3 NC444 organism4 1 188 50 contig3 NC444 organism4 12 188 50
Output was
C:\perlp>812293.pl Organism Frequency Median_Eval Median_Contig_Length Median_Mappe +d_Length organism2 4 5.000000005e-103 122 46 organism1 2 0.055 122 45 organism4 2 6.5 188 50 organism3 1 1e-2 155 90
Is this what you were looking for?

Chris


In reply to Re: Statistics via hash- NCBI BLAST Tab Delimited file by Anonymous Monk
in thread Statistics via hash- NCBI BLAST Tab Delimited file by Paragod28

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.