匹配元数据与计数数据
要用 DESeq2 开展任何分析,首先需要通过提供原始计数、元数据和设计公式来创建一个 DESeq2 对象。为此,您需要读入之前准备好的原始计数数据及其对应的元数据,确保两个数据集中样本名称的顺序一致,然后创建一个用于差异表达分析的 DESeq2 对象。我们将使用设计公式 ~ condition 来检验不同条件(正常与纤维化)之间的差异表达。
DESeq2 和 dplyr 库已为您加载,smoc2_rawcounts 与 smoc2_metadata 文件也已读入。
本练习是课程的一部分
使用 R 中的 Bioconductor 进行 RNA-Seq 分析
练习说明
使用
match()函数返回如何重新排列计数数据列的索引,使其与元数据行名的顺序一致。将结果赋给reorder_idx。使用
reorder_idx重新排列计数数据的列,使列名与元数据行名的顺序相匹配。使用
DESeqDataSetFromMatrix()函数,结合元数据和已重新排序的计数数据,创建名为dds_smoc2的 DESeq2 对象。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# 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)