Hi, I need to generate a heatmap on a square matrix and wouldn't want to reorder the columns and the rows on the heatmap display. I have used the options Rowv=NULL and Colv=NULL but doesn't seem to work. Following is a snippet of the heatmap function i am using. args <- commandArgs(); inputfile <- args[2] imgfile <- args[3] bitmap(imgfile, height=15, width=15, res=100, pointsize=9) library(gplots) library(RColorBrewer) data <- read.table(inputfile) matrix <- as.matrix(data) cp <- colorRampPalette(c("red","yellow","darkgreen"),space="Lab", bias=1.5) heatmap.2(matrix, Colv=1:ncol(matrix), dendogram="row", hclustfun=function(m) hclust(m,method="complete"),col=cp(25),scale="none",trace="none",keysize=1,margins=c(5,12), cexCol=1, cexRow=1) q() dev.off() The alternative that i tried to avoid the reordering was heatmap.2(matrix, Rowv=NULL, Colv=NULL, col=cp(25), scale="none", trace="none", keysize=1, margins=c(5,12), cexCol=1, cexRow=1) But the above command doesnt generate the heatmap. So could anyone let me know what are the options to avoid reordering the rows and columns of the heatmap and i dont want the dendogram. I am using the R version 2.8.0 (2008-10-20)". Thanks, Tanuja [[alternative HTML version deleted]]
James W. MacDonald
2009-Apr-07 13:02 UTC
[R] heatmap.2 no reordering of the columns and rows
Hi Tanuja, Tanuja Bompada wrote:> Hi, > I need to generate a heatmap on a square matrix and wouldn't want to reorder the columns and the rows on the heatmap display. > I have used the options Rowv=NULL and Colv=NULL but doesn't seem to work. Following is a snippet of the heatmap function i am using. > > args <- commandArgs(); > inputfile <- args[2] > imgfile <- args[3] > > bitmap(imgfile, height=15, width=15, res=100, pointsize=9) > > library(gplots) > library(RColorBrewer) > data <- read.table(inputfile) > matrix <- as.matrix(data) > cp <- colorRampPalette(c("red","yellow","darkgreen"),space="Lab", bias=1.5) > heatmap.2(matrix, Colv=1:ncol(matrix), dendogram="row", hclustfun=function(m) hclust(m,method="complete"),col=cp(25),scale="none",trace="none",keysize=1,margins=c(5,12), cexCol=1, cexRow=1) > q() > dev.off() > > The alternative that i tried to avoid the reordering was > > heatmap.2(matrix, Rowv=NULL, Colv=NULL, col=cp(25), scale="none", trace="none", keysize=1, margins=c(5,12), cexCol=1, cexRow=1)Try using Rowv = FALSE, Colv = FALSE instead of NULL. Also, add dendrogram = "none". Best, Jim> > But the above command doesnt generate the heatmap. So could anyone let me know what are the options to avoid reordering the rows and columns of the heatmap and i dont want the dendogram. I am using the R version 2.8.0 (2008-10-20)". > > Thanks, > Tanuja > > > > > > [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826
Thanks James. That worked. Tanuja --- On Tue, 4/7/09, James W. MacDonald <jmacdon@med.umich.edu> wrote: From: James W. MacDonald <jmacdon@med.umich.edu> Subject: Re: [R] heatmap.2 no reordering of the columns and rows To: "Tanuja Bompada" <tanujabompada@yahoo.com> Cc: r-help@r-project.org Date: Tuesday, April 7, 2009, 8:02 AM Hi Tanuja, Tanuja Bompada wrote:> Hi, > I need to generate a heatmap on a square matrix and wouldn't want to reorder the columns and the rows on the heatmap display. I have used the options Rowv=NULL and Colv=NULL but doesn't seem to work. Following is a snippet of the heatmap function i am using. > > args <- commandArgs(); > inputfile <- args[2] > imgfile <- args[3] > > bitmap(imgfile, height=15, width=15, res=100, pointsize=9) > > library(gplots) > library(RColorBrewer) > data <- read.table(inputfile) > matrix <- as.matrix(data) > cp <- colorRampPalette(c("red","yellow","darkgreen"),space="Lab", bias=1.5) > heatmap.2(matrix, Colv=1:ncol(matrix), dendogram="row", hclustfun=function(m) hclust(m,method="complete"),col=cp(25),scale="none",trace="none",keysize=1,margins=c(5,12), cexCol=1, cexRow=1) > q() > dev.off() > > The alternative that i tried to avoid the reordering was > heatmap.2(matrix, Rowv=NULL, Colv=NULL, col=cp(25), scale="none", trace="none", keysize=1, margins=c(5,12), cexCol=1, cexRow=1)Try using Rowv = FALSE, Colv = FALSE instead of NULL. Also, add dendrogram = "none". Best, Jim> > But the above command doesnt generate the heatmap. So could anyone let me know what are the options to avoid reordering the rows and columns of the heatmap and i dont want the dendogram. I am using the R version 2.8.0 (2008-10-20)". > > Thanks, > Tanuja > > > > > [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826 [[alternative HTML version deleted]]