Hello,

I'm new to Perl and am trying to write a script that I
think should be fairly basic...

The batch of input files (sample attached; real file
contains 100s of columns, 1000s of rows) will be in
the same format (tab delimited, matrix layout) and the
first row & column of the file are labels (i.e. 1st
column & row is same across all files, subsequent data
differs between files).  A single output file would be
produced in the same format as the input files, with
the labels.

The script would take a batch of files, calculate the
number of times a string, in the same position across
all files, is repeated and then compare that
calculation to a ratio for output (e.g. if "I" is
present in 7 out of a batch of 10 files then write "I"
to output, otherwise write "NC" to output).  Then
evaluate the next position in the row (i.e. same row
next column) across the batch, and so on for each
subsequent row.

Below is a snippet of my script, yet I'm stuck at the
the main part -- comparing one position across all
files (like comparing one position in a matrix across
matrices) and then moving to the next position.  Also
I'm unsure how to do computations with strings instead
of numbers.

Thank you in advance for your advice, 

David.


#!perl -w
use strict;

open (OUTPUT,">final_calls.txt")  || 
    die "Sorry, couldn't close open OUTPUT file: $!";

# create an array of input filenames.
my (@filelist);
foreach $filename (<change*.txt>) {
    push (@filelist,$filename);
    }
chomp (@filelist);

# compute data from corresponding files
foreach $filename (@filelist) {  
    open(INPUT,"$filename")  || 
        die "Sorry, couldn't open INPUT file for reading:
$!"; # .txt files going in 
    foreach $line (<INPUT>) { # checks each line in
each file of the file array.
        ($gene,@remainder) = split(/\t/,$line);

## THIS IS WHERE I'M STUCK

    }
}

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
        CL2001042601AA  CL2001042602AA  CL2001042603AA  CL2001042604AA  CL2001042605AA 
 CL2001042606AA
AFFX-MurIL2_at  NC      NC      NC      I       I       NC
AFFX-MurIL10_at NC      I       I       I       I       D
AFFX-MurIL4_at  NC      D       D       D       I       I
AFFX-MurFAS_at  NC      NC      NC      I       I       NC
AFFX-BioB-5_at  NC      D       D       NC      D       NC
AFFX-BioB-M_at  NC      NC      NC      NC      NC      I
AFFX-BioB-3_at  NC      NC      I       I       I       NC

Reply via email to