跟着Nature Communications学作图:R语言UpSetR画图展示不同组数据之间的交集
2023-02-19 12:27:40 时间
论文
A highly conserved core bacterial microbiota with nitrogen-fixation capacity inhabits the xylem sap in maize plants
https://www.nature.com/articles/s41467-022-31113-w
本地pdf s41467-022-31113-w.pdf
数据代码链接
https://github.com/PlantNutrition/Liyu
今天的推文我们重复一下论文中的Figure2c
image.png
首先是输入数据的格式
image.png
第一列是所有的基因名,读取数据后要将其转换成行名
后面每一列是数据分组,如果这个基因存在于这一组,就标识为1,如果不存在就标识为0
读取示例数据
library(tidyverse)
library(readxl)
dat01<-read_excel("data/20220618/example_upsetR.xlsx") %>%
column_to_rownames("gene_name")
dat01
作图代码
library(UpSetR)
upset(dat01)
image.png
如果要突出强调某一组
queries = list(list(query = intersects,
params = list("group01","group03"),
active = T,
color="#d66a35",
query.name = "ABC"))
upset(dat01,
queries = queries)
image.png
接下来是论文中提供的数据和代码
otu_RA <- read.delim('example_data/09-venndiagram/otu_RA.txt', header = TRUE, row.names = 1, sep = '\t')
head(otu_RA)
otu_RA[otu_RA > 0] <- 1
head(otu_RA)
他这里把otu表格里有数值的就变成1,只要有数值就说明这个样本中有这个otu
list(list(query=intersects,
params=list("RS","BS"),
active=T,
color="red"),
list(query=intersects,
params=list("RS","BS","RE"),
active=T,
color="blue")) -> queries
upset(otu_RA,
nset = 7,
nintersects = 10,
order.by = c('degree','freq'),
decreasing = c(FALSE, TRUE),
mb.ratio = c(0.5, 0.5),
point.size = 1.8,
line.size = 1,
mainbar.y.label = "Intersection size",
sets.x.label = "Set Size",
main.bar.color = "#2a83a2",
sets.bar.color = "#3b7960",
queries = queries)
image.png
示例数据和代码可以到论文中去下载
相关文章
- 【论文笔记】Automating DBSCAN via Deep Reinforcement Learning
- 强大的文件数据恢复工具,误删、误格式化、丢失,都能找回!
- 使用 pandas 对数据进行移动计算
- 新增MySQL to ClickHouse,Squids DBMotion再添利器
- 精准定位数据差异行,DBMotion 数据库迁移工具再添新功能
- Linux系统(X64)安装Oracle11g完整安装图文教程另附基本操作
- oracle定时器定时清理某张表指定日期前的数据
- linux下重启oracle服务:监听器和实例
- Linux下oracle启动/关闭监听(bash:lsnrctl:command not found)
- 大数据NiFi(二):NiFi架构
- 美国消费者金融保护局将推出数据共享法规推动开放金融发展
- 数据仓库与商业智能宝典第2版
- 分布式sql引擎原理分析-逻辑执行计划生成
- 金融业务的数据存储选型
- 我坦白→低代码功能我有,SQL练习题、数据可视化、数据填充助你高效
- 【地铁上的Redis与C#】关于NoSQL
- Postgresql源码(96)操作符的语法解析细节
- Laravel 记录SQL日志
- MongoDB:基础概述
- 六个强大的PHP/MYSQL代码生成器介绍