Question: Heatmap column side bar error
0
gravatar for emblake
2.5 years ago by
emblake50
United States
emblake50 wrote:

I have created a heatmap with a column side bar showing the associated donor ID with respect to the sample number. The column color bar doesn't match with the donor ID legend or the sample number, and I can't figure out what I'm doing wrong. Would someone please inspect my code? Thanks very much.

> y$sample$donor
 [1] "Donor1" "Donor1" "Donor1" "Donor1" "Donor1" "Donor2" "Donor2" "Donor2" "Donor2"
[10] "Donor2" "Donor3" "Donor3" "Donor3" "Donor3" "Donor3" "Donor4" "Donor4" "Donor4"
[19] "Donor4" "Donor4" "Donor5" "Donor5" "Donor5" "Donor5" "Donor5" "Donor6" "Donor6"
[28] "Donor6" "Donor6" "Donor6"
    col.colors <- sample(c(rep("cyan",5),
                           rep("blue",5),
                           rep("green",5),
                           rep("pink",5),
                           rep("red",5),
                           rep("yellow",5)),length(y$samples$donor))
>    heatmap.2(logCPM, col=col.pan, ColSideColors = col.colors, trace = "none",
              dendrogram = "column", cexRow = 1, cexCol = 1, margin = c(8,6), 
              lhei = c(2,10), lwid = c(2,6))
>    legend("left",legend=c("Donor1","Donor2","Donor3","Donor4","Donor5","Donor6"),
           fill=col.colors, border=FALSE, bty="n", y.intersp = .9, cex=.9)
heatmap rna-seq • 1.0k views
ADD COMMENTlink modified 2.5 years ago • written 2.5 years ago by emblake50

Although this is a question that should be fairly addressed in stackoverflow. But here are my 2 cents below.

Do not restrict yourself to only one package. Have you seen pheatmap(). It is pretty straigthforward to use annotation with them. Just create a dataframe with samples in rows and columns with the donor ID and parse them while using the pheatmap function in R. It should work.

ADD REPLYlink written 2.5 years ago by ivivek_ngs4.8k

Thanks - I will check out the documentation for pheatmap.

Wasn't sure if Biostars was the appropriate forum, but thought feedback would be worthwhile since my issue is related to analysis of RNA-seq data.

ADD REPLYlink written 2.5 years ago by emblake50

Question cross posted on stack overflow: http://stackoverflow.com/questions/40916797/heatmap-column-side-bar-error.

ADD REPLYlink modified 2.5 years ago • written 2.5 years ago by emblake50
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.3.0
Traffic: 756 users visited in the last hour