circular_heatmap

「之前画过的热图:」

  1. 跟着 Cell 学作图 | 复杂热图(ComplexHeatmap)

  2. 跟着 Nature 学作图 | 复杂热图2.0(连续+分类变量)

  3. R实战 | 复杂热图3.0(ComplexHeatmap)

本期图片

将上一期的热图掰弯,并随机给differetially methylated regions (DMRs)加个几个相互作用。

示例数据和代码领取

点赞在看 本文,分享至朋友圈集赞20个保留30分钟,截图发至微信mzbj0002领取。

「木舟笔记2022年度VIP可免费领取」

木舟笔记2022年度VIP企划

「权益:」

  1. 「2022」年度木舟笔记所有推文示例数据及代码(「在VIP群里实时更新」)。

    data+code
  2. 木舟笔记「科研交流群」

  3. 「半价」购买跟着Cell学作图系列合集(免费教程+代码领取)|跟着Cell学作图系列合集。

「收费:」

「99¥/人」。可添加微信:mzbj0002 转账,或直接在文末打赏。

绘制

示例数据

rm(list = ls())
# devtools::install_github("jokergoo/Complexheatmap")
library(ComplexHeatmap)
library(circlize)
library(RColorBrewer)
# 载入示例数据
res_list = readRDS("meth.rds")
str(res_list)
type = res_list$type
mat_meth = res_list$mat_meth
mat_expr = res_list$mat_expr
direction = res_list$direction
cor_pvalue = res_list$cor_pvalue
gene_type = res_list$gene_type
anno_gene = res_list$anno_gene
dist = res_list$dist
anno_enhancer = res_list$anno_enhancersource("random_matrices.R")

绘制

set.seed(123)
km = kmeans(mat_meth, centers = 5)$cluster
# 一圈一圈轨迹叠加col_meth = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))
circos.heatmap(mat_meth, split = km, col = col_meth, track.height = 0.12)col_direction = c("hyper" = "red", "hypo" = "blue")
circos.heatmap(direction, col = col_direction, track.height = 0.01)col_expr = colorRamp2(c(-2, 0, 2), c("green", "white", "red"))
circos.heatmap(mat_expr, col = col_expr, track.height = 0.12)col_pvalue = colorRamp2(c(0, 2, 4), c("white", "white", "red"))
circos.heatmap(cor_pvalue, col = col_pvalue, track.height = 0.01)col_gene_type = structure(brewer.pal(length(unique(gene_type)), "Set3"), names = unique(gene_type))
circos.heatmap(gene_type, col = col_gene_type, track.height = 0.01)col_anno_gene = structure(brewer.pal(length(unique(anno_gene)), "Set1"), names = unique(anno_gene))
circos.heatmap(anno_gene, col = col_anno_gene, track.height = 0.01) col_dist = colorRamp2(c(0, 10000), c("black", "white"))
circos.heatmap(dist, col = col_dist, track.height = 0.01)col_enhancer = colorRamp2(c(0, 1), c("white", "orange"))
circos.heatmap(anno_enhancer, col = col_enhancer, track.height = 0.03)circos.clear()df_link = data.frame(from_index = sample(nrow(mat_meth), 20),to_index = sample(nrow(mat_meth), 20)
)circlize_plot = function() {circos.heatmap(mat_meth, split = km, col = col_meth, track.height = 0.12)circos.heatmap(direction, col = col_direction, track.height = 0.01)circos.heatmap(mat_expr, col = col_expr, track.height = 0.12)circos.heatmap(cor_pvalue, col = col_pvalue, track.height = 0.01)circos.heatmap(gene_type, col = col_gene_type, track.height = 0.01)circos.heatmap(anno_gene, col = col_anno_gene, track.height = 0.01) circos.heatmap(dist, col = col_dist, track.height = 0.01)circos.heatmap(anno_enhancer, col = col_enhancer, track.height = 0.03)for(i in seq_len(nrow(df_link))) {circos.heatmap.link(df_link$from_index[i],df_link$to_index[i],col = rand_color(1))}circos.clear()
}lgd_meth = Legend(title = "Methylation", col_fun = col_meth)
lgd_direction = Legend(title = "Direction", at = names(col_direction), legend_gp = gpar(fill = col_direction))
lgd_expr = Legend(title = "Expression", col_fun = col_expr)
lgd_pvalue = Legend(title = "P-value", col_fun = col_pvalue, at = c(0, 2, 4), labels = c(1, 0.01, 0.0001))
lgd_gene_type = Legend(title = "Gene type", at = names(col_gene_type), legend_gp = gpar(fill = col_gene_type))
lgd_anno_gene = Legend(title = "Gene anno", at = names(col_anno_gene), legend_gp = gpar(fill = col_anno_gene))
lgd_dist = Legend(title = "Dist to TSS", col_fun = col_dist, at = c(0, 5000, 10000), labels = c("0kb", "5kb", "10kb"))
lgd_enhancer = Legend(title = "Enhancer overlap", col_fun = col_enhancer, at = c(0, 0.25, 0.5, 0.75, 1), labels = c("0%", "25%", "50%", "75%", "100%"))
library(gridBase)
plot.new()
circle_size = unit(1, "snpc") # snpc unit gives you a square regionpushViewport(viewport(x = 0, y = 0.5, width = circle_size, height = circle_size,just = c("left", "center")))
par(omi = gridOMI(), new = TRUE)
circlize_plot()
upViewport()h = dev.size()[2]
lgd_list = packLegend(lgd_meth, lgd_direction, lgd_expr, lgd_pvalue, lgd_gene_type, lgd_anno_gene, lgd_dist, lgd_enhancer, max_height = unit(0.9*h, "inch"))
draw(lgd_list, x = circle_size, just = "left")

