0

I am doing a heatmap in R. I have several annotations in the Exam$Design and I would like to change the colors of the annotation 'condition' because as you can see from the plot they look very similar but in fact are not (as seen in the legent there are 2 variables in the 'condition' column).

This is the code i am using:

pheatmap::pheatmap(
    mat=yeast_EM, 
    kmeans_k=100, 
    annotation_col=Exam$Design, 
    scale = "row", 
    cellwidth = 15, 
    cellheight = 12, 
    fontsize = 8, 
    color = brewer.pal(name = "Spectral", n = 10), 
    filename = "heat_map.png")

And the output is the following:

heat_map

I am using: R version 3.3.2 (2016-10-31) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: macOS Sierra 10.12.6

This is an example of the yeast_EM data:

   sample1      sample2   sample3     sample4     sample5

gene1 6.36905642 6.73133314 6.31220164 5.96876520 6.41847351

gene2 7.88187347 7.80500924 9.04985474 5.26179387 6.46439153

gene3 -0.93509624 1.08347695 4.03031906 3.34657410 -2.67209858

And this is how the Exam$Design dataframe looks like:

  strain condition batch replicate  technician  time  week

sample1 wt exp A biological1 BSc morning workday

sample2 wt stress A biological2 Tech afternoon weekend

sample3 mut exp A biological3 BSc afternoon workday

sample4 mut stress A biological4 BSc afternoon workday

can anyone help?

  • 1
    It's difficult to provide a specific answer without a [minimal reproducible example including sample data](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). You can change annotation track colours using `annotation_colors`, see `?pheatmap` for some examples. – Maurits Evers Nov 02 '17 at 22:41
  • I added some data. I already tried annotation_colors but the point is that it is dependent on the annotation_col variable and what i want is to use all the columns of Exam$Design in annotation_col but color only 'condition' manually(?) or maybe just set for all of them a different palette – Carlotta Porcelli Nov 03 '17 at 23:40

0 Answers0