Reputation: 2690
I have a file with genomic data for which I am trying to create a heatmap of the data together with a sidebar for the chromosome information. To make the heatmap I converted the numerical values from my file to create a a data matrix that I was then able to plot:
Heatmap <- heatmap.2(DataMatrix, trace="none", col=greenred, key=T, keysize=1.5, labRow=NA, density.info="none", Colv=FALSE)
However, I would like to add an additional color side bar to indicate the chromosome location of the said data. In particular I would like to have just two colors, say "black" if it's from "chrX" or "yellow" from any other chromosome. The column with this information is not in my data matrix and I'm not sure how to include this info into my heatmap. Any help would be greatly appreciated!
Upvotes: 0
Views: 7998
Reputation: 7263
The heatmap.2
function has a RowSideColors
argument for this purpose, as you might infer from the documentation:
RowSideColors: (optional) character vector of length 'nrow(x)' containing the color names for a vertical side bar that may be used to annotate the rows of 'x'.
I've also recently discovered the aheatmap
function in the NMF package, which makes nice heatmaps with an arbitrary number of annotation rows/columns on your heatmap. Included on that homepage you'll find several links to heatmap examples.
Upvotes: 5