实用干货 | 轻松绘制Circos图——环形热图-产品资讯-资讯-生物在线

实用干货 | 轻松绘制Circos图——环形热图

作者:上海阿趣生物科技有限公司 2021-11-25T11:05 (访问量:4696)

Arial, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 1.5px; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(241, 244, 245); text-decoration-style: initial; text-decoration-color: initial;">##代码3

col_fun1 = colorRamp2(c(-2, 0, 2), c("#26B9CB", "#FFFFFF", "#B72865"))##设置热图颜色

column_od = hclust(dist(t(mat1)))$order #对列聚类

circos.par(gap.after = c(10))##为添加列名留出空间

circos.heatmap(mat1[, column_od], ##将列聚类后重新排序的矩阵

col = col_fun1, ##设置颜色

dend.side = "inside",##树状图在圈内

rownames.side = "outside",##行名在圈外

dend.track.height = 0.2,

dend.callback = function(dend, m, si) {

# when k = 1, it renders one same color for the whole dendrogram

color_branches(dend, k = 4, col = 2:5)##对树状图进行着色

}

)

circos.track(track.index = 2, ##将列名添加在第二个轨道(就是热图所在的环形轨道)

panel.fun = function(x, y) {

if(CELL_META$sector.numeric.index == 1) { # the last sector

cn = colnames(mat1[, column_od])##取得列名

n = length(cn)

circos.text(rep(CELL_META$cell.xlim[2], n) + convert_x(1, "mm"), ##x轴坐标

1:n - convert_y(0.5, "mm"), ##y轴坐标

cn, ##输入要展示的列名

cex = 0.25, ##列名的大小

adj = c(0, 0.5),

facing = "inside")

}

}, bg.border = NA)


circos.clear()

```


图2


2> 修改文字的大小(rownames.cex)。字体(rownames.font)和颜色(rownames.col),使用代码4,结果见图3。


```

##代码4

col_fun1 = colorRamp2(c(-2, 0, 2), c("#26B9CB", "#FFFFFF", "#B72865"))##设置热图颜色

column_od = hclust(dist(t(mat1)))$order #对列聚类

circos.par(gap.after = c(15))##为添加列名留出空间

circos.heatmap(mat1[, column_od], ##将列聚类后重新排序的矩阵

col = col_fun1, ##设置颜色

dend.side = "inside",##树状图在圈内

rownames.side = "outside",##行名在圈外

rownames.col = 1:nrow(mat1) %% 10 + 1,##行名添加颜色

rownames.cex = runif(nrow(mat1), min = 0.3, max = 2),##行名的大小

rownames.font = 1:nrow(mat1) %% 4 + 1,##行名字体

dend.track.height = 0.2,

dend.callback = function(dend, m, si) {

# when k = 1, it renders one same color for the whole dendrogram

color_branches(dend, k = 4, col = 2:5)##对树状图进行着色

}

)

circos.track(track.index = 2, ##将列名添加在第二个轨道(就是热图所在的环形轨道)

panel.fun = function(x, y) {

if(CELL_META$sector.numeric.index == 1) { # the last sector

cn = colnames(mat1[, column_od])##取得列名

n = length(cn)

circos.text(rep(CELL_META$cell.xlim[2], n) + convert_x(1, "mm"), ##x轴坐标

1:n - convert_y(0.5, "mm"), ##y轴坐标

cn, ##输入要展示的列名

cex = 0.25, ##列名的大小

adj = c(0, 0.5),

facing = "inside")

}

}, bg.border = NA)

circos.clear()

```


图3


参考文献

[1] Gu, Z. (2014) circlize implements and enhances circular visualization in R. Bioinformatics. DOI: 10.1093/b

地 址: 嘉定区新培路51号焦点梦想园5层

联系人: 高小姐

电 话: 400-664-9912

传 真:

Email:marketing@biotree.cn

相关咨询
ADVERTISEMENT