# prep data
geneExpr = exprs(gset)
info = phenoData(gset)@data
colnames(info) = gsub(' ', '_', gsub(":ch1$", '', colnames(info)))

keep = grep("ESC", info$cell_line_of_origin, invert=TRUE)
geneExpr = geneExpr[,keep]
info = info[keep,]

keep = grep("fibro", info$differentiation_state, invert=TRUE)
geneExpr = geneExpr[,keep]
info = info[keep,]

info$Donor = gsub(".* (\\S+)$", "\\1", info$cell_line_of_origin)
info$cell_type[is.na(info$cell_type)] = 'neurospheres'

info$state = NA
info$state[info$differentiation_state == 'neurons at rest (day 45 of differentiation)'] = "rest"
info$state[info$differentiation_state == 'neurons kept in 67mM KCl for 9h'] = "KCl"

variancePartition

form <- ~ (1|differentiation_state) + (1|Donor) + (1|genotype)
vp = fitExtractVarPartModel( geneExpr, form, info)
plotVarPart(sortCols(vp))

dupCorList = foreach(ds = unique(info$differentiation_state) ) %do% {
  cat("\r", ds, '        ')  
  idx = info$differentiation_state == ds

  design = model.matrix( ~ genotype, info[idx,])
  dupcor <- duplicateCorrelation(geneExpr[,idx], design, block=info$Donor[idx])

  # dupcor = list(consensus=0.047)
  fitDupCor <- lmFit(geneExpr[,idx], design, block=info$Donor[idx], correlation=dupcor$consensus)
  fitDupCor = eBayes( fitDupCor )
  list(fitDupCor = fitDupCor, consensus=dupcor$consensus)
} 
neurons at rest (day 45 of differentiation) iPSC neurospheres (at day 7 in suspension) neurons kept in 67mM KCl for 9h
names(dupCorList) = unique(info$differentiation_state) 
dreamList = foreach(ds = unique( info$differentiation_state) ) %do% {
    
  cat("\r", ds, '        ')  
  idx = info$differentiation_state == ds

  # new syntax
  form <- ~ genotype + (1|Donor)     
  fitmm = dream( geneExpr[,idx], form, info[idx,])
  fitmm
}  
neurons at rest (day 45 of differentiation) Dividing work into 100 chunks... iPSC Dividing work into 100 chunks... neurospheres (at day 7 in suspension) Dividing work into 100 chunks... neurons kept in 67mM KCl for 9h Dividing work into 100 chunks...
names(dreamList) = unique(info$differentiation_state) 
figList = foreach( ds = names(dupCorList) ) %do% {

  # Compare p-values and make plot
  p1 = topTable(dupCorList[[ds]]$fitDupCor, coef="genotypeTS", number=Inf, sort.by="none")$P.Value
  p2 = topTable(dreamList[[ds]], coef="genotypeTS", number=Inf, sort.by="none")$P.Value
       
  plotCompareP( p1, p2, with(vpList[[ds]], Donor), dupCorList[[ds]]$consensus) + ggtitle( ds )
}
do.call("grid.arrange", c(figList, ncol=2))

Examine top difference between methods

library(lmerTest)
ds = names(dupCorList)[4]
         
# Find gene with greatest difference in -log10(p)
p1 = topTable(dupCorList[[ds]]$fitDupCor, coef="genotypeTS", number=Inf, sort.by="none")$P.Value
p2 = topTable(dreamList[[ds]], coef="genotypeTS", number=Inf, sort.by="none")$P.Value
j = which.max(abs(-log10(p1) + log10(p2)))

pvals = list()

# dream p-values
pvals[['dream']] = topTable(dreamList[[ds]], number=Inf, sort.by="none")[j,]$P.Value
# duplicateCorrelation results
pvals[['duplicateCorrelation']] = topTable(dupCorList[[ds]]$fitDupCor, number=Inf, sort.by="none")[j,]$P.Value
# p-value from lmer
idx = info$differentiation_state == ds
y = t(geneExpr[j,idx,drop=FALSE])
fitm = lmer( y ~ genotype + (1|Donor), info[idx,], REML=TRUE  )
# coef(summary(fitm))
pvals[['lmer()']] = coef(summary(fitm))[2,5]


# p-value from linear model
fit = lm( y ~ genotype, info[idx,]  )
# coef(summary(fit))
pvals[['lm()']] = coef(summary(fit))[2,4]

# linear model on individual averages
GE = data.table( Expression = as.numeric(y), Indiv =  info[idx,]$Donor, Genotype =  info[idx,]$genotype)
data = GE[,data.frame(Expression=mean(Expression)), by="Indiv"]
data = merge(data, unique(GE[,2:3]), by="Indiv", all.x=TRUE, all=FALSE)

pvals[['lm() on Individual averages (n=4)']] = coef(summary(lm( Expression ~ Genotype, data)))[2,4]

