Error in changing the annotation color of pheatmap
1
0
Entering edit mode
6 weeks ago
applepie • 0

Hi recently i tried to use the R package pheatmap to make a heat map that shows the gene enrichment in TCGA-bulk RNA seq data. I tried to amend the color of the annotation with the following code:

ann_colors = list('group.risk' = c("firebrick2","green2"),
                  'BRCA_subtype' = c("#FFC0CB", "#00CED1", "#FFA07A", "#6A5ACD", "#90EE90", "#FF1493"),
                  'disease_stage' = c("#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#9467BD", "#8C564B"),
                  'Fraction_Genome_Altered' = c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00"),
                  'Cancer Type Detailed' = c("#FF0000", "#00FF00", "#0000FF", "#FFA500", "#800080", "#FFFF00", "#00FFFF"))

pheatmap(es.max %>% t() %>% as.matrix(), 
         annotation_col  = annotation_col,
         clustering_distance_cols = "euclidean",
         cluster_cols = TRUE,
         fontsize_row = 20,
         fontsize_col = 0.0001,
         annotation_names_col  = T,
        annotation_colors = ann_colors)

BUT it results in the following error:

Error in convert_annotations(annotation_col, annotation_colors) : 
  Factor levels on variable group.risk do not match with annotation_colors

what happen is that i have already double checked that group.risk has only two factors (i.e. high risk and low risk, just like what i show in the attached heatmap)

R package pheatmap • 265 views
ADD COMMENT
0
Entering edit mode
6 weeks ago
fracarb8 ★ 1.6k

You need to specify which colour is which, as the factors and the colour names need to match.

ann_colors = list('group.risk' = c(High = "firebrick2", Low = "green2"), ....)
ADD COMMENT

Login before adding your answer.

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