Permalink
Browse files

add heatmap generating code

  • Loading branch information...
1 parent d3847e7 commit 465b994ae07cc83f25f29e1314c960632df1fa4a @hyphaltip committed Apr 12, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 R/plot_heatmap.R
View
@@ -0,0 +1,13 @@
+dat <-read.table("genematrix_table.tab",header=T,sep="\t")
+row.names(dat) = dat$GENE
+dat = dat[,2:5] # this does require us to know how many strains are in the file - fix this when we know the column count
+gene_matrix <- data.matrix(dat)
+
+# choose some nice blue colors
+palette <- colorRampPalette(c('#f0f3ff','#0033BB'))(256)
+hc.rows <- hclust(dist(gene_matrix))
+hc.cols <- hclust(dist(t(gene_matrix)))
+pdf("genematrix_heatmap.pdf")
+
+gene_heatmap <- heatmap(gene_matrix, Rowv=as.dendrogram(hc.rows), Colv=as.dendrogram(hc.cols),
+col = palette, scale="none",margins=c(5,10))

0 comments on commit 465b994

Please sign in to comment.