MRCIEU / gwasglue

Linking GWAS data to analytical tools in R
Other
117 stars 39 forks source link

coloc only use 50 snps #18

Open explodecomputer opened 4 years ago

explodecomputer commented 4 years ago

Coloc recommends to only run tests on loci with 50 SNPs or more so I included a filter.

w1<-which(out[[1]]$varbeta==Inf|out[[2]]$varbeta=="Inf")
length(out[[1]]$snp)

for (k in 1:length(n)){
out[[1]][[k]]<-out[[1]][[k]][-w1]
out[[2]][[k]]<-out[[2]][[k]][-w1]
}

out <- gwasvcf_to_coloc(vcf1=paste0(path2,eqtl.traits[tr],"/",eqtl.traits[tr],".vcf.gz"),vcf2=paste0(path,trait[i],".harmonized.vcf.gz"),chrompos=chrpos)

w1<-which(out[[1]]$varbeta==Inf|out[[2]]$varbeta=="Inf")
length(out[[1]]$snp)

for (k in 1:length(n)){
out[[1]][[k]]<-out[[1]][[k]][-w1]
out[[2]][[k]]<-out[[2]][[k]][-w1]
}

length(out[[1]]$snp)

if(length(out[[1]]$snp)>50& length(out[[2]]$snp)>50) {
res <- coloc::coloc.abf(out[[1]], out[[2]])