美文网首页
Deseq2分析代码

Deseq2分析代码

作者: 黄思源_3a22 | 来源:发表于2018-04-04 15:42 被阅读0次

    condition <- factor(c("control","treat","control","treat","control","treat"), levels = c("control","treat"))

    countData <- dat[,1:6]

    colData <- data.frame(row.names=colnames(dat), condition)

    dds <- DESeqDataSetFromMatrix(countData, colData, design= ~ condition)

    dds <- DESeq(dds)

    contrast=c("condition","control","treat")

    res = results(dds, contrast)

    baseMeanA <- rowMeans(counts(dds, normalized=TRUE)[,colData(dds)$condition == "control"])

    baseMeanB <- rowMeans(counts(dds, normalized=TRUE)[,colData(dds)$condition == "treat"])

    res = cbind(baseMeanA, baseMeanB, as.data.frame(res))

    res = cbind(sampleA="control", sampleB="treat", as.data.frame(res))

    res$padj[is.na(res$padj)]<- 1

    write.table(as.data.frame(res[order(res$pvalue),]), file='o', sep='\t', quote=FALSE)

    相关文章

      网友评论

          本文标题:Deseq2分析代码

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