R/calcICLNoPlots.R

Defines functions calcICLNoPlots

Documented in calcICLNoPlots

#' @title Consensus Cluster Plus without Plots
#' 
#' @description 
#'   \code{consensusClusterNoPlots} is a wrapper function for
#'   \code{\link[ConsensusClusterPlus]{ConsensusClusterPlus}} that suppresses
#'   the creation of the plots that are created automatically.
#' 
#' @param consensus_results Results of consensus clustering. The second item
#'   in the list returned by \code{\link{neatmap}}.
#'  
#' @author Philippe Boileau , \email{philippe_boileau@@berkeley.edu}
#'  
#' @importFrom ConsensusClusterPlus calcICL
#' @importFrom grDevices png dev.off
#' 
calcICLNoPlots <- function(consensus_results){
  
  # create the tempfile to save the plots in (this works for Unix and Windows)
  ff <- tempfile()
  grDevices::png(filename=ff)
  
  # pass consensus cluser results to calcICL
  res <- calcICL(consensus_results)
  
  # delete the tempfile containing the plots
  grDevices::dev.off()
  unlink(ff)
  
  return(res)
}
PhilBoileau/neatmaps documentation built on April 21, 2022, 3:54 a.m.