美文网首页
(视频教程-原创函数)Cellchat受配体多组比较气泡图函数

(视频教程-原创函数)Cellchat受配体多组比较气泡图函数

作者: KS科研分享与服务 | 来源:发表于2024-09-07 09:54 被阅读0次

    事情是这样的:前面我们发布了这样一款函数((原创函数)-Cellchat受配体多组比较气泡图函数)。但是限制是最多只能进行三组的比较。小伙伴也强烈要求更新多组分析。其实在第一版函数完成后,我们就考虑到了这个问题,也有这个意向,并在睡觉前冥想了一下思路,所以比较顺畅,连夜进行了函数更新!看看更新函数:此次更新不仅可以进行多组比较了,还能够自选受配体!

    image.png

    参考:
    https://mp.weixin.qq.com/s?__biz=Mzg5OTYzMzY5Ng==&mid=2247489638&idx=1&sn=385bab4715a9b46b3cc02c512a2697e8&chksm=c0511f29f726963fef01ed2a7090787a5df51bc66cff4bb1e70a0198f6dc30b8ceef2d959878&token=512044395&lang=zh_CN#rd

    效果如下:

    setwd('D:\\KS项目\\公众号文章\\Cellchat受配体多组比较气泡图函数\\更新-cellchat多组受配体可视化函数(不限组数)')
    # group_name <- c("HD","MDA")
    # analysis_cells <- "Tcell"
    # pathway=c("CCL", "MIF","MHC-II")
    #两组
    object_list1 <- list(HD.cellchat, MDA.cellchat)
    ks_ccGroup_bubble(object_list=object_list1,
                      analysis_cells = "Tcell",
                      pathway=c("CCL", "MIF","MHC-II"),
                      group_name = c("HD","MDA"),
                      tag_pos = c(0.5, 0.085))
    
    #三组-假装有三组
    object_list2 <- list(HD.cellchat, MDA.cellchat,HD.cellchat)
    ks_ccGroup_bubble(object_list=object_list2,
                      analysis_cells = "Tcell",
                      pathway=c("CCL", "MIF","MHC-II"),
                      group_name = c("HD","MDA","EE"),
                      tag_pos = c(0.5, 0.085))
    
    
    #4组-假装有4组
    object_list3 <- list(HD.cellchat, MDA.cellchat,HD.cellchat,MDA.cellchat)
    ks_ccGroup_bubble(object_list=object_list3,
                      analysis_cells = "Tcell",
                      pathway=c("CCL", "MIF","MHC-II"),
                      group_name = c("HD","MDA","EE","AA"),
                      tag_pos = c(0.5, 0.085))
    
    
    
    #选定LR
    object_list2 <- list(HD.cellchat, MDA.cellchat,HD.cellchat)
    LR <- read.csv('hh.csv', header = F)
    
    ks_ccGroup_bubble(object_list=object_list2,
                      analysis_cells = "Tcell",
                      select_LR=LR$V1,
                      group_name = c("HD","MDA","EE"),
                      tag_pos = c(0.55, 0.085))
    
    image.png

    觉得我们分享有些用的,点个赞再走呗!

    相关文章

      网友评论

          本文标题:(视频教程-原创函数)Cellchat受配体多组比较气泡图函数

          本文链接:https://www.haomeiwen.com/subject/jvwjljtx.html