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
示例数据和代码可以到论文中去下载