单细胞中的标准化和PCA:哈佛生信课程学习(一)

搬运自哈佛生物信息课程:《Introduction to Single-cell RNA-seq》
链接:https://hbctraining.github.io/scRNA-seq/lessons/05_normalization_and_PCA.html

本节主要内容:

Count Normalization and Principal Component Analysis

After attaining our high quality single cells, the next step in the single-cell RNA-seq (scRNA-seq) analysis workflow is to perform clustering. The goal of clustering is to separate different cell types into unique clusters of cells. To perform clustering, we determine the genes that are most different in their expression between cells. Then, we use these genes to determine which correlated genes sets are responsible for the largest differences in expression between cells.
获得高质量的单细胞数据后,在单细胞RNA-seq (scRNA-seq)分析工作流中的下一步是执行聚类分群。聚类的目的是将不同类型的细胞分离成独特的细胞簇。为了进行聚类,我们确定在细胞之间表达最不同/变化最大的基因(HVGs)。然后,我们使用这些基因来确定哪些相关的基因是造成细胞间表达差异最大的原因。

1、Count normalization

First one is count normalization, which is essential to make accurate comparisons(精准比较) of gene expression between cells (or samples). The counts of mapped reads for each gene is proportional to the expression of RNA (“interesting”) in addition to many other factors (“uninteresting”). Normalization is the process of scaling raw count values to account for the “uninteresting” factors. In this way the expression levels are more comparable between and/or within cells.

标准化最重要的目的就是使表达水平在细胞之间和/或细胞内更具有可比性。那么在标准化中主要需要处理的因素包括:

  • 测序深度:考虑测序深度是比较细胞之间基因表达的必要条件。在下面的示例中,每个基因在细胞2中的表达似乎都增加了一倍,但这是细胞2具有两倍测序深度的结果。


    image.png

Each cell in scRNA-seq will have a differing number of reads associated with it. So to accurately compare expression between cells, it is necessary to normalize for sequencing depth.(在scRNA-seq中每个细胞都有不同数量的reads与之关联。为了准确比较细胞间的表达,对测序深度进行标准化是有必要的。)

  • 基因长度:需要基因长度来比较同一细胞内不同基因之间的表达。基因长度越长比对到的reads理论上会越多。如下图所示:低表达的较长基因测序到的reads数与较高表达的短基因相差不大。
    image.png

如果进行的是5’末端或3’末端测序,则不需要考虑基因长度的影响;

如果使用全长测序则需要考虑。

2、Principal Component Analysis (PCA)

例样:

如果你已经定量了两个样本(或细胞)中四个基因的表达,则可以绘制这些基因的表达值,其中一个样本在x轴上表示,另一个样本在y轴上表示,如下所示:

image.png

You could draw a line through the data in the direction representing the most variation, which is on the diagonal in this example. The maximum variation in the dataset is between the genes that make up the two endpoints of this line.
我们可以沿代表最大变化的方向在数据上画一条线,在此示例中为对角线,数据中变化第一大的变量。数据集中的最大变异是在组成两个端点的基因。我们还看到基因在该线的上方和下方有些不同。我们可以在该条线的中点绘制另一条与其垂直的线,代表数据中变化第二大的变量。

image.png

每条线段末端附近的基因变异最大;从数学上讲,这些基因对线条的方向有最大的影响。


image.png

例如,基因C值的一个小变化会极大地改变更长的线的方向,而基因a或基因D的一个小变化对它几乎没有影响。


image.png

We could also rotate the entire plot and view the lines representing the variation as left-to-right and up-and-down. We see most of the variation in the data is left-to-right (longer line) and the second most variation in the data is up-and-down (shorter line). You can now think of these lines as the axes that represent the variation. These axes are essentially the “Principal Components”, with PC1 representing the most variation in the data and PC2 representing the second most variation in the data.
(我们还可以旋转整个图形,并将表示变化的线看作从左到右和从上到下。我们看到数据中的大部分变化是从左到右(较长的线),数据中的第二大部分变化是上下(较短的线)。你可以把这些线看作是表示变化的坐标轴。这些轴本质上是“主成分”,其中PC1代表数据中最大的变化,PC2代表数据中第二大变化。)


image.png

If we had three samples/cells, then we would have an extra direction in which we could have variation (3D). Therefore, if we have N samples/cells we would have N-directions of variation or principal components (PC)! Once these PCs have been calculated, the PC that deals with the largest variation in the dataset is designated PC1, and the next one is designated PC2 and so on.

确定PCs后,则需要对每个PC进行评分,按照以下步骤对所有样本PC对(sample-PC pairs)计算分数:

1)首先,根据基因对每个PC的影响程度,为其分配“影响力”评分。对给定PC没有任何影响的基因得分接近零,而具有更大影响力的基因得分更高。PC线末端的基因将产生更大的影响,因此它们将获得更大的分数,但两端的符号相反。


image.png

2)确定影响分数后,使用以下公式计算每个样本的分数:

Sample1 PC1 score = (read count * influence) + ... for all genes

For our 2-sample example, the following is how the scores would be calculated:

## Sample1
PC1 score = (4 * -2) + (1 * -10) + (8 * 8) + (5 * 1) = 51
PC2 score = (4 * 0.5) + (1 * 1) + (8 * -5) + (5 * 6) = -7

## Sample2
PC1 score = (5 * -2) + (4 * -10) + (8 * 8) + (7 * 1) = 21
PC2 score = (5 * 0.5) + (4 * 1) + (8 * -5) + (7 * 6) = 8.5

3)一旦为各个样本的所有PC计算了这些分数,就可以将其绘制在简单的散点图上。下面是示例图:

image.png

对于具有大量样本或细胞的数据集,通常会绘制每个样本/细胞的PC1和PC2分数。由于这些PC解释了数据集中最大的变化,因此更相似的样本/细胞将在PC1和PC2聚在一起。请参见下面的示例:

image.png

单细胞数据分析流程图

你可能感兴趣的:(单细胞中的标准化和PCA:哈佛生信课程学习(一))