All I want to do is re-scaling the third column to be between 0-1. Which means that the highest valu in 3rd column will be 1 and the lowest closest to 0 and the rest in between.
Dear alister,
I appreciate that you try not to give a fish!
I should have replied much earlier... but then I managed to write the script and didn't update the thread.
you have always helped me and I am thankful once more!
Here is what I wrote which seems to work:
Code:
#!/usr/bin/perl
use strict;
use warnings;
open(FH,"inputfilename");
my @LINE;
my @val;
my $counter=0;
open OUT, ">./BG3_H3K27ac_Ave_Rto.to2006_Norm.sgr";
while(my $line=<FH>){
my @array=split("\t",$line);
push(@LINE, $line);
push(@val,$array[2]);
$counter++;
}
close(FH);
my @valst=sort { $a <=> $b } @val;
my $idx=$valst[$counter-1];
foreach my $line(@LINE){
my @array=split("\t",$line);
print OUT $array[0],"\t",$array[1],"\t",$array[2]/$idx,"\n";
}
Cheers!
Quote:
Originally Posted by alister
Have you put forth any effort at all? If so, show us what you've tried so far.
Regards,
Alister
---------- Post updated at 01:02 PM ---------- Previous update was at 12:55 PM ----------
Also, the highlighted value in your output is almost certainly wrong.
Hello masters, this is difficult to explain and maybe complicated to implement...looks beyond what I taught myself (from this forum), some help is greatly appreciated.
I have a base file
a1 10
a2 15
a3 20
a4 21
I have a non-base file
a1 170
b12 175
c12 180
d12 190
a2 ... (3 Replies)
Hi all,
I have written a perl code and stored the data into Data structure using Data::Dumper module.
But not sure how to retreive the data from the Data::Dumper.
Eg.
Based on the key value( Here CRYPTO-6-IKMP_MODE_FAILURE I should be able to access the internal hash elements(keys) ... (1 Reply)