#' Plot the distribution of the log2 Fold Changes
#'
#' Plot the distribution of the log2 Fold Changes for each comparison
#'
#' @param complete an element of the list created by of \code{exportComplete.DESeq2()} or \code{exportComplete.DESeq2()}
#' @param out \code{TRUE} to export the figure
#' @param versionName versionName of the project
#' @return A hisogram of the log2(Fold-Changes) for each comparison performed
#' @author Hugo Varet
# created Janurary 26th, 2017
# modified August 26th, 2019 (ggplot2)
diagLogFC <- function(complete, out = TRUE, versionName="."){
if (out) pdf(file=paste0("figures/", versionName, "-diagLog2FoldChange.pdf"))
for (name in names(complete)){
complete.name <- complete[[name]]
complete.name <- complete.name[which(!is.na(complete.name$log2FoldChange)),]
print(ggplot(data=complete.name, aes(x=.data$log2FoldChange)) +
geom_histogram(binwidth=0.5) +
scale_y_continuous(expand=expansion(mult=c(0.01, 0.05))) +
xlab(expression(log[2] ~ (FC))) +
ylab("Frequency") +
ggtitle(paste0(versionName," - log(Fold-Change) distribution\ncomparison ", name)))
}
if (out) dev.off()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.