假期結(jié)束啦U饩础:蕉帷!4尥俊Q羝!冷蚂!
在將數(shù)據(jù)導(dǎo)入并完成構(gòu)建DESeqDataSet 后缭保,我們需要先對數(shù)據(jù)進行初步過濾和整理,之后才可以根據(jù)我們的目的來進行數(shù)據(jù)挖掘(這個詞聽起來好高大上啊蝙茶,哈哈哈)艺骂。
Analyzing RNA-seq data with DESeq2(一)
Analyzing RNA-seq data with DESeq2(二)
Analyzing RNA-seq data with DESeq2(三)
Analyzing RNA-seq data with DESeq2(四)
Analyzing RNA-seq data with DESeq2(五)
Pre-filtering
(過濾低count的gene)
首先我們將以是每個gene最低對應(yīng)10個reads數(shù)(這里作為舉例)作為最低值對數(shù)據(jù)進行過濾。
Here we perform a minimal pre-filtering to keep only rows that have at least 10 reads total. Note that more strict filtering to increase power is automatically applied via independent filtering on the mean of normalized counts within the results function.
keep <- rowSums(counts(dds)) >= 10
dds <- dds[keep,]
##過濾掉小于10個reads數(shù)的gene
看看初步過濾后變成了什么樣子:
> dds
class: DESeqDataSet
dim: 9921 7
metadata(1): version
assays(1): counts
rownames(9921): FBgn0000008 FBgn0000014 ... FBgn0261574 FBgn0261575
rowData names(1): gene
colnames(7): treated1 treated2 ... untreated3 untreated4
colData names(2): condition type
可以看到行數(shù)(gene數(shù))由原來的14599個降到9921個
這里需要說明的是:
盡管在使用DESeq2函數(shù)前過濾低count的gene并不是必須的隆夯,但預(yù)過濾數(shù)據(jù)的好處是钳恕,去除那些只有很少reads的行以后,可以減少dds的存儲蹄衷,從而極高程序運行速度忧额。
Note on factor levels
(關(guān)于因子水平的說明)
默認情況下,R會根據(jù)字母順序為factor選擇參考水平愧口,如果沒有事前定義DESeq2函數(shù)按照什么順序進行比較的話(例如誰是對照組睦番、誰是實驗組),那將會默認按照字母順序進行排序耍属。
為了避免這種問題發(fā)生我們可以這么做:
##方法一:factor levels:寫在前面的level作為參照
dds$condition <- factor(dds$condition, levels = c("untreated","treated"))
##方法二:使用relevel函數(shù)
dds$condition <- relevel(dds$condition, ref = "untreated")
> dds$condition
[1] treated treated treated untreated untreated untreated untreated
Levels: untreated treated
另外如果數(shù)據(jù)中有一組level是沒有樣品對應(yīng)的托嚣,可以使用droplevels函數(shù)去除。
拓展:根據(jù)這個功能我們也可以使用該函數(shù)來進行子集的選擇處理**
dds$condition <- droplevels(dds$condition)
Collapsing(合并) technical replicates
DESeq2提供了一個collapseReplicates函數(shù)來把技術(shù)重復(fù)的樣本數(shù)據(jù)合并到表達矩陣的一個列中厚骗。
The term technical replicate implies multiple sequencing runs of the same library.
注意:
對于生物學(xué)重復(fù)不能使用該方法去除
后面開始真正的大活咯W⒁妗!溯捆!