result

参考

  1. Supplementary S3. Correlations between methylation, expression and other genomic features (jokergoo.github.io)

  2. Chapter 6 The circos.heatmap() function | Circular Visualization in R (jokergoo.github.io)

往期

  1. CNS图表复现|生信分析|R绘图 资源分享&讨论群!

  2. 这图怎么画| 有点复杂的散点图

  3. 这图怎么画 | 相关分析棒棒糖图

  4. 组学生信| Front Immunol |基于血清蛋白质组早期诊断标志筛选的简单套路

  5. (免费教程+代码领取)|跟着Cell学作图系列合集

  6. Q&A | 如何在论文中画出漂亮的插图?

  7. 跟着 Cell 学作图 | 桑葚图(ggalluvial)

  8. R实战 | Lasso回归模型建立及变量筛选

  9. 跟着 NC 学作图 | 互作网络图进阶(蛋白+富集通路)(Cytoscape)

  10. R实战 | 给聚类加个圈圈(ggunchull)

  11. R实战 | NGS数据时间序列分析(maSigPro)

  12. 跟着 Cell 学作图 | 韦恩图(ggVennDiagram)


木舟笔记矩阵

R实战 | 环状热图(circos)相关推荐

  1. 在线作图|2分钟绘制一张环状热图

    环状热图 热图因其丰富的色彩变化和生动饱满的信息表达被广泛应用于各种大数据分析场景.在组学相关的文章中,我们常常可以看到热图(Heatmap)的展示,热图作为一种对实验数据及其结果分析的直观表达方式, ...

  2. R统计绘图 - 热图美化

    欢迎关注天下博客:http://blog.genesino.com/2017/06/heatmap-beautiful/ Jump to- 热图美化 对数转换 Z-score转换 抹去异常值 非线性颜 ...

  3. R统计绘图 - 热图简化

    欢迎关注天下博客:http://blog.genesino.com/2017/06/heatmap-simple/ Jump to- 热图绘制 - pheatmap 不改脚本的热图绘制 生信宝典,一起 ...

  4. R语言绘制热图(其实是相关系数图)实践(二)corrplot包

    目录 前言 corrplot包简介 语法和常用参数介绍 函数语法 参数介绍 实践 summary 参考资料 前言 在我的上一篇的内容中(R语言绘制热图实践(一)pheatmap包 ),我以绘制相关系数 ...

  5. R语言绘图—热图绘制

    R语言绘图-热图绘制 原创 R语言与医学生  2022-06-24 20:59 发表于广东 热图使用颜色来表示二维图中第三个变量的变化和大小.热图能清楚直观的看到数据的变化.今天就简单介绍下R语言中热 ...

  6. R语言绘制热图实践(一)pheatmap包

    目录 前言 pheatmap包 pheatmap简介 常用参数介绍 使用 安装 绘制样本间相关系数图(简单使用) 差异表达基因热图(进阶使用) 如何查看pheatmap的聚类结果 pheatmap总结 ...

  7. R语言学习 - 热图简化

    前面推出过热图绘制和热图美化,现在来一个函数绘制热图的简化方式.文后更有不用写代码的在线工具可用. R语言 - 基础概念和矩阵操作 R语言 - 热图简化 R语言 - 热图绘制 (heatmap) R语 ...

  8. R语言学习 - 热图美化 (数值标准化和调整坐标轴顺序)

    生物信息学习的正确姿势 NGS系列文章包括NGS基础.在线绘图.转录组分析 (Nature重磅综述|关于RNA-seq你想知道的全在这).ChIP-seq分析 (ChIP-seq基本分析流程).单细胞 ...

  9. R 数据可视化 : 热图

    本文作者蒋刘一琦,自嘲是一个有艺术追求的生信狗,毕业于浙江大学生物信息学专业,目前在复旦大学就读研究生,研究方向为宏基因组. 在生物信息领域我们常常使用 R 语言对数据可视化.在对数据可视化的时候,我 ...

最新文章

  1. 在线编程题之“明明的随机数”
  2. QT源码解析(一) QT创建窗口程序、消息循环和WinMain函数
  3. knn算法实现电影分类
  4. 11 Python之初识函数
  5. 孙宇晨回顾区块链历程:不走热点走心
  6. 06 sqlsybase
  7. Angular环境配置及创建新的项目
  8. android真实项目教程(二)——漫画App初构_by_CJJ
  9. MapReduce学习要点
  10. LINUX下载编译libogg
  11. paip.c++读写ini文件.
  12. Python游戏开发实战:飞机大战(含代码)
  13. xml转json的两种方法
  14. 笔记本 GTX1050ti 安装win10 Ubuntu18.04 显卡问题
  15. JavaScript实现浏览器本地的图像移动、大小调整和裁剪
  16. 【C++】模板进阶 — 模板特化
  17. 项目实训-中医药知识图谱5
  18. 斯坦福高效睡眠法Xmind图
  19. Java面试题(131-135)
  20. 浅析Go中三个点(...)用法

热门文章

  1. oracle表空间不足影响,oracle表空间不足
  2. UI设计中线面结合图标设计总结
  3. 数学建模清风微信公众号的习题答案(挑战篇-完结)
  4. web页在微信中访问增加遮罩层 右上角弹出在浏览器中打开
  5. 微信小程序 订单倒计时
  6. 城市按A-Z json表
  7. Axure RP9制作汉堡菜单
  8. PDF批量反色打印解决方案
  9. CGAL学习记录——降采样
  10. bitcoin core全节点钱包同步太慢的解决方法及钱包数据文件移动的方法