#!/usr/bin/perl open(OUT,">Pairwise_vrGVs_40K_bin_0.2%.xls"); print OUT "BinKey\tNo_of_pairs\t[2000000 possible pairs, 40000 vrGVs per inividual, freq = 0.2%]\n"; $shared_rare_SNPs =0; $max = 0; %bin = (); for $pairs(1 .. 2000000) #[~2000000 possible pairs for a sample of 2000 genetically non-related virtual individuals.] { for ( 1 .. 40000 ) { #[each virtual inividual has 40000 very rare SNPs (vrGVs).] $random = int(rand 500); #[population frequency of rare SNPs = 0.2% = 1 in 500] #(= probability of two virtual individuals sharing rare SNPs).] if ($random == 295){ $shared_rare_SNPs++; } } if($shared_rare_SNPs > $max){$max=$shared_rare_SNPs;} $temp = ($shared_rare_SNPs/10); $int = int($temp); $bin{$int}++; $shared_rare_SNPs =0; } foreach $key (sort{$a<=>$b}(keys %bin)) { print OUT "$key ==> $bin{$key} \n"; } print OUT "maximum number of shared SNPs is $max\n"; print"maximum number of shared SNPs is $max\n";