f_cpdb_select_pathway <- function(lc_res, grep_i_p_list=NULL){
if(is.null(grep_i_p_list)){
grep_i_p_list = list(
chemokines = "^CXC|CCL|CCR|CX3|XCL|XCR",
th1 = "IL2|IL12|IL18|IL27|IFNG|IL10|TNF$|TNF |LTA|LTB|STAT1|CCR5|CXCR3|IL12RB1|IFNGR1|TBX21|STAT4",
th2 = "IL4|IL5|IL25|IL10|IL13|AREG|STAT6|GATA3|IL4R",
th17 = "IL21|IL22|IL24|IL26|IL17A|IL17A|IL17F|IL17RA|IL10|RORC|RORA|STAT3|CCR4|CCR6|IL23RA|TGFB",
treg = "IL35|IL10|FOXP3|IL2RA|TGFB",
costimulatory = "CD86|CD80|CD48|LILRB2|LILRB4|TNF|CD2|ICAM|SLAM|LT[AB]|NECTIN2|CD40|CD70|CD27|CD28|CD58|TSLP|PVR|CD44|CD55|CD[1-9]",
coinhibitory = "SIRP|CD47|ICOS|TIGIT|CTLA4|PDCD1|CD274|LAG3|HAVCR|VSIR",
niche = "CSF"
)
}
lc_res$grep_i_p_list = list()
for(name in names(grep_i_p_list)){
lc_res$grep_i_p_list[[name]] = unique(grep(grep_i_p_list[[name]], lc_res$s_m_p$interacting_pair,value = T))
}
lc_res
}
f_cpdb_select_cluster <- function(lc_res, grep_celltype){
lc_res$grep_celltype <- unique(grep(grep_celltype, lc_res$s_m_p$celltype, value = T))
lc_res
}
f_cpdb <- function(lc_res){
res <- lc_res$s_m_p
if(!is.null(lc_res$grep_i_p_list)){
res <- res %>% dplyr::filter(interacting_pair %in% reduce(lc_res$grep_i_p_list, c))
}
if(!is.null(lc_res$grep_celltype)){
res <- res %>% dplyr::filter(celltype %in% lc_res$grep_celltype)
}
res
}
示例
sce <- f_readcellphoneDB('crpc_strom_epi_new')
sce <- f_cpdb_select_cluster(sce, 'iCAF')
grep_i_p_list = list(
vegf = "VEGF|FGF|IGF"
)
sce <- f_cpdb_select_pathway(sce, grep_i_p_list)
f_cDB_dotplot(f_cpdb(sce))
Comments NOTHING