Row labels in a heatmap
1
0
Entering edit mode
@liat-shavit-grievink-5387
Last seen 9.6 years ago
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]]
Microarray Microarray • 30k views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 35 minutes ago
United States
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 COMMENT
0
Entering edit mode
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 REPLY
0
Entering edit mode
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 REPLY
0
Entering edit mode
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 REPLY
0
Entering edit mode
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 REPLY

Login before adding your answer.

Traffic: 766 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6