I can't figure out to make a condition_colors for ColSideColors with Heatmap.2 in RStudio.
I have a matrix in csv file with 49 genes as rows and 11 samples, I want to group the genes by biological process. The first 8 genes I want one color, the next 10 genes another, an so forth like below.
# Set column side colors
condition_colors <- unlist(lapply(row.names(Data),function(x){
if(grepl([1:8,],x)) '#FF0000'
else if(grepl([9:19,]),x)) '#FF7F7F'
else if(grepl([20:27,],x)) '#0000FF'
else if (grepl([28:49,],x)) '#8080FF'
}))
This does not work, how does one continue?
Thank you very much, it worked! I am new to R/RStudio and will take all of your comments into consideration.