0

I need to make a heatmap for RNA expression in different types of cancer. I would like to do it with circlize, and divide my circle in 5 parts (each part is one type of cancer).

I couldn't figure out how to input the data and make the circle divided accordingly.

Is there a way to connect the heatmaps made with Complexheatmap and turn them into circles? For instance, I created my heatmaps like this:

mat <- read.csv("C:/Users/xxxxxxxxx", header=TRUE) #bring csv file
rownames(mat) <- mat [, 1] #First row is label (Genes names)
mat1 <- mat[,colnames(mat)!="Genes"] #delete the Genes names column because it was appearing as part of heatmap
mat2 <- data.matrix(mat1) # transform dataframe to matrix

Heatmap(mat2) #make the heatmap from mat Complexheat map package
col_fun = colorRamp2(c(-20, 0, 20), c("green", "white", "red")) #set the colors and grading
col_fun (seq(-5, 5))

Heatmap(mat2, name = "mat2", 
row_order = order(as.numeric(gsub("row", "", rownames(mat2)))), 
column_order = order(as.numeric(gsub("column", "", colnames(mat2)))),
column_title = "Head and Neck", col = col_fun) #new heatmap with colors and grading, and organized by order of genes

#MAKE A LIST OF HEATMAPS TOGETHER
ht1 = Heatmap(data2, name = "data2", 
row_order = order(as.numeric(gsub("row", "", rownames(data2)))), 
column_order = order(as.numeric(gsub("column", "", colnames(data2)))),
column_title = "Soft Tissue", col = col_fun)

ht2 = Heatmap(mat2, name = "mat2", 
row_order = order(as.numeric(gsub("row", "", rownames(mat2)))), 
column_order = order(as.numeric(gsub("column", "", colnames(mat2)))),
column_title = "Head and Neck", col = col_fun)

ht3 = Heatmap(ov2, name = "ov2", 
row_order = order(as.numeric(gsub("row", "", rownames(ov2)))), 
column_order = order(as.numeric(gsub("column", "", colnames(ov2)))),
column_title = "Ovary/Fallopian tube", col = col_fun)

ht4 = Heatmap(br3, name = "br3", 
row_order = order(as.numeric(gsub("row", "", rownames(br3)))), 
column_order = order(as.numeric(gsub("column", "", colnames(br3)))),
column_title = "Breast", col = col_fun)

ht5 =  Heatmap(ot2, name = "ot2", 
row_order = order(as.numeric(gsub("row", "", rownames(ot2)))), 
column_order = order(as.numeric(gsub("column", "", colnames(ot2)))),
column_title = "Other", col = col_fun)

ht_list = ht1 + ht2 + ht3 + ht4 + ht5 #put all together
draw(ht_list, ht_gap = unit(1, "cm")) #adjust the separation size between each heatmap

With this code I could generate the plain form of the heatmap, separated by each cancer type. Is it possible to now turn this heatmap into a circle, keeping the divison?

I tried to use the tutorial made by Zuguang Gu. But since I am still learning R, I am already stuck in the beginning since he makes the tutorial from an automatically generated matrix, and everything develops from it, so I can't figure out how to make the split in a matrix that is inputted from the data I already have.

L Tyrone
  • 1,268
  • 3
  • 15
  • 24
  • Hi Kathleen, welcome to stackoverflow. This type of question is better suited to https://community.rstudio.com/ or https://bioinformatics.stackexchange.com/, and additional resources to improve your coding ability are available, such as https://education.rstudio.com/learn/. As it stands, I'm not sure if a solution to your problem exists, sorry – jared_mamrot Apr 17 '23 at 03:42
  • If you could provide fake data that are similar to your real data, it would be helpful to provide a solution. – Emmanuel Hamel Apr 21 '23 at 22:10

0 Answers0