美文网首页
4、Dimensionality reduction

4、Dimensionality reduction

作者: 小贝学生信 | 来源:发表于2020-09-23 23:00 被阅读0次

    原文链接Chapter 9 Dimensionality reduction

    1、背景知识

    (1)维度

    • 假设一个测定10个细胞的指定两个基因的表达量,那么可以通过二维的点图(基因1表达量为x轴,基因2表达量为y轴)描述每个细胞的表达情况。
    • 如果是指定三个基因,则为三维立体空间坐标
    • 如果有成百上千个基因,那么每个细胞都有一个高维度坐标,描述细胞表达的特性;同时数据复杂度大大增加。

    (2)降维

    • 若干不同基因的表达情况关联度很高,可以用一个维度代替多个维度;
    • 可有效降低高维度数据的复杂性,便于后续的下游分析,以及绘图可视化。

    2、PCA主成分分析

    • In PCA, the first axis (or “principal component”, PC) is chosen such that it captures the greatest variance across cells.
    • The next PC is chosen such that it is orthogonal to the first and captures the greatest remaining amount of variation, and so on.
    • the earlier PCs in our downstream analyses, which concentrates the biological signal to simultaneously reduce computational work and remove noise.
    load("fluidigm_lgnm_hvg.Rdata")
    fluidigm.hvg #上一步已经取好高变基因子集的sce
    dim(fluidigm.hvg) #1000个差异基因
    library(scater)
    

    2.1 runPCA()

    fluidigm.hvg <- runPCA(fluidigm.hvg)
    reducedDimNames(fluidigm.hvg)
    # [1] "PCA"
    dim(reducedDim(fluidigm.hvg, "PCA"))
    # 127  50  针对127个细胞的50个主成分的描述
    

    如上

    • By default, runPCA() will compute the first 50 PCs ;
    • result is stored in the reducedDims() of the output SingleCellExperiment object

    2.2 后续pcs选择

    • 在一般PCA分析50个主成分后,我们要选择最优的ealier pc进行下游分析;
    • 具体数量多少的选择:Using more PCs will avoid discarding biological signal in later PCs, at the cost of retaining more noise.
    • 一般来说,“reasonable” but arbitrary value, typically ranging from 10 to 50.
    • 可通过不同的方法选择具体何时的pcs,常用的是 elbow point(拐肘点)
    percent.var <- attr(reducedDim(fluidigm.hvg), "percentVar")
    chosen.elbow <- PCAtools::findElbowPoint(percent.var)
    chosen.elbow 
    # 5    建议仅选取前五个主成分即可(可能与细胞数量较少有关)
    plot(percent.var, xlab="PC", ylab="Variance explained (%)")
    abline(v=chosen.elbow, col="red")
    
    • 如下图所示,there should be a sharp drop in the percentage of variance explained when we move past the last “biological” PC.


      2.2

    此方法的不足之处在于 in order to be retained, later PCs must explain a amount of variance that is comparable to that explained by the first few PCs. Strong biological variation in the early PCs will shift the elbow to the left that tends to retain fewer PCs compared to other methods.
    此外原文还介绍了基于方差分解thresholds、亚群结构的pcs判断以及基于非负矩阵分解的降维方法,具体可参看原文。

    3、二维图可视化

    • 尽管50个维度的数据复杂度已经相对较小,但对于人脑很难构想出来。因此基于二维的坐标轴可视化是一种常用的展现方法

    3.1 基于PCA

    一般默认使用每个细胞top2的主成分值作为细胞坐标,达到可视化目的

    plotReducedDim(fluidigm.hvg, dimred="PCA", colour_by="Cluster2")
    
    3.1

    使用的sce数据对象的colData对象有分组信息,刚好可以用来验证。其实包括下面的tSNE,Umap二维可视化结果一般都可与后期cluster、annotation结果验证,对比是否有异常差异。

    3.2 tSNE

    • t-stochastic neighbor embedding (t-SNE) method
    • find a low-dimensional representation of the data that preserves the distances between each point and its neighbors in the high-dimensional space.
    • 但是不能作为距离较远的两个类群(non-neighboring clusters)的关系参考
    fluidigm.hvg <- runTSNE(fluidigm.hvg, dimred="PCA")
    plotReducedDim(fluidigm.hvg, dimred="TSNE", colour_by="Cluster2")
    
    3.2

    runTSNE()函数的perplexity参数 determines the granularity of the visualization,可调整图形每个类群的紧密程度

    3.3 UMAP

    • The uniform manifold approximation and projection (UMAP) method
    • 思路同tSNE,但具体方法不同。
    • 相对于tSNE的最大优点就是快,尤其是在大数据处理过程中。
    fluidigm.hvg <- runUMAP(fluidigm.hvg, dimred="PCA")
    plotReducedDim(sce.zeisel, dimred="UMAP", colour_by="Cluster2")
    
    3.3
    reducedDimNames(fluidigm.hvg)
    #[1] "PCA"  "TSNE" "UMAP"
    save(fluidigm.hvg, file = "fluidigm.pca")
    
    • 如上主要进行了PCA降维处理,以及TSNE、UMAP的二维可视化,用于后续的分析处理。

    以上是第九章Dimensionality reduction部分的简单流程笔记。原文还介绍了基于spike in 与泊松分布的两种挑选高变基因的高级方法,详见Chapter 9 Dimensionality reduction
    本系列笔记基于OSCA全流程的大致流程梳理,详细原理可参考原文。如有错误,恳请指正!
    此外还有刘小泽老师整理的全文翻译笔记,详见目录

    相关文章

      网友评论

          本文标题:4、Dimensionality reduction

          本文链接:https://www.haomeiwen.com/subject/gvaoyktx.html