開始使用免費開始

對齊中介資料與計數資料

要使用 DESeq2 進行分析,你需要提供原始計數、中介資料,以及設計公式,來建立一個 DESeq2 物件。為此,請讀入先前建立的原始計數資料與相對應的中介資料,確認兩個資料集中樣本名稱的順序一致,然後建立可用於差異表現分析的 DESeq2 物件。我們將使用設計公式 ~ condition,用來在不同條件(normal 與 fibrosis)間檢驗差異表現。

已為你載入 DESeq2dplyr 函式庫,並讀入 smoc2_rawcountssmoc2_metadata 檔案。

本練習屬於課程

使用 R 與 Bioconductor 進行 RNA-Seq

檢視課程

練習說明

  • 使用 match() 函式,回傳如何重新排序計數資料欄位的索引,讓其順序與中介資料的列名稱一致。將結果指定給 reorder_idx

  • 使用 reorder_idx 重新排序計數資料的欄位,使欄位名稱的順序與中介資料的列名稱順序相符。

  • 使用 DESeqDataSetFromMatrix() 函式與整理後的中介資料與計數資料,建立 DESeq2 物件 dds_smoc2

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Use the match() function to reorder the columns of the raw counts
reorder_idx <- match(___(___), ___(___))

# Reorder the columns of the count data
reordered_smoc2_rawcounts <- smoc2_rawcounts[ , ___]

# Create a DESeq2 object
dds_smoc2 <- DESeqDataSetFromMatrix(countData =  ___,
                              colData =  ___,
                              design = ~ condition)
編輯並執行程式碼