A prototype to plot various M&M output information.
result_file = 'small_data_100_mixture01_1_oracle_generator_1_mnm_mixture01_1.rds'
meta_file = 'small_data_100_mixture01_1.pkl'
X_file = 'small_data_100.rds'
dat = readRDS(result_file)$result
names(dat)
rownames(dat$coef) = NULL
meta = dscrutils::read_dsc(meta_file)
Y = meta$Y
X = readRDS(X_file)$X
univariate_res = lapply(1:ncol(Y), function(i) susieR:::univariate_regression(X,Y[,i]))
dat$bhat = do.call(cbind, lapply(1:ncol(Y), function(i) univariate_res[[i]]$betahat))
dat$shat = do.call(cbind, lapply(1:ncol(Y), function(i) univariate_res[[i]]$sebetahat))
We can directly call SuSiE plot function. Since it is simulated data we can add the true causal effects to it.
truth = meta$meta$true_coef
true_pos = as.integer(apply(truth, 1, sum) != 0)
true_idx = which(truth != 0, arr.ind = TRUE)
true_idx
truth[which(truth!=0,arr.ind=T)[,1],]
dat$coef[-1,][true_idx]
pdf('susie_plot_demo.pdf', width=10, height=5)
susieR::susie_plot(dat,y='PIP', main = 'Default SuSiE plot for cross-condition PIP', xlab = 'SNP positions', add_legend = T, b=true_pos)
dev.off()
%preview susie_plot_demo.pdf -s png --dpi 100
Effect size will be the color of the bubble:
p = mvsusieR::mvsusie_plot(dat)
pdf('bubble_demo.pdf', width = p$width, height = p$height)
print(p$plot)
dev.off()
%preview bubble_demo.pdf -s png --dpi 100
p = mvsusieR::mvsusie_plot(dat, cs_only=F)
pdf('bubble_demo_full.pdf', width = p$width, height = p$height)
print(p$plot)
dev.off()
%preview bubble_demo_full.pdf -s png --dpi 100
p = mvsusieR::mvsusie_plot(dat, original_sumstat = TRUE)
pdf('bubble_demo_z.pdf', width = p$width, height = p$height)
print(p$plot)
dev.off()
%preview bubble_demo_z.pdf -s png --dpi 100
p = mvsusieR::mvsusie_plot(dat, original_sumstat = TRUE, cs_only = FALSE)
pdf('bubble_demo_z_full.pdf', width = p$width, height = p$height)
print(p$plot)
dev.off()
%preview bubble_demo_z_full.pdf -s png --dpi 100