细胞与细胞之间的通讯其实是一个很深的课题,今天我们来分享一下一个新的10X空间转录组细胞通讯的一个方法,分享代码的同时,我们要深入了解其原理和算法。这里再强调一遍,不要拿着代码随便套用,根据自己的实际情况来设计分析的思路和方法。
第一步,导入模块,我们以参考数据为例,
import squidpy as sq
adata = sq.datasets.seqfish()
第一步,我们需要注意的是,参考数据是进行过注释的,这里也要强调,不做注释,分析的结果都是在耍流氓
。
AnnData object with n_obs × n_vars = 19416 × 351
obs: 'Area', 'celltype_mapped_refined'
uns: 'celltype_mapped_refined_colors'
obsm: 'X_umap', 'spatial'
第二步:To get started, we just need an [anndata.AnnData
] object with some clustering information. Below are some useful parameters of [squidpy.gr.ligrec()
]:
这里我们认真参考一下这个函数的参数:
help(sq.gr.ligrec)
* `n_perms` - number of permutations for the permutation test.
* `interactions` - list of interaction, by default we fetch all available interactions from [[Türei *et al.*, 2016].
* `{interactions,transmitter,receiver}_params` - parameters used if downloading the `interactions`, see `omnipah.interactions.import_intercell_network()` for more information.
* `threshold` - percentage of cells required to be expressed in a given cluster.
* `corr_method` - false discovery rate (FDR) correction method to use.
做过cellphoneDB的同学们,应该很了解这些参数的意思了。
第三步,进行通讯分析
res = sq.gr.ligrec(
adata,
n_perms=1000,
cluster_key="celltype_mapped_refined",
copy=True,
use_raw=False,
transmitter_params={"categories": "ligand"},
receiver_params={"categories": "receptor"},
)
得到的res其实也是一个对象:
包括means、pvalues、metadata。
可视化
sq.pl.ligrec(res, source_groups="Erythroid", alpha=0.005)

最后总结一下,对这个方法表示鄙视
生活很好,有你更好
网友评论