Sponsored Content
Full Discussion: Re-scaling values - perl
Top Forums Shell Programming and Scripting Re-scaling values - perl Post 302869883 by @man on Thursday 31st of October 2013 10:44:04 AM
Old 10-31-2013
Dear alister,
I appreciate that you try not to give a fish! Smilie
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! Smilie
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.

Regards,
Alister
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl -write values in a file to @array in perl

Hi can anyone suggest me how to write a file containing values,... say 19 20 21 22 .. 40 to an array @array = (19, 20, ... 40) -- Thanks (27 Replies)
Discussion started by: meghana
27 Replies

2. Shell Programming and Scripting

Perl :: reading values from Data Dumper reference in Perl

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)
Discussion started by: scriptscript
1 Replies

3. Shell Programming and Scripting

Data imputation with scaling

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)
Discussion started by: senhia83
3 Replies
Graphics::Primitive::Insets(3pm)			User Contributed Perl Documentation			  Graphics::Primitive::Insets(3pm)

NAME
Graphics::Primitive::Insets - Space between things DESCRIPTION
Graphics::Primitive::Insets represents the amount of space that surrounds something. This object can be used to represent either padding or margins (in the CSS sense, one being inside the bounding box, the other being outside) SYNOPSIS
use Graphics::Primitive::Insets; my $insets = Graphics::Primitive::Insets->new({ top => 5, bottom => 5, left => 5, right => 5 }); METHODS
Constructor new Creates a new Graphics::Primitive::Insets. Instance Methods as_array Return these insets as an array in the form of top, right, bottom and left. bottom Set/Get the inset from the bottom. equal_to Determine if these Insets are equal to another. left Set/Get the inset from the left. right Set/Get the inset from the right. top Set/Get the inset from the top. zero Sets all the insets (top, left, bottom, right) to 0. AUTHOR
Cory Watson, "<gphat@cpan.org>" SEE ALSO
perl(1) COPYRIGHT &; LICENSE Copyright 2008-2010 by Cory G Watson. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2010-08-21 Graphics::Primitive::Insets(3pm)
All times are GMT -4. The time now is 03:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy