#!/usr/bin/perl #use strict; use warnings; #print "Enter the input file name: "; #my $filename = ; #chomp ($filename); @ARGV == 1 or die "Invalid number of arguments. Please supply as arguments: \n1) the input file listing all data to be used."; my ($input_file) = @ARGV; open (IN, "$input_file") or die "Cannot open file: $!"; #head -1 ; #my $firstline = IN; my $x=0; my @keys; my @holder; my @array_hash; my $threshold=.03; my $blank = "-"; my $nonsyn = "nonsynonymous"; open (OUTFILE, ">TEST_$input_file") or die "Cannot create an output file: $!"; while(my $line = ) { print OUTFILE head -1; chomp($line); $x++; if ($x==1) { (@keys)=split(/\t/, $line); } else { my $y=0; (@holder) = split(/\t/, $line); my %hash; for my $column (@holder) { $hash{$keys[$y]}=$column; $y++; } # -ne print OUTFILE; exit; # my $first = shift (@array_hash); # print OUTFILE $first; if ($hash{"1000_Genomes"} ne $blank) { if ($hash{"1000_Genomes"} <= $threshold) { if ($hash{"Syn/Nonsyn"} eq $nonsyn) { print OUTFILE $line, "\n"; } } } if ($hash{"1000_Genomes"} eq $blank) { # if ($hash{"1000_Genomes"} <= $threshold) # { if ($hash{"Syn/Nonsyn"} eq $nonsyn) { print OUTFILE $line, "\n"; } # } } } }