View source: R/bin_pv_distribution.R
1 | bin_pv_distribution(alloutputs, lowindx, folder, pvtitle, pvpicdim)
|
alloutputs |
|
lowindx |
|
folder |
|
pvtitle |
|
pvpicdim |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (alloutputs, lowindx, folder, pvtitle, pvpicdim)
{
dir.create(path = folder, showWarnings = FALSE)
df <- alloutputs$alldist$pvdist
df <- data.frame(df)
df$pvalue <- 10^(-as.numeric(as.character((df[, "rep"]))))
library(ggplot2)
for (i in 0:lowindx) {
p <- ggplot(df[df$dif == i, ], aes(x = pvalue)) + xlim(0,
1) + geom_histogram(aes(fill = ..count..), color = "black",
bins = 21, position = "dodge", boundary = 0)
if (i == 0) {
temp <- ggplot_build(p)$data[1]
}
p + geom_vline(aes(xintercept = 0.05), color = "#ff00cc",
linetype = "dashed", size = 2, show.legend = F) +
ylim(c(0, 1.1 * (max(temp[[1]]$y)))) + ggtitle(paste(pvtitle,
"permutation proportion", round(i/lowindx, 2), sep = " ")) +
theme_bw() + theme(plot.title = element_text(hjust = 0.5,
size = 30), legend.title = element_text(size = 20),
legend.text = element_text(size = 12)) + theme(panel.background = element_blank(),
axis.text = element_text(size = 24, face = "bold"),
axis.title = element_text(size = 20, face = "bold"),
panel.border = element_rect(colour = "black", fill = NA,
size = 0.5))
ggsave(filename = paste(folder, "/", round(i/lowindx,
2), "_permute", "_pvalue.eps", sep = ""), width = 7,
height = 7)
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.