R/vennDiagramDE.R

Defines functions vennDiagramDE

Documented in vennDiagramDE

#' Venn diagram
#'
#' Venn diagram of the features DE in all the comparisons performed
#'
#' @param complete list of results from \code{exportComplete()} or \code{exportComplete.edgeR()}
#' @param alpha significance threshold
#' @param out \code{TRUE} to export the figure
#' @param versionName versionName of the project
#' @return A venn diagram
#' @author Hugo Varet

# created Nov 27th, 2014

vennDiagramDE <- function(complete, alpha=0.05, out = TRUE, versionName="."){
  if (length(complete)>5) stop("This function cannot draw Venn diagrams with more than 5 lists. Select a subset of complete to run it.")
  features <- list()
  for (name in names(complete)) features[[name]] <- as.character(complete[[name]][which(complete[[name]][,"padj"] <= alpha),"Id"])  
  futile.logger::flog.threshold(futile.logger::ERROR, name = "VennDiagramLogger")
  vd <- venn.diagram(features, filename=NULL, fill=c(1:length(features))+1, cat.cex=0.7)
  if (out) pdf(file=paste0("figures/", versionName, "-vennDiagram.pdf"))
    grid.draw(vd)
  if (out) dev.off()
}
biomics-pasteur-fr/RNADiff documentation built on Aug. 27, 2020, 12:44 a.m.