课前准备----nicheDE与nicheLR

作者,Evil Genius

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

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

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

安装

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

#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

#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)

NDE_obj = CalculateEffectiveNiche(NDE_obj)  

Large Scale Data

NDE_obj = CalculateEffectiveNicheLargeScale(NDE_obj,batch_size = 1000, cutoff = 0.05)  

Niche-DE分析

#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的基因

DE_genes = get_niche_DE_genes(NDE_obj,'I',index='stromal',niche = 'tumor_epithelial',positive = T,alpha = 0.05)
head(DE_genes)

niche-DE基因的通路富集

#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

#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)

最后,配受体分析

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

生活很好,有你更好

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值