| 
18
 | 
     1 # clusterPlot
 | 
| 
 | 
     2 # dendrogram of sample clustering
 | 
| 
 | 
     3 
 | 
| 
 | 
     4 # input : counts, outputName, type of data (raw or norm)
 | 
| 
 | 
     5 # output : dendrogram (jpeg)
 | 
| 
 | 
     6 
 | 
| 
 | 
     7 # created Sept 13th, 2012
 | 
| 
 | 
     8 # modified Oct 30th, 2012
 | 
| 
 | 
     9 # Marie-Agnes Dillies
 | 
| 
 | 
    10 
 | 
| 
 | 
    11 
 | 
| 
 | 
    12 clusterPlot <- function( cds, OUT_clusterPlot, type = "raw", out = TRUE ){
 | 
| 
 | 
    13 
 | 
| 
 | 
    14   if (out) png( file=OUT_clusterPlot )
 | 
| 
 | 
    15 
 | 
| 
 | 
    16   if (type == "norm"){
 | 
| 
 | 
    17     cdsblind <- estimateDispersions( cds, method="blind" )
 | 
| 
 | 
    18     vsd <- getVarianceStabilizedData( cdsblind )
 | 
| 
 | 
    19   }
 | 
| 
 | 
    20   else {
 | 
| 
 | 
    21     vsd <- counts(cds)
 | 
| 
 | 
    22   }
 | 
| 
 | 
    23   hc <- hclust( dist(t(vsd)), method="ward" )
 | 
| 
 | 
    24   plot( hc, xlab = "Euclidean distance, Ward criterion", main=paste("Cluster Dendrogram, ", type, " data", sep="") )
 | 
| 
 | 
    25 
 | 
| 
 | 
    26   if (out) dev.off()
 | 
| 
 | 
    27 }
 |