scanpro | 单细胞数据差异组分分析

研究结果表明,在生物过程中以及疾病进展中,不仅细胞亚群内基因表达的变化,细胞类型比例的改变也具有重要意义。为了识别不同生物条件下成分差异的簇,最近引入了差异组分分析,即比例分析。目前,已有一些方法和软件可以用来做比例分析如propeller、scDC12、dirichlet regression、sccomp、scCOD、AmiloR。

其中,propeller基于R语言编写的软件,是作为早期软件中的优秀工具之一,该方法采用线性回归方法,随后进行经验贝叶斯统计检验,以减轻样本间变异的影响。然而,这种方法的一个显著局限在于,所有研究条件都依赖于重复实验。由于单细胞实验成本高昂,重复的单细胞数据集十分罕见,因此propeller的应用受限于少数数据集。

scCODA采用贝叶斯模型,无需依赖重复样本即可估计差异性组成,通过使用适当的先验信息来应对单细胞RNA测序数据中样本数量较少的情况。在此背景下,scCODA模型利用一个参考细胞类型,来反映其他细胞类型相对于该参考类型的丰度变化。该软件通过强制参考细胞类型上的所有效应为零来实现这一目标。由于手动选择参考细胞类型可能较为困难,该工具提供了自动化的参考细胞类型选择功能。

然而,用于对有重复和无重复的单细胞数据集进行稳健比例分析的生物信息学工具仍然严重缺失。Scanpro,一款模块化比例分析工具,能够无缝集成到Python环境中广泛接受的scanpy框架中。其实现并扩展了propeller提出的线性回归方法,对于无重复数据,通过bootstrapping方法来生成模拟的重复样本 (伪重复样本)。Scanpro速度快、准确,并支持无重复数据集,方便生物信息学专家和初学者使用。

from scanpro.scanpro import scanpro

scanpro(data, clusters_col, conds_col, samples_col=None, covariates=None, conditions=None, transform='logit', robust=True, n_sims=100, n_reps='auto', run_partial_sim=True, pairwise=False, verbosity=1, seed=1)
    data: anndata.AnnData or pandas.DataFrame, Single cell data with columns containing sample, condition and cluster/celltype information.
    clusters_col: Name of column in date or data.obs where cluster/celltype information are stored.
    conds_col: Column in data or data.obs where condition information are stored.
    samples_col: Column in data or data.obs where sample information are stored, if None, dataset is assumed to be not replicated and conds_col will be set as samples_col, defaults to None.
    covariates: list List of covariates to include in the model, defaults to None.
    transform: Method of transformation of proportions, defaults to 'logit'.
    conditions: List of condtitions of interest to compare, defaults to None.
    robust: Robust ebayes estimation to mitigate the effect of outliers, defaults to True.
    n_sims: Number of simulations to perform if data does not have replicates, defaults to 100.
    n_reps: Number of replicates to simulate if data does not have replicates, 'auto' will generate pseudo-replicates for each sample based on its cell count, (3 for cells<5000, 5 for cells<14000 and 8 for cells>14000), defaults to 'auto'.
    run_partial_sim: the bootstrapping method will be also performed on datasets that are partially replicated (where some samples have replicates).
    pairwise: all pairwise comparisons between conditions will be performed, defaults to False.
    verbosity: Verbosity level for logging progress. 0=silent, 1=info, 2=debug. Defaults to 1.
    seed: Seed for random number generator, defaults to 1.

Scanpro supports two possible transformation methods:
(a) logit transformation log(proportions/(1 − proportions))
(b) arcsin square root transformation arcsin(sqrt(proportions)).
According to the developers of propeller, the arcsin transformation works better for higher numbers of replicates or when there are outliers in the data.

不同条件有重复样本时:

adata = sc.read_h5ad('scanpro_tutorial.h5ad')
out = scanpro(adata, clusters_col='cluster', samples_col='sample', conds_col='group')
out.results
          baseline_props  mean_props_cond_1  mean_props_cond_2  mean_props_cond_3  f_statistics  p_values  adjusted_p_values
cluster1        0.008280           0.006397           0.007603           0.010390      1.034744  0.355318           0.444147
cluster2        0.051161           0.043682           0.075930           0.043748      1.892794  0.150650           0.376626
cluster3        0.156935           0.137300           0.157527           0.184272      0.498730  0.607301           0.607301
cluster4        0.374093           0.401104           0.270137           0.415872      2.000708  0.135240           0.376626
cluster5        0.409531           0.411516           0.488803           0.345717      1.336332  0.262808           0.438013

out.plot()

plot函数可以通过参数kind绘制不同的图形,如boxplot、barplot。clusters参数可以选择指定的分群。

out.plot_samples(stacked=True)
out.plot_samples(x="clusters")

当条件数量超过两个时使用ANOVA检验显著性,也可以通过conditions指定想要比较的两个条件。

当不提供samples_col参数时,程序会生成模拟的重复数据,同样适用于部分条件有重复样本的情况:

out_boot = scanpro(adata, clusters_col='cluster', conds_col='group', transform='arcsin', n_reps=8, conditions=['cond_1', 'cond_2'])
out_boot.results
          baseline_props  mean_props_cond_1  mean_props_cond_2  adjusted_p_values
clusters
cluster1        0.008280           0.004518           0.006302           0.623251
cluster2        0.051161           0.041000           0.063311           0.475665
cluster3        0.156935           0.135206           0.141711           0.504510
cluster4        0.374093           0.400816           0.258499           0.145980
cluster5        0.409531           0.408919           0.513286           0.316224
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容