library(knitr)
kable(data.frame( p.value = sapply(pvals, function(x) format(x, digits=3, scientific=3))))
p.value
dream 0.0684
duplicateCorrelation 7.96e-09
lmer() 0.0684
lm() 1.81e-08
lm() on Individual averages (n=4) 0.0044

We see that duplicateCorrelation and a simple linear model give very significant p-values for this probe (ILMN_2209027). However, dream and lmer() give this probe much larger p-values. Indeed, summarizing the data at the individual level and applying a linear model on the mean expression per individual for 4 individuals, gives a p-value more similar to dream/lmer. Thus, the dream/lmer method is approviately conservative and duplicateCorrelation/lm gives a very liberal p-value in this case.

DE versus eQTL

Count DE genes between cases and controls in each cell type

cellType count method
neurons at rest (day 45 of differentiation) 27 dream
neurons at rest (day 45 of differentiation) 49 DupCor
iPSC 3 dream
iPSC 12 DupCor
neurospheres (at day 7 in suspension) 11 dream
neurospheres (at day 7 in suspension) 39 DupCor
neurons kept in 67mM KCl for 9h 4 dream
neurons kept in 67mM KCl for 9h 31 DupCor

Enrichments

dupCor: neurons at rest (day 45 of differentiation)

NGenes Direction PValue FDR
h.HALLMARK_MYC_TARGETS_V2 52 Up 3.4e-11 6.3e-07
c5.GO_NUCLEOLAR_PART 52 Up 1.4e-08 1.3e-04
c5.GO_ENDONUCLEASE_ACTIVITY_ACTIVE_WITH_ 28 Up 2.7e-08 1.3e-04
c7.GSE6674_ANTI_IGM_VS_CPG_STIM_BCELL_DN 147 Up 2.8e-08 1.3e-04
tissue_exp_brain 282 Down 3.4e-08 1.3e-04
c2.MANALO_HYPOXIA_DN 252 Up 4.6e-08 1.3e-04
c5.GO_PRERIBOSOME 52 Up 5.0e-08 1.3e-04
ribosome biogenesis 136 Up 7.6e-08 1.8e-04
c7.GSE45739_NRAS_KO_VS_WT_ACD3_ACD28_STI 162 Up 8.5e-08 1.8e-04
KEGG_RIBOSOME_BIOGENESIS_IN_EUKARYOTES 62 Up 2.8e-07 5.2e-04

dream: neurons at rest (day 45 of differentiation)

NGenes Direction PValue FDR
h.HALLMARK_MYC_TARGETS_V2 52 Up 3.2e-08 0.0003
tissue_exp_brain 282 Down 3.2e-08 0.0003
c7.GSE45739_NRAS_KO_VS_WT_ACD3_ACD28_STI 162 Up 2.7e-07 0.0017
ribosome biogenesis 136 Up 1.5e-06 0.0055
rRNA processing 99 Up 1.8e-06 0.0055
c5.GO_ENDONUCLEASE_ACTIVITY_ACTIVE_WITH_ 28 Up 1.8e-06 0.0055
c7.GSE4142_NAIVE_VS_GC_BCELL_DN 140 Up 2.9e-06 0.0072
c5.GO_PRERIBOSOME 52 Up 3.1e-06 0.0072
rRNA metabolic process 101 Up 3.5e-06 0.0073
c5.GO_RIBOSOMAL_LARGE_SUBUNIT_BIOGENESIS 43 Up 6.1e-06 0.0111

dupCor: iPSC

NGenes Direction PValue FDR
c2.SWEET_KRAS_TARGETS_UP 68 Up 1.1e-08 0.00020
h.HALLMARK_EPITHELIAL_MESENCHYMAL_TRANSI 155 Up 2.6e-08 0.00020
c6.BMI1_DN_MEL18_DN.V1_UP 89 Up 3.3e-08 0.00020
c5.GO_CELL_JUNCTION_ASSEMBLY 83 Up 8.6e-08 0.00031
c2.KEGG_ECM_RECEPTOR_INTERACTION 43 Up 8.9e-08 0.00031
c5.GO_CELL_JUNCTION_ORGANIZATION 118 Up 1.1e-07 0.00031
c2.PID_INTEGRIN1_PATHWAY 42 Up 1.2e-07 0.00031
c2.PASINI_SUZ12_TARGETS_DN 253 Up 1.4e-07 0.00032
KEGG_ECM-RECEPTOR_INTERACTION 44 Up 1.8e-07 0.00033
kegg_ECM-receptor_interaction 44 Up 1.8e-07 0.00033

dream: iPSC

NGenes Direction PValue FDR
c2.SWEET_KRAS_TARGETS_UP 68 Up 4.3e-09 0.00008
h.HALLMARK_EPITHELIAL_MESENCHYMAL_TRANSI 155 Up 1.9e-08 0.00014
c2.PASINI_SUZ12_TARGETS_DN 253 Up 3.0e-08 0.00014
c2.KEGG_ECM_RECEPTOR_INTERACTION 43 Up 4.8e-08 0.00014
c2.PID_INTEGRIN1_PATHWAY 42 Up 5.0e-08 0.00014
KEGG_ECM-RECEPTOR_INTERACTION 44 Up 5.2e-08 0.00014
kegg_ECM-receptor_interaction 44 Up 5.2e-08 0.00014
c6.BMI1_DN_MEL18_DN.V1_UP 89 Up 6.3e-08 0.00015
c5.GO_CELL_JUNCTION_ASSEMBLY 83 Up 1.2e-07 0.00024
c2.KIM_WT1_TARGETS_UP 167 Up 1.7e-07 0.00032

dupCor: neurospheres (at day 7 in suspension)

NGenes Direction PValue FDR
c5.GO_ENDONUCLEASE_ACTIVITY_ACTIVE_WITH_ 28 Up 2.1e-05 0.3
endonuclease activity 26 Up 6.0e-05 0.3
DNA strand elongation 29 Up 7.2e-05 0.3
DNA strand elongation involved in DNA re 28 Up 9.1e-05 0.3
c2.KEGG_THYROID_CANCER 19 Down 9.7e-05 0.3
KEGG_THYROID_CANCER 19 Down 9.7e-05 0.3
c5.GO_CILIUM_MOVEMENT 15 Down 1.9e-04 0.4
c2.KEGG_GRAFT_VERSUS_HOST_DISEASE 5 Down 2.1e-04 0.4
KEGG_GRAFT-VERSUS-HOST_DISEASE 5 Down 2.1e-04 0.4
kegg_Graft-versus-host_disease 5 Down 2.1e-04 0.4

dream: neurospheres (at day 7 in suspension)

NGenes Direction PValue FDR
c5.GO_CILIUM_MOVEMENT 15 Down 6.5e-05 0.55
endonuclease activity 26 Up 7.3e-05 0.55
DNA strand elongation 29 Up 9.0e-05 0.55
DNA strand elongation involved in DNA re 28 Up 1.9e-04 0.55
c2.PID_RHOA_REG_PATHWAY 30 Up 2.8e-04 0.55
c2.REACTOME_DNA_STRAND_ELONGATION 26 Up 2.9e-04 0.55
c5.GO_ENDONUCLEASE_ACTIVITY_ACTIVE_WITH_ 28 Up 3.3e-04 0.55
rhoa_reg_pathway 31 Up 3.4e-04 0.55
DNA_strand_elongation 27 Up 3.4e-04 0.55
c2.KEGG_GRAFT_VERSUS_HOST_DISEASE 5 Down 3.7e-04 0.55

dupCor: neurons kept in 67mM KCl for 9h

NGenes Direction PValue FDR
c2.ZHANG_TLX_TARGETS_DN 77 Up 1.4e-11 2.7e-07
c2.ZHOU_CELL_CYCLE_GENES_IN_IR_RESPONSE_ 71 Up 3.7e-11 3.4e-07
c2.KEGG_DNA_REPLICATION 30 Up 7.5e-11 3.5e-07
KEGG_DNA_REPLICATION 30 Up 7.5e-11 3.5e-07
c2.REACTOME_ACTIVATION_OF_THE_PRE_REPLIC 25 Up 1.4e-10 4.0e-07
Activation_of_the_pre-replicative_compl 25 Up 1.4e-10 4.0e-07
c2.ZHANG_TLX_TARGETS_60HR_DN 226 Up 1.5e-10 4.0e-07
DNA strand elongation involved in DNA re 28 Up 4.9e-10 1.1e-06
DNA strand elongation 29 Up 1.7e-09 3.2e-06
c2.REACTOME_DNA_STRAND_ELONGATION 26 Up 1.7e-09 3.2e-06

dream: neurons kept in 67mM KCl for 9h

NGenes Direction PValue FDR
c2.ZHANG_TLX_TARGETS_DN 77 Up 6.1e-12 1.1e-07
c2.ZHANG_TLX_TARGETS_60HR_DN 226 Up 1.0e-10 9.6e-07
c2.ZHOU_CELL_CYCLE_GENES_IN_IR_RESPONSE_ 71 Up 6.8e-10 4.3e-06
c2.MANALO_HYPOXIA_DN 252 Up 1.7e-09 7.8e-06
c2.ZHANG_TLX_TARGETS_36HR_DN 143 Up 1.0e-08 3.1e-05
c2.KEGG_DNA_REPLICATION 30 Up 1.2e-08 3.1e-05
KEGG_DNA_REPLICATION 30 Up 1.2e-08 3.1e-05
c2.GRAHAM_NORMAL_QUIESCENT_VS_NORMAL_DIV 76 Up 1.8e-08 4.1e-05
c2.VERNELL_RETINOBLASTOMA_PATHWAY_UP 56 Up 2.1e-08 4.3e-05
c2.REACTOME_ACTIVATION_OF_ATR_IN_RESPONS 30 Up 2.7e-08 5.0e-05

Compare enrichment

Publication plot