Dear All,
Actually I post the following question a few weeks ago on Biostars (https://www.biostars.org/p/97538/#97599). I got a very nice answer there, but it's perl one liner command. I am eager to sort out the problem with perl hash of hash. Could anyone here give me an answer?
I need to make statistics of mirna abundances for many samples. Below is an example.
I want to change the format to below.
i tried to write perl hash of hash, but was stuck (see below). Could perl export teaches me with this? I greatly appreciate your help!!
Actually I post the following question a few weeks ago on Biostars (https://www.biostars.org/p/97538/#97599). I got a very nice answer there, but it's perl one liner command. I am eager to sort out the problem with perl hash of hash. Could anyone here give me an answer?
I need to make statistics of mirna abundances for many samples. Below is an example.
Code:
SAMPLE MIR ABUNDANCE sample1 mir1 30 sample1 mir3 100 sample1 mir4 120 sample2 mir1 40 sample2 mir2 200 sample3 mir1 190 ......
Code:
sample1 sample2 sample3 mir1 30 40 190 mir2 0 200 0 mir3 190 0 0 mir4 120 0 0 ......
Code:
open FH, '<', $ARGV[0] or die "open failed:$!";
my %h;
while (<>){
my ($sample, $mir, $abun) = /(.+?)\t(.+)\t(.+)/;
$h{$sample}{$mir} = $abun;
}
foreach my $sample (keys %h){
foreach my $mir (keys %{h{$sample}})
print " " # i am stuck here. Need your help!
}
Comment