## Heterogeneity Analysis

First, we asked in how many tissues is a QTL signficiant.

lfsr=read.table("../../Data_vhat/withvhatlfsr.txt")[,-1]
lfsr[lfsr<0]=0

colnames(lfsr)=tissue.names
colnames(lfsr.nobrain)=tissue.names[-c(7:16)]
colnames(lfsr.brain.only)=tissue.names[c(7:16)]

pm.mash.beta=pm.mash*standard.error

thresh=0.05

Here, we show the Proportion of Sharing by Sign:

sigmat=(lfsr<=thresh)
nsig= rowSums(sigmat)
(signall=mean(het.norm(pm.mash.beta[nsig>0,])>0))
## [1] 0.8512519
##show that results are robust in global analysis###
sigmat=(lfsr[,-c(7:16)]<=thresh)
nsig= rowSums(sigmat)
(signall.nobrain=mean(het.norm(pm.mash.beta[nsig,-c(7:16)])>0))
## [1] 0.8493332
sigmat=(lfsr[,c(7:16)]<=thresh)
nsig= rowSums(sigmat)
(signall.brainonly=mean(het.norm(pm.mash.beta[nsig>0,c(7:16)])>0))
## [1] 0.9602292
####SHow that results are robust in specific analysis

sigmat=(lfsr.nobrain<=thresh)
nsig= rowSums(sigmat)
(signnobrain=mean(het.norm(pm.mash.nobrain[nsig>0,])>0))
## [1] 0.8823972
sigmat=(lfsr.brain.only<=thresh)
nsig= rowSums(sigmat)
(signbrainonly=mean(het.norm(pm.mash.brain.only[nsig>0,])>0))
## [1] 0.9840876

Here, we show heterogeneity by magnitude:

sigmat=(lfsr<=thresh)
nsig= rowSums(sigmat)
(magall=mean(het.norm(pm.mash.beta[nsig>0,])>0.5))
## [1] 0.3591297
##show that results are robust###
sigmat=(lfsr[,-c(7:16)]<=thresh)
nsig= rowSums(sigmat)
(magall.excludingbrain=mean(het.norm(pm.mash.beta[nsig>0,-c(7:16)])>0.5))
## [1] 0.3976238
sigmat=(lfsr[,c(7:16)]<=thresh)
nsig= rowSums(sigmat)
(magall.brainonly=mean(het.norm(pm.mash.beta[nsig>0,c(7:16)])>0.5))
## [1] 0.7638909
##show that results are robust###
sigmat=(lfsr.nobrain<=thresh)
nsig= rowSums(sigmat)
(magnobrain=mean(het.norm(pm.mash.nobrain[nsig>0,])>0.5))
## [1] 0.4445148
sigmat=(lfsr.brain.only<=thresh)
nsig= rowSums(sigmat)
(magbrain=mean(het.norm(pm.mash.brain.only[nsig>0,])>0.5))
## [1] 0.8586027