diff SMART/DiffExpAnal/DESeqTools/clusterPlot.R @ 31:0ab839023fe4

Uploaded
author m-zytnicki
date Tue, 30 Apr 2013 14:33:21 -0400
parents 94ab73e8a190
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SMART/DiffExpAnal/DESeqTools/clusterPlot.R	Tue Apr 30 14:33:21 2013 -0400
@@ -0,0 +1,27 @@
+# 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()
+}