前面我們發(fā)布了關(guān)于cellchat的函數(shù)(連夜更新---別說兩組了,這個cellchat多組比較氣泡圖函數(shù)10組也能做了)。因為cellchat比較好入手破加,所以先開刀纱意。很多小伙伴說有沒有cpdb的狡刘,其實在寫函數(shù)之初,我們就考慮到了飒箭,只不過先從cellchat好入手安皱,本來以為套用可能大差不差调鬓,結(jié)果cpdb在數(shù)據(jù)上有很大出入,所以這次費了點時間酌伊。However,最終效果剛剛的缀踪!
參考:函數(shù)B站解說視頻(一定要看使用方法哦>幼):https://www.bilibili.com/video/BV1EreueiE7Q/?spm_id_from=333.999.0.0&vd_source=05b5479545ba945a8f5d7b2e7160ea34
函數(shù)主體:也是支持多組,支持自選受配體驴娃,自選pathway奏候,自定義分類!
看看演示:load data
library(ggplot2)
library(tidyr)
#load data
GO_pvals <- read.delim("./GO_cpdb/statistical_analysis_pvalues_08_15_2024_132104.txt", check.names = FALSE)
GO_means <- read.delim("./GO_cpdb/statistical_analysis_means_08_15_2024_132104.txt", check.names = FALSE)
WT_pvals <- read.delim("./WT_cpdb/statistical_analysis_pvalues_08_15_2024_132617.txt", check.names = FALSE)
WT_means <- read.delim("./WT_cpdb/statistical_analysis_means_08_15_2024_132617.txt", check.names = FALSE)
data = list(list(pval=GO_pvals, means=GO_means),
list(pval=WT_pvals, means=WT_means))
測試1:選定通路
#測試1:cpdb_anno沒有pathway唇敞,用cpdb默認的蔗草,用通路選擇
cpdb_interLR <- read.csv(file="cpdb_interLR",header = T)
#選定pathway,注釋文件中沒有pathway
ks_cpdb_Group_bubble(cpdb_data = data,
group_names = c("GO","WT"),
analysis_cells = "Endothelial",
pathway = c("Signaling by Transforming growth factor","Signaling by Semaphorin"),
cpdb_anno = cpdb_interLR,
tag_pos = c(0.5,0.12),
sig = F)
#隨機換種celltype試試
ks_cpdb_Group_bubble(cpdb_data = data,
group_names = c("GO","WT"),
analysis_cells = "Macrophages",
pathway = c("Adhesion by Laminin","Signaling by Integrin"),
cpdb_anno = cpdb_interLR,
tag_pos = c(0.4,0.2),
sig = F)
#只顯示顯著的疆柔,sig=T
ks_cpdb_Group_bubble(cpdb_data = data,
group_names = c("GO","WT"),
analysis_cells = "Endothelial",
pathway = c("Signaling by Transforming growth factor","Signaling by Semaphorin"),
cpdb_anno = cpdb_interLR,
tag_pos = c(0.5,0.12),
sig = T)
測試2:自選受配體咒精,自定義分類!
#測試2
#自選受配體對旷档,注釋文件帶pathway注釋
cpdb_interLR_anno <- read.csv(file = 'cpdb_interLR_anno.csv', header = T, row.names = 1)
select_LR <- read.csv('plot_pairs.csv', header = F)
ks_cpdb_Group_bubble(cpdb_data = data,
group_names = c("GO","WT"),
analysis_cells = "Endothelial",
select_LR = select_LR$V1,
cpdb_anno = cpdb_interLR_anno,
tag_pos = c(0.4,0.2),
sig = F)
沒毛病模叙,非常完美!希望對你有所幫助鞋屈!