关联集群到热图
Association Clusters to Heatmap
我有两个单独的数据框,其中一个我已经从第一个数据框创建了一个热图,但是我想添加一个侧边栏来指示基因实际与之关联的家族类型。
数据框 1
BGC1 BGC2 Distance
-----------------------------------------------
BGC31 BGC34 0.6
BGC34 BGC45 0.7
BGC34 BGC53 0.2
BGC53 BGC31 0.8
Dataframe2
BGC1 Association
----------------------------------
BGC31 Skin Cancer
BGC34 Skin Cancer
BGC34 Lung Cancer
BGC53 Liver Cancer
热图创建:
p3 <- heatmap.3(comat, scale = "none", trace = "none", col = color, main="GCF Co-Occurrence Map"
,lhei=c(0.5,1), keysize=0.5, cexRow = 0.60, cexCol = 0.65)
我想创建这样的东西,其中每种颜色代表一种与特定基因相关的基因簇 class:
查看heatmaply手册中的"Adding annotation based on additional factors using RowSideColors"部分:
x <- as.matrix(datasets::mtcars)
rc <- colorspace::rainbow_hcl(nrow(x))
heatmaply(
x[, -c(8, 9)],
seriate = "mean",
col_side_colors = c(rep(0, 5), rep(1, 4)),
row_side_colors = x[, 8:9]
)
结果:
我有两个单独的数据框,其中一个我已经从第一个数据框创建了一个热图,但是我想添加一个侧边栏来指示基因实际与之关联的家族类型。
数据框 1
BGC1 BGC2 Distance
-----------------------------------------------
BGC31 BGC34 0.6
BGC34 BGC45 0.7
BGC34 BGC53 0.2
BGC53 BGC31 0.8
Dataframe2
BGC1 Association
----------------------------------
BGC31 Skin Cancer
BGC34 Skin Cancer
BGC34 Lung Cancer
BGC53 Liver Cancer
热图创建:
p3 <- heatmap.3(comat, scale = "none", trace = "none", col = color, main="GCF Co-Occurrence Map"
,lhei=c(0.5,1), keysize=0.5, cexRow = 0.60, cexCol = 0.65)
我想创建这样的东西,其中每种颜色代表一种与特定基因相关的基因簇 class:
查看heatmaply手册中的"Adding annotation based on additional factors using RowSideColors"部分:
x <- as.matrix(datasets::mtcars)
rc <- colorspace::rainbow_hcl(nrow(x))
heatmaply(
x[, -c(8, 9)],
seriate = "mean",
col_side_colors = c(rep(0, 5), rep(1, 4)),
row_side_colors = x[, 8:9]
)
结果: