271479 | Papaya leaf curl Guandong virus | Geminiviridae | V1.3_105649:75.8
12202 | Lettuce mosaic virus | Potyviridae | V1.3_118815:65.4
116056 | Pelargonium zonate spot virus | Bromoviridae | V1_111931:65.5
45709 | Sabia virus | Arenaviridae | V1_112261:16.8
####
271479 | Papaya leaf curl Guandong virus
12202 | Lettuce mosaic virus
116056 | Pelargonium zonate spot virus
45709 | Sabia virus
130556 | Culex nigripalpus NPV
####
#!/usr/bin/perl
# Rank array data in accordance with their P-values
# Script author: AR, 2007.
my $pvalues_file = $ARGV[0];
my $MAX_TOP_ENTRIES = 20;
open PVAL, "< $pvalues_file" or die "Error: Can't open $pvalues_file: $!";
my %arrays;
my @profile_names;
while (my $line = ) {
chomp $line;
if ($line =~ /^ARRAYS/) {
my $hdr, $i;
($hdr, @profile_names) = split("\t", $line);
for $i (0 ... $#{@profile_names}) {
$profile_names[$i] =~ s/^\s+//;
$profile_names[$i] =~ s/\s+$//;
}
} else {
(my $array_name, @pvalues) = split("\t", $line);
for $i (0 ... $#{@profile_names}) {
$arrays{$array_name}{$profile_names[$i]} = $pvalues[$i];
}
}
}
foreach $array (keys %arrays) {
my $top_count = 0;
print "$array\t";
%pvalues = %{$arrays{$array}};
@profiles_sorted = sort { $pvalues{$a} <=> $pvalues{$b} } ( keys %pvalues );
foreach $key (@profiles_sorted) {
$top_count++;
if ($top_count <= $MAX_TOP_ENTRIES) {
print "$key:$pvalues{$key}\t";
}
}
print "\n";
}