#!/usr/bin/perl use strict; use warnings; use File::Find; use Scalar::Util qw(looks_like_number); open IN, "/home/big/scratch/affy_map.txt" or die "Cannot open reference\n"; my %ref; my $head = ; my $index = 0; while(){ chomp $_; my @row = split /\t/, $_; my $value = join "\t", $row[1],$row[2]; if($row[1] == 2 && $row[2] <= 50000 && $row[2] <= 51113178) { $ref{$index}=$value; print $index."\t".$value."\n";} if($row[1] == 22 && $row[2] <= 16300001 && $row[2] <= 20500000) { $ref{$index}=$value; print $index."\t".$value."\n"; } $index++; } close(IN); my @files; my $masterDirect = "/nfs/archive02/big/Norm/norm_gcc/"; find(\&file_names, $masterDirect); sub file_names { if( -f && $File::Find::name=~/\.nzd$/) { push @files, $File::Find::name; } } my $count=0; foreach(@files){ $count++; if($count % 100 == 0 ){ print "\n","-" x 10, " $count ", "-" x 10,"\n";} undef my @probes; open IN, $_; #file name handling my @inDir = split "\/", $_; my $id = pop(@inDir); $id =~ s/\.gcc.nzd$//; #header test $head =; if(looks_like_number($head)) { push @probes, $head; } #open output open OUT, ">/home/big/scratch/phase1_affy/".$id."_select_probeset.txt"; #load probe array @probes = ; close(IN); foreach my $key (sort keys %ref){ #intended function print OUT $ref{$key}."\t".$probes[$key]; #testing my @temp = split "\t", $ref{$key}; foreach(@temp){if($temp[0] == 2){print $key."\t".$ref{$key}."\t".$probes[$key];}} } close(OUT); }