ID\tID2\tID3\tID4\t.......value
####
THRAP2 ICA1 TIP47 PCSK1 PTTG1 CIT CEACAM6 ADM RMB5 0.526
DOC_1R CPE GRB7 RELA PTGES PLOD2 SLC2A1 G22P1 GPR56 1.664
NICE_4 GPC3 SNRPB MST1 ITGA11 PHB STARD10 TYRP1 ARG1 0.579
THRAP2 GAPD KRT5 CEACAM6 COPEB CNN1 DSC2 LYPLA1 NAP1L1 1.568
ACTA2 CPE TIP47 ZYG SSBP1 CIT IGFBP3 CALB2 HIF1a 0.742
####
my $file_number = 0;
# loop through all file-handles
foreach my $file (@files) {
# open the file
open(my $fh, '<', $file) or croak "Unable to open file: $file";
# count this file as being processed
++$file_number;
# give the user a little bit of an update
print "Now processing file $file_number\n";
# completely process the file
while (<$fh>) {
# trim leading/trailing whitespace
s/^\s+//;
s/\s+$//;
# tab-delimited rows with the stats value in the last column
my @row = split("\t");
my $val = pop(@row);
# sort the row and concatenate it into a key
@row = sort(@row);
my $key = join("\t", @row);
# skip rows with missing values
next() if (scalar(@row) != $subset_num);
# save this data point
push @{ $data{$key} }, $val;
}
# look for any missing values
foreach my $key (keys(%data)) {
if ($file_number > scalar( @{ $data{$key} } )) {
push @{ $data{$key} }, '';
}
}
# close the filehandle
close($fh);
}
####
genra@qcxxt[164] >> perl -w rewriter.pl n09 9
Now processing file 1
Now processing file 2
Now processing file 3
Now processing file 4
Now processing file 5
Now processing file 6
Now processing file 7
Now processing file 8
Now processing file 9
Now processing file 10
Out of memory!