美文网首页转录组ggplot集锦
利用DESeq2进行多组分析(终于找到教程了)

利用DESeq2进行多组分析(终于找到教程了)

作者: 夏大希 | 来源:发表于2022-11-01 21:14 被阅读0次
###对大麦相同时期的不同部位进行多组比较分析差异基因
# https://www.biostars.org/p/357464/
library(DESeq2)
BiocManager::install("apeglm")
library(apeglm)
x <- round(matrix(rexp(480 * 10, rate=.1), ncol=12), 0)
rownames(x) <- paste("gene", 1:nrow(x))
colnames(x) <- paste("sample", 1:ncol(x))
coldata <- data.frame(
  condition = factor(c(
    rep("ctl", 3),
    rep("A", 3),
    rep("B", 3),
    rep("C", 3))))
coldata$condition <- relevel(coldata$condition, ref = "ctl")
dds <- DESeqDataSetFromMatrix(
  countData = x,
  colData = coldata,
  design= ~ condition)
dds <- DESeq(dds, betaPrior = FALSE)
resultsNames(dds)

# generate results table for A vs ctl
res <- results(dds, name="condition_A_vs_ctl")
# same as above but with lfc shrinkage
res <- lfcShrink(dds, coef = 'condition_A_vs_ctl', type = 'apeglm', res = res)
res
##or useing next
results(dds, c("condition", "A", "C"))




相关文章

网友评论

    本文标题:利用DESeq2进行多组分析(终于找到教程了)

    本文链接:https://www.haomeiwen.com/subject/dkqstdtx.html