r - DESeq2 代码有助于分析 R 中疾病和对照患者之间的差异基因表达
问题描述
我在设计一些正确的代码来解决在 R 中使用 DESeq2 时遇到了麻烦,如何查看与对照相比,哪些基因在疾病患者中的表达更高。
我的数据目前是一个大型数据框,由 600000 个基因名称组成,这些基因名称是行。前三列 [1:3] 是对照患者,后三列来自胰腺癌患者 [4:6]。
DF = data.frame(id=colnames(genetable),type=rep(c("treat","ctrl"),each=3))
# run DESeq2
dds = DESeqDataSetFromMatrix(genetable,DF,~type)
ddsoutput <- DESeq(dds)
summary(results(dds),alpha=0.05)
得到低于0.05的基因个数;
res <- results(ddsoutput)
res[which(res$padj < 0.05),]
然后我需要计算疾病与对照之间的倍数变化,包括上调和下调。我需要设置自己的倍数变化阈值,然后通过KEGG根据我的p值分析最上调或下调的基因的功能;
upreg <- subset(res, log2FoldChange > 1)
downreg <- subset(res, log2FoldChange < 1)
但是以上都不起作用,我想我可能使用 type=rep 出错了?我最终需要将 p 值和日志折叠更改值保存到表中。
解决方案
there's a bug in your code, I corrected it below, and placed the previous it under ##. You replace the original DESeq2 object with the output of the function DESeq()
DF = data.frame(id=colnames(genetable),type=rep(c("treat","ctrl"),each=3))
# run DESeq2
dds = DESeqDataSetFromMatrix(genetable,DF,~type)
dds <- DESeq(dds)
# it was
# ddsoutput <- DESeq(dds)
summary(results(dds),alpha=0.05)
Now run the rest of the script and it should be fine
推荐阅读
- elasticsearch - 避免空值的弹性搜索查询
- jboss - 我如何在 centos 7 上跟踪 JBoss 应用程序的 CLOSE_WAIT 问题?
- python - Python将单位添加到数据框
- javascript - 在预取的组件上反应悬念后备故障
- scala - Monix 并行任务的错误处理(使用 parMap)
- google-apps-script - 高流量和过多的脚本执行时间
- python - gspread 包未在 pip 或 conda 上更新
- machine-learning - 如何加快 Wav2vec 2.0 模型性能并将此模型部署到生产环境中?
- java - 将从jsp中选择的值传递给struts中的Action
- azure-data-factory - Azure DataFactory DataFlow json 源错误类型