单细胞中的标准化和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

单细胞数据分析流程图
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 199,830评论 5 468
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 83,992评论 2 376
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 146,875评论 0 331
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 53,837评论 1 271
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 62,734评论 5 360
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,091评论 1 277
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,550评论 3 390
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,217评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,368评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,298评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,350评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,027评论 3 315
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,623评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,706评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,940评论 1 255
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,349评论 2 346
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 41,936评论 2 341

推荐阅读更多精彩内容