Yes to the following:
•You have multiple, tab-delimited files
•The first line of each file contains column headers
•Each file may have a different number of columns
####
e.g.
first file.txt:
ID dataS01R1 dataS01R2 dataS02R1 dataS02R2 Links
M45 345.2 536 876.12 873 http://..
M34 836 893 829 83.234
M72 873 123 342.36 837
M98 452 934 1237 938 http://..
===================================================
Calculation:
row2/row2, row3/row2, row4/row2...row3400/row2
row2/row3, row3/row3, row4/row3 ... row3400/row3
row2/row4, row3/row4 ...row3400/row4
E.g dataS01R1
become:
ID dataS01R1 ..dataS01R02... Links
M45 1 (345.2/345.2) http://..
M34 2.42 (836/345.2)
M72 2.52 (873/345.2)
M98 1.309 (452/345.2) http://..
M45 0.41 (345.2/836) http://..
M34 1 (836/836)
M72 1.04 (873/836)
M98 0.54 (452/836) http://..
.
. (loop through rows as denominator)
.
##
##
if($first)
{
#if this is the first file, find the column locations
my $firstline = ; #read in the header line
chomp $firstline;
my @columns = split(/\t/, $firstline);
my $columncount = 0;
while($columncount <= $#columns && !($columns[$columncount] =~ /ID/))
{
$columncount++;
}
$ID= $columncount;
while($columncount <= $#columns && !(($columns[$columncount] =~ /_dataS(\d+)R/) ))
{
$columncount++;
}
$intensitydata = $columncount;
#read in the remainder of the file
while()
{
#add the id, intensity values to an array
chomp $_;
my @templine = split(/\t/,$_);
my @tempratio = ();
push(@tempratio, $templine[$ID]);
push(@tempratio, $templine[$intensitydata]);
print "\nWriting output...";