Heatmap column side bar error
0
0
Entering edit mode
7.4 years ago
emblake ▴ 90

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)
rna-seq heatmap • 2.3k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode
ADD REPLY

Login before adding your answer.

Traffic: 2070 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