R Package Circlize for heatmaps,如何拆分我的数据?

问题描述 投票:0回答:0

我没有使用 R 的经验,我还在学习,但我需要为不同类型的癌症中的 RNA 表达制作热图。我想用 Circlize 来做,把我的圈子分成 5 个部分(每个部分是一种癌症)。

我不知道如何输入数据并相应地划分圆圈。

有没有办法把用Complexheatmap做的heatmap连起来变成圆形? 例如,我创建了这样的热图:

`> 
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`

使用这段代码,我可以生成热图的简单形式,按每种癌症类型分开。现在是否可以将此热图变成一个圆圈,保持分区?

如果有人可以提供帮助,我将非常感激。

谢谢, 凯瑟琳

我尝试使用谷祖光制作的教程。但是因为我还在学习 R,我已经陷入了困境,因为他从一个自动生成的矩阵制作了教程,一切都是从它发展而来的,所以我不知道如何在输入的矩阵中进行拆分根据我已有的数据。

r heatmap circlize complexheatmap
© www.soinside.com 2019 - 2024. All rights reserved.