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

Uploaded
author m-zytnicki
date Tue, 30 Apr 2013 14:33:21 -0400
parents 94ab73e8a190
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 # clusterPlot
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2 # dendrogram of sample clustering
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4 # input : counts, outputName, type of data (raw or norm)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5 # output : dendrogram (jpeg)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 # created Sept 13th, 2012
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8 # modified Oct 30th, 2012
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9 # Marie-Agnes Dillies
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12 clusterPlot <- function( cds, OUT_clusterPlot, type = "raw", out = TRUE ){
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 if (out) png( file=OUT_clusterPlot )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 if (type == "norm"){
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17 cdsblind <- estimateDispersions( cds, method="blind" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18 vsd <- getVarianceStabilizedData( cdsblind )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20 else {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 vsd <- counts(cds)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23 hc <- hclust( dist(t(vsd)), method="ward" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24 plot( hc, xlab = "Euclidean distance, Ward criterion", main=paste("Cluster Dendrogram, ", type, " data", sep="") )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 if (out) dev.off()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27 }