课前准备----nicheDE与nicheLR

2024-08-12 23:03:47 浏览数 (2)

作者,Evil Genius

马上要上第25课了,终于看到课程要结束的曙光了。不得不说,这一轮课程下来真的有点累, 。

生态位差异表达(niche-DE)分析,该方法可以识别特定细胞类型在特定空间生态位中的特定细胞类型的生态位相关基因。niche-LR,一种揭示基于生态位差异基因表达模式的配体-受体信号机制的方法。Niche-DE和Niche-LR适用于低分辨率的基于点的空间转录组学数据和分辨率为单细胞或亚细胞的数据。

具体的生物学运用我们课上解析

安装

代码语言:javascript复制
Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS="true")
install.packages("devtools")
options(timeout=9999999)
devtools::install_github("Kmason23/NicheDE") # install
library(nicheDE)

数据格式

rds转Niche-DE

代码语言:javascript复制
#read in seurat object
data('liver_met_seurat_object')
#download average expression profile matrix 
data("vignette_library_matrix")
data("vignette_deconv_mat")
#make niche-DE object
NDE_obj = CreateNicheDEObjectFromSeurat(liver_met_seurat_object,'Spatial',
vignette_library_matrix,vignette_deconv_mat,sigma = c(1,100,250))

矩阵转Niche-DE

代码语言:javascript复制
#load counts matrix
data("vignette_counts")
#load coordinate matrix
data("vignette_coord")
#load expression profile matrix
data("vignette_library_matrix")
#load deconvolution matrix
data("vignette_deconv_mat")
#make Niche-DE object
NDE_obj = CreateNicheDEObject(vignette_counts,vignette_coord,
                              vignette_library_matrix,vignette_deconv_mat,
                              sigma = c(1,100,250))

计算和划分Niche(Calculation of the Effective Niche)

代码语言:javascript复制
NDE_obj = CalculateEffectiveNiche(NDE_obj)  

Large Scale Data

代码语言:javascript复制
NDE_obj = CalculateEffectiveNicheLargeScale(NDE_obj,batch_size = 1000, cutoff = 0.05)  

Niche-DE分析

代码语言:javascript复制
#Perform Niche-DE
NDE_obj = niche_DE(NDE_obj,num_cores = 4,outfile = "",C = 150, M = 10, gamma = 0.8,print = T, Int = T, batch = T,self_EN = F,G = 1)

获取niche-DE的基因

代码语言:javascript复制
DE_genes = get_niche_DE_genes(NDE_obj,'I',index='stromal',niche = 'tumor_epithelial',positive = T,alpha = 0.05)
head(DE_genes)

niche-DE基因的通路富集

代码语言:javascript复制
#Load enichr package
library(enrichR)
#get fibroblast tumor niche genes
fibro_tum_pos = get_niche_DE_genes(NDE_obj,'I',index='stromal',niche = 'tumor_epithelial',positive = T,alpha = 0.05)
#run pathway enrichment analysis
fibro_tum_processes = enrichr(fibro_tum_pos[,1],databases = 'Reactome_2016')
#View processes in a table
View(fibro_tum_processes$Reactome_2016) 

Marker Genes

代码语言:javascript复制
#get marker genes
fibro_tum_markers = niche_DE_markers(NDE_obj,index = 'stromal',niche1='tumor_epithelial',niche2='B_plasma',0.05)
#preview output
head(fibro_tum_markers)

最后,配受体分析

代码语言:javascript复制
data("niche_net_ligand_target_matrix")
data("ramilowski_ligand_receptor_list")
fibro_tumor_LR = niche_LR_spot(NDE_obj,ligand_cell = 'tumor_epithelial',receptor_cell = 'stromal',
ligand_target_matrix = niche_net_ligand_target_matrix,
lr_mat = ramilowski_ligand_receptor_list,K = 25,M = 50,alpha = 0.05,truncation_value = 3)
#preview output
head(fibro_tumor_LR)

The output should resemble a 3 column table of ligands,their corresponding receptors, and a list of the top 5 downstream niche-DE genes that drive the ligand potential scoring.

代码示例在https://kmason23.github.io/NicheDE/,供大家研究

NicheDE

生活很好,有你更好

0 人点赞