load(file="AncestMat.Rda") load(file="SubPopCorMat.Rda") load(file="DenisovaMat.Rda") load(file="NeanderMat.Rda") load(file="PopulationMat.Rda") colSums(DenisovaMat) source("count_snvs.R") length(res) data <- read.table("KPGP1000_chr1_annot.txt",skip=2) a1 <- which(data[[10]]<0.05) length(a1) a2 <- which(data[[10]]>(1/(2*1131-1))) a0 <- intersect(a1,a2) length(a0) summary(data[[10]][a1]) summary(data[[10]][a0]) a3 <- which(data[[10]]>(2/(2*1131-1))) a01 <- intersect(a1,a3) length(a01) #---------------- mean(data[[10]]) length(data[[10]]) aT <- table(data[[10]]) sum(aT[1:114])+ sum(aT[(2263-114+1):2263]) Rare SNPs (0<=MAF<=0.05 OR 0.95<=MAF<=1.0): Without zero and privat: sum(aT[3:114])+ sum(aT[(2263-114+1):(2263-2)]) freqs <- names(aT) dim(aT) <- c(1,2264) colnamesAT <- 0:2263 colnames(aT) <- colnamesAT write.table(aT,file="MAFstatistics.txt") s <- 0 for (i in 3:113) { s <- s + aT[i]*(i-1) } s for (i in ((2263-113+1):(2263-2))) { s <- s + aT[i]*(2263-i) } s s <- 0 for (i in 2:2263) { s <- s + aT[i]*(i-1) } s 3167651 MAF without 0 and privat SNPs and SNPs >0.05 MAF: 30994086/(2184*3201157) [1] 0.004433219 MAF without 0 and privat SNPs and SNPs >0.05 MAF and with change of major: 31978538/(2184*3201157) [1] 0.00457403 486510822/(2184*3201157) [1] 0.06958777 ########################## RESULTS: MAF: 0.06958777 MAF without 0 and privat SNPs and SNPs >0.05 MAF: 0.004433219 MAF without 0 and privat SNPs and SNPs >0.05 MAF and with change of major: 0.00457403 3201157 SNPS 13665 (0.43%) SNPs with frequency 0 486510822 minor alleles 30994086 minor alleles without 0 and private SNPs and >0.05 MAF 683851 (21.4%) private SNPs