#!/usr/local/perl #Updated 6/23/2014. #The program is a modofication of (IDs_seperator.pl). The difference between the two programs is that the 22 chromosomes files used in this programs contain only data of shared very rare SNPs only (not the whole genome data) # this program is to save the Identifiers of each population in a seprate file to save processing time. # used this program to make small table that will have one population Identifiers extracted and save into smaller tables. The files of .gz saved in Fedorov home directory wil be used to extract the tables. # #open (OUT1, ">ID_Seperator_Timecheck_TSI") || die "can't open OUT1 : $!\n"; #$str = localtime(); #print OUT1 "$str\n"; $l_N = 0; @id =(); @b =(); open(IN, "20111108_1000genomes_samples2.txt") || die "Can't open 20111108 : $!\n"; while() { $l_N++; if ($l_N > 26) { if ($_ =~/^($ARGV[0])/){ # if ($_ =~/^($ARGV[0])/ || /^($ARGV[1])/){#i modified this program by adding || /^($ARGV[1]) soi can make a table of two populations. $c++; @a=split(/\t/, $_); push(@id, $a[2]); } } } # this part to Print test #for $n(0..$#id){ #print "$n\t$id[$n] \n" #} open (FILE, "head100_1000genome_testfile") || die "can't open head100_1000genome_testfile :$!\n"; while (){ $L_N++; if ($L_N == 30) { @e=split(/\t/, $_); for $s(0..$#id){ for $y(0..$#e){ if ($id[$s] eq $e[$y]){ push (@b, $y); } } } } } #Print test "it should print 89 IDs for GBR for example" #for $n(0..$#b){ #print "$n\t$b[$n] \n" #} $counter = 0; open (Fnames, "rareSNPs_Names.txt") || die "Can't open zippwd chromosomes name : $!\n"; @names =; foreach $names (@names) { $counter++; # open (FILE1, "$names") || die "Can't open zipped file chr21 : $!\n"; open (FILE1, "zcat /home/afedorov/$names |") || die "Can't open zipped file chr21 : $!\n"; $myline = 0; while (){ $myline++; if ($counter == 1){ if ($myline > 29) { @g=split(/\t/, $_); for $x(0..$#b){ print "$g[$b[$x]]\t"; } print "\n"; @g = (); } } else{ if ($myline > 30) { @g=split(/\t/, $_); for $x(0..$#b){ print "$g[$b[$x]]\t"; } print "\n"; @g = (); } } } } #$str1 = localtime(); #print OUT1 "$str1\n";