This question was also asked on github
I'm trying to run the function HeatmapAnnotation (a function in the ComplexHeatmap package). When I run it, I get the error "Error in col2rgb(colors, alpha = TRUE) : invalid RGB specification"
col2rgb() is not among the libraries I've loaded and it doesn't seem to be a method contained in HeatmapAnnotation.
Here's the code block for the section:
df <- data.frame(labid= combmetadata$Sample_Name,
Diagnosis= combmetadata$Diagnosis,
Tissue = combmetadata$Tissue,
Tumor.Normal = combmetadata$T.N,
study = combmetadata$batch)
labid <- colnames(bValsselect)
df <- left_join(as.data.frame(labid),df,by="labid")
df <- df[,c(2,4,5)]
df$study[df$study == "1" | df$study == "2"] <- "cgid"
df$Diagnosis <- factor(df$Diagnosis, levels = c("Uterine endometrial","Ovarian endometrioid",
"Ovarian mucinous",
"Colorectal mucinous",
"Pancreas mucinous",
"Stomach mucinous"))
ha_column = HeatmapAnnotation(df = df,
col = list(Diagnosis = c("Uterine endometrial" = "#DDCC77F",
"Ovarian endometrioid" = "#0F7554",
"Ovarian mucinous" = "#44AA99",
"Colorectal mucinous" = "#882255",
"Pancreas mucinous" = "#AA4499",
"Stomach mucinous" = "#D695D0"),
Tumor.Normal = c("N" = "grey",
"T" = "black"),
study = c("cgid" = "#332288",
"tcga" = "#BD9AF7")))
hegt <- Heatmap(bValsselect,
column_split=4,
name = "Beta Value",
col = colorRamp2(c(0,0.25,0.5),c("#00FFCC","#FFFFFF","#0099FF")),
show_row_names = FALSE,
top_annotation = ha_column,
show_row_dend = F)
The code runs fine up until it reaches the end of the HeatmapAnnotation() call
I've tried to load col2rgb() and override the alpha setting. Can anyone give me a clue about what's happening and any suggestions on how to correct the problem? I'm running R 4.2. Thanks