view deseq/differential_expression_analysis_pipeline_for_rnaseq_data-a03838a6eb54/DiffExpAnal/DESeqTools/clusterPlot.R @ 10:6e573fd3c41b draft

Uploaded
author yufei-luo
date Mon, 13 May 2013 10:06:30 -0400
parents
children
line wrap: on
line source

# clusterPlot
# dendrogram of sample clustering

# input : counts, outputName, type of data (raw or norm)
# output : dendrogram (jpeg)

# created Sept 13th, 2012
# modified Oct 30th, 2012
# Marie-Agnes Dillies


clusterPlot <- function( cds, OUT_clusterPlot, type = "raw", out = TRUE ){

  if (out) png( file=OUT_clusterPlot )

  if (type == "norm"){
    cdsblind <- estimateDispersions( cds, method="blind" )
    vsd <- getVarianceStabilizedData( cdsblind )
  }
  else {
    vsd <- counts(cds)
  }
  hc <- hclust( dist(t(vsd)), method="ward" )
  plot( hc, xlab = "Euclidean distance, Ward criterion", main=paste("Cluster Dendrogram, ", type, " data", sep="") )

  if (out) dev.off()
}