• venn图取交集


    #交集
    
    my_disease_markers_for_AM3=openxlsx::read.xlsx("G:/silicosis/sicosis/Supplementary Table.xlsx",
                                                sheet = "Sheet1")
    head(my_disease_markers_for_AM3)
    
    library(dplyr)
    disease_markers_for_AM3=list()
    for (eachcolumn in colnames(my_disease_markers_for_AM3)) {
      disease_markers_for_AM3[[paste0(eachcolumn)]]=my_disease_markers_for_AM3[,eachcolumn] %>%
                                       na.omit() %>% unique()
      
    }
    head(disease_markers_for_AM3)
    library(VennDiagram)#https://www.jianshu.com/p/b5a4c40c3a33
    venn_list <- list(AM3_Silicosis = disease_markers_for_AM3[[1]],
                      MoAM_GSE184854 = disease_markers_for_AM3[[2]])
    
    venn.diagram(venn_list, filename = 'venn2_for_humanPF-Silicosi-Bleomycin.png', imagetype = 'png', 
                 fill = c('red', 'blue'), alpha = 0.50, cat.col = rep('black', 2), 
                 col = 'black', cex = 1.3, fontfamily = 'serif', 
                 cat.cex = 1.3, cat.fontfamily = 'serif')
    
    getwd()
    #继续以上述4个分组为例,组间交集元素获得
    inter <- get.venn.partitions(venn_list)
    for (i in 1:nrow(inter)) inter[i,'values'] <- paste(inter[[i,'..values..']], collapse = ', ')
    write.table(inter[-c(5, 6)], 'venn4_inter.txt', row.names = FALSE, sep = '\t', quote = FALSE)
    
    
    for (i in 1:nrow(inter)) inter[i,'values'] <- paste(inter[[i,'..values..']], collapse = ', ')
    openxlsx::write.xlsx(inter[-c(5, 6)], 'venn4_inter.xlsx', row.names = FALSE, sep = ',', quote = FALSE)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
  • 相关阅读:
    gitlab自动定时备份文件,备份失败发送邮件
    iview项目中,radio选中值回显问题
    Java--简介
    音视频 HLS协议和m3u8格式分析
    uniapp-父向子组件传值失效解决方案
    Ceph Crush-Map与Ceph调优及其日常管理
    spring 理解
    泡沫褪去,DeFi还剩下什么
    LeetCode 460. LFU 缓存
    matlab解方程组解析解
  • 原文地址:https://blog.csdn.net/qq_52813185/article/details/125556398