hello,大家好禀崖,今天我們來分享一個新的分析點(diǎn)礁鲁,基因表達(dá)的熵值分析盐欺,這個分析主要是用來衡量不同樣本同一基因或者通路的熵值變化,也是一個新的角度來看待差異基因仅醇。
SCEnt 是一個用于單細(xì)胞熵分析的包冗美。 它可以計算細(xì)胞群內(nèi)基因異質(zhì)性或同質(zhì)性的指標(biāo)。 它可以使用這些指標(biāo)對 scRNA-seq 數(shù)據(jù)執(zhí)行特征選擇析二。 文章在Measuring the Information Obtained from a Single-Cell Sequencing Experiment,我們主要來看看代碼粉洼。
單細(xì)胞測序 (sc-Seq) 實驗正在產(chǎn)生越來越大的數(shù)據(jù)集。 但是甲抖,大型數(shù)據(jù)集不一定包含大量信息漆改。 在這里,引入了一個正式框架准谚,用于評估從 sc-Seq 實驗中獲得的信息量挫剑,該框架可用于整個 sc-Seq 分析流程,包括質(zhì)量控制柱衔、特征選擇和聚類樊破。 用一些簡單的例子來說明這個框架,包括使用它來量化由建議的聚類解釋的單細(xì)胞測序數(shù)據(jù)集中的信息量唆铐。 我們的信息理論框架提供了一種正式的方法來評估從 sc-Seq 實驗中獲得的數(shù)據(jù)的質(zhì)量哲戚,并且對我們理解異質(zhì)細(xì)胞群中基因表達(dá)模式的變異性具有廣泛的意義 。(專業(yè)的詞匯總是這個難以理解)
圖片.png
- 圖注:An information-theoretic view of sc-Seq data. Transcripts, or more generally counts, are assigned to cells after sequencing. If the population is pure, then the information unexplained by the hypothesis of homogeneity is zero (top left). In practice, the assignment process is stochastic, so will naturally result in a small non-zero information unexplained (bottom left). If the population is heterogeneous then transcripts are expressed preferentially in a subset of cells and the information unexplained is large (top right), reaching a maximum (at log2(N), where N is the number of cells) when only one cell expresses the gene (bottom right)
什么是熵值分析艾岂,Entropy Analysis顺少。每個基因的表達(dá)可以被認(rèn)為是一個概率分布。 在給定基因已表達(dá)的信息的情況下,表達(dá)計數(shù)可用于推斷它在給定細(xì)胞中表達(dá)的概率脆炎。
每個基因的這些概率分布中的每一個都包含一定數(shù)量的信息梅猿,在數(shù)學(xué)中稱為熵。 熵在歷史上被描述為系統(tǒng)中編碼的“surprise”的數(shù)量秒裕。 如果一個給定的基因只在一個細(xì)胞中表達(dá)袱蚓,那么這個基因就被認(rèn)為是低熵的,就好像那個基因被表達(dá)了几蜻,那么表達(dá)它的細(xì)胞是已知的喇潘,沒有“surprise”。 但是梭稚,如果給定的基因在每個細(xì)胞中的表達(dá)均等颖低,則該基因?qū)⒕哂懈哽亍?由于該基因的表達(dá)不會縮小它可能來自的細(xì)胞數(shù)量,這意味著答案將是一個“surprise”弧烤。
這意味著枫甲,基因在細(xì)胞群中表達(dá)得越均勻,表達(dá)分布的熵就越大扼褪。 因此,允許熵成為細(xì)胞群內(nèi)同質(zhì)性的度量粱栖。
每個概率分布都有一個熵值话浇,有很多方法可以比較概率分布之間的熵值。 其中之一稱為 Kullback-Liebler Divergence(或簡稱 KL Divergence)闹究。 KL 散度測量如果使用一種分布來近似另一種分布將損失的熵量幔崖。 (關(guān)于KL散度已經(jīng)分享了很多了,大家可以回看一些文章)渣淤。
在這種情況下赏寇,可以使用 KL Divergence 來查看如果使用均勻分布來表示基因的表達(dá)分布會丟失多少信息。 記住均勻分布將是完全同質(zhì)基因的表達(dá)价认,KL 散度為我們提供了一個衡量從基因異質(zhì)性中獲得多少額外信息的方法嗅定。 本質(zhì)上給出了細(xì)胞群中基因異質(zhì)性的度量。
我們來看看具體怎么做的
Using SCEnt to Quantify Homogeneity and Heterogeneity
Here is some synthetic scRNA-seq data:
gene_counts
#> gene1 gene2 gene3 gene4 gene5
#> cell1 0 5 2 3 0
#> cell2 0 5 0 3 0
#> cell3 0 3 2 3 0
#> cell4 0 2 1 3 0
#> cell5 1 0 3 3 5
#> cell6 2 0 0 3 0
#> cell7 3 0 1 3 0
gene_hom() 和gene_het() 函數(shù)可分別用于計算基因的同質(zhì)性或異質(zhì)性用踩。 每一個都可以傳遞一個基因渠退,它會返回一個值。
(gene1 <- gene_counts[,1])
#> cell1 cell2 cell3 cell4 cell5 cell6 cell7
#> 0 0 0 0 1 2 3
gene_hom(gene1)
#> [1] 1.459148
gene_het(gene1)
#> [1] 1.348207
(gene2 <- gene_counts[,2])
#> cell1 cell2 cell3 cell4 cell5 cell6 cell7
#> 5 5 3 2 0 0 0
gene_hom(gene2)
#> [1] 1.908613
gene_het(gene2)
#> [1] 0.8987422
(gene3 <- gene_counts[,3])
#> cell1 cell2 cell3 cell4 cell5 cell6 cell7
#> 2 0 2 1 3 0 1
gene_hom(gene3)
#> [1] 2.19716
gene_het(gene3)
#> [1] 0.6101952
(gene4 <- gene_counts[,4])
#> cell1 cell2 cell3 cell4 cell5 cell6 cell7
#> 3 3 3 3 3 3 3
gene_hom(gene4)
#> [1] 2.807355
gene_het(gene4)
#> [1] 0
(gene5 <- gene_counts[,5])
#> cell1 cell2 cell3 cell4 cell5 cell6 cell7
#> 0 0 0 0 5 0 0
gene_hom(gene5)
#> [1] 0
gene_het(gene5)
#> [1] 2.807355
注意脐彩,gene4 是最大同質(zhì)基因碎乃,gene5 是最大異質(zhì)基因。 因此惠奸,他們的熵計算總是返回 0 或 2.807355 的極值梅誓,非零極值將等于 log2[N],其中 N 是樣本中的cells數(shù)。
可以傳遞整個基因表達(dá)矩陣梗掰,而不是單獨(dú)提交每個基因嵌言。 但是,數(shù)據(jù)需要采用將基因表示為行而將細(xì)胞表示為列的格式愧怜。
gene_hom(t(gene_counts))
#> gene1 gene2 gene3 gene4 gene5
#> 1.459148 1.908613 2.197160 2.807355 0.000000
除了轉(zhuǎn)置矩陣作為輸入之外呀页,為了方便起見,還有一個轉(zhuǎn)置參數(shù)
gene_het(gene_counts, transpose = TRUE)
#> gene1 gene2 gene3 gene4 gene5
#> 1.3482070 0.8987422 0.6101952 0.0000000 2.8073549
gene_hom() 和gene_het() 函數(shù)還有其他參數(shù)拥坛,大家可以好好看看蓬蝶。 unit
參數(shù)傳遞給熵計算以更改計算熵的單位,默認(rèn)情況下設(shè)置為“l(fā)og2”猜惋,以便所有輸出都以位為單位丸氛。 如果基因表達(dá)已經(jīng)是概率形式,則normalise
參數(shù)就在那里著摔。 通常不應(yīng)使用此參數(shù)缓窜,除非在某些情況下可以加快計算速度。
Using SCEnt For Feature Selection
當(dāng)想要使用基因表達(dá)進(jìn)行預(yù)測時谍咆,群體內(nèi)均勻表達(dá)的基因?qū)θ魏畏诸惗紱]有用禾锤。 相反,異質(zhì)表達(dá)的基因更有可能用于預(yù)測摹察。
函數(shù)scent_select() 將通過發(fā)現(xiàn)基因異質(zhì)性并應(yīng)用一些定義的閾值來對scRNA-seq 數(shù)據(jù)進(jìn)行特征選擇恩掷。 可選擇的閾值有 bit_threshold、count_threshold 和 perc_threshold供嚎。 bit_threshold 采用一個數(shù)值黄娘,SCEnt 只會選擇異質(zhì)性值大于給定位值的基因。 count_threshold 取一個整數(shù)值克滴,SCEnt 將返回只有前 n 個異質(zhì)表達(dá)基因的數(shù)據(jù)逼争,其中 n 是 count_threshold。 perc_threshold 的值介于 0 和 1 之間劝赔,SCEnt 將僅返回異質(zhì)性大于由 perc_threshold 給出的種群異質(zhì)性百分位數(shù)的基因誓焦。 與上面的熵計算不同的是,基因表達(dá)的矩陣應(yīng)該以細(xì)胞為行着帽,基因為列的格式罩阵。 同樣,有一個內(nèi)置的轉(zhuǎn)置選項启摄,以及要傳遞給熵計算的單位和歸一化參數(shù)稿壁。
gene_counts
#> gene1 gene2 gene3 gene4 gene5
#> cell1 0 5 2 3 0
#> cell2 0 5 0 3 0
#> cell3 0 3 2 3 0
#> cell4 0 2 1 3 0
#> cell5 1 0 3 3 5
#> cell6 2 0 0 3 0
#> cell7 3 0 1 3 0
根據(jù)提供的閾值,scent_select() 可以執(zhí)行這三種形式的特征選擇中的每一種歉备。
scent_select(gene_counts, bit_threshold = 0.85)
#> gene1 gene2 gene5
#> cell1 0 5 0
#> cell2 0 5 0
#> cell3 0 3 0
#> cell4 0 2 0
#> cell5 1 0 5
#> cell6 2 0 0
#> cell7 3 0 0
scent_select(gene_counts, count_threshold = 2)
#> gene1 gene5
#> cell1 0 0
#> cell2 0 0
#> cell3 0 0
#> cell4 0 0
#> cell5 1 5
#> cell6 2 0
#> cell7 3 0
scent_select(gene_counts, perc_threshold = 0.25)
#> gene1 gene2 gene3 gene5
#> cell1 0 5 2 0
#> cell2 0 5 0 0
#> cell3 0 3 2 0
#> cell4 0 2 1 0
#> cell5 1 0 3 5
#> cell6 2 0 0 0
#> cell7 3 0 1 0
嘗試對多個值設(shè)置閾值會引發(fā)錯誤
scent_select(gene_counts, bit_threshold = 0.85, count_threshold = 2)
#> Error in scent_select(gene_counts, bit_threshold = 0.85, count_threshold = 2):
#> Only one threshold can be set at a time
這是為了避免操作順序出現(xiàn)問題傅是,而應(yīng)該將scent_select() 傳遞回自身,以便應(yīng)用閾值的順序是明確的
gene_counts %>%
scent_select(bit_threshold = 0.85) %>%
scent_select(count_threshold = 2)
#> gene1 gene5
#> cell1 0 0
#> cell2 0 0
#> cell3 0 0
#> cell4 0 0
#> cell5 1 5
#> cell6 2 0
#> cell7 3 0
其實熵值分析主要是來尋找變化大的基因,也就是同質(zhì)化和異質(zhì)化的基因喧笔,對我們理解樣本的特征有很深的借鑒意義帽驯。
生活很好,有你更好