Search
Question: Row labels in a heatmap
0
gravatar for Liat Shavit Grievink
5.3 years ago by
Liat Shavit Grievink60 wrote:
Hi all, I'm trying to draw a heatmap for some microarray data. Since I have many genes, the gene names (row labels) are not readable. I would like to replace these gene names by seq(0,500,by=100). Any ideas on how to do that? I tried both heatmap and heatmap.2, but couldn't find a good way to do this. Many thanks! Liat. [[alternative HTML version deleted]]
ADD COMMENTlink modified 5.3 years ago by James W. MacDonald45k • written 5.3 years ago by Liat Shavit Grievink60
2
gravatar for James W. MacDonald
5.3 years ago by
United States
James W. MacDonald45k wrote:
Hi Liat, On 7/16/2012 9:12 AM, Liat S wrote: > Hi all, > I'm trying to draw a heatmap for some microarray data. > Since I have many genes, the gene names (row labels) are not readable. > I would like to replace these gene names by seq(0,500,by=100). I don't think you want to use that. Unless you only have 6 genes. ;-D Anyway, heatmap() and heatmap.2() just use the row.names of the matrix you input. So just change them. row.names(yourmatrix) <- seq(1, nrow(yourmatrix),1) You might also consider plotting the heatmap in such a way that you can read the row labels. As a pdf, you can play around with the width and height until you get what you want. Something like pdf("the.pdf", width = 20, height = 500) heatmap.2(yourmatrix, <otherargs>, lhei = c(0.05, 0.95)) dev.off() You want the lhei set so the proportions of the heatmap look reasonable. Best, Jim > Any ideas on how to do that? > I tried both heatmap and heatmap.2, but couldn't find a good way to do this. > Many thanks! > Liat. > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician University of Washington Environmental and Occupational Health Sciences 4225 Roosevelt Way NE, # 100 Seattle WA 98105-6099
ADD COMMENTlink written 5.3 years ago by James W. MacDonald45k
Hi James, Thank you! The thing is that I rather not have numbers 1 to 500, but for example: 1, 100, 200, 300,400, 500. or something like this (so show a label only every 100 genes). Thanks again, Liat. On 16.07.2012, at 16:24, James W. MacDonald wrote: > row.names(yourmatrix) <- seq(1, nrow(yourmatrix),1) [[alternative HTML version deleted]]
ADD REPLYlink written 5.3 years ago by Liat Shavit Grievink60
OK, so just set it to be so. nam <- rep("", nrow(yourmatrix)) nam[seq(1,nrow(yourmatrix), 100)] <- seq(1, nrow(yourmatrix), 100) row.names(yourmatrix) <- nam Best, Jim On 7/16/2012 9:42 AM, Liat Shavit Grievink wrote: > Hi James, > Thank you! > The thing is that I rather not have numbers 1 to 500, but for example: > 1, 100, 200, 300,400, 500. or something like this (so show a label > only every 100 genes). > Thanks again, > Liat. > On 16.07.2012, at 16:24, James W. MacDonald wrote: > >> row.names(yourmatrix) <- seq(1, nrow(yourmatrix),1) > -- James W. MacDonald, M.S. Biostatistician University of Washington Environmental and Occupational Health Sciences 4225 Roosevelt Way NE, # 100 Seattle WA 98105-6099
ADD REPLYlink written 5.3 years ago by James W. MacDonald45k
Yay!! Thank you so much! On 16.07.2012, at 16:46, James W. MacDonald wrote: > OK, so just set it to be so. > > nam <- rep("", nrow(yourmatrix)) > nam[seq(1,nrow(yourmatrix), 100)] <- seq(1, nrow(yourmatrix), 100) > row.names(yourmatrix) <- nam > > Best, > > Jim > > > > On 7/16/2012 9:42 AM, Liat Shavit Grievink wrote: >> Hi James, >> Thank you! >> The thing is that I rather not have numbers 1 to 500, but for >> example: 1, 100, 200, 300,400, 500. or something like this (so show >> a label only every 100 genes). >> Thanks again, >> Liat. >> On 16.07.2012, at 16:24, James W. MacDonald wrote: >> >>> row.names(yourmatrix) <- seq(1, nrow(yourmatrix),1) >> > > -- > James W. MacDonald, M.S. > Biostatistician > University of Washington > Environmental and Occupational Health Sciences > 4225 Roosevelt Way NE, # 100 > Seattle WA 98105-6099 > >
ADD REPLYlink written 5.3 years ago by Liat Shavit Grievink60
Hi Liat, I think you have to first run heatmap once, get the order of rows in the graph and feed the corresponding rows with the right name and leave others empty, in order to keep a regular interval between names. # example from ? heatmap x <- as.matrix(mtcars) rc <- rainbow(nrow(x), start=0, end=.3) cc <- rainbow(ncol(x), start=0, end=.3) hv <- heatmap(x, col = cm.colors(256), scale="column", RowSideColors = rc, ColSideColors = cc, margins=c(5,10), xlab = "specification variables", ylab= "Car Models", main = "heatmap(<mtcars data="">, ..., scale = \"column\")") # create a new name vector for the plot nn<-rep('', nrow(x)) nn[hv$rowInd[seq(1,nrow(x), 10)]]<-rownames(x)[hv$rowInd[seq(1,nrow(x), 10)]] # plot again with the desired row names 'labRow' heatmap(x, col = cm.colors(256), scale="column",labRow=nn, RowSideColors = rc, ColSideColors = cc, margins=c(5,10), xlab = "specification variables", ylab= "Car Models", main = "heatmap(<mtcars data="">, ..., scale = \"column\")") Hth, Dan On Mon, 2012-07-16 at 16:42 +0300, Liat Shavit Grievink wrote: > Hi James, > Thank you! > The thing is that I rather not have numbers 1 to 500, but for example: > 1, 100, 200, 300,400, 500. or something like this (so show a label > only every 100 genes). > Thanks again, > Liat. > On 16.07.2012, at 16:24, James W. MacDonald wrote: > > > row.names(yourmatrix) <- seq(1, nrow(yourmatrix),1) > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLYlink written 5.3 years ago by Dan Du210
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 149 users visited in the last hour