How does my DESeq2 code handle more than two conditions?
1
1
Entering edit mode
a.rex • 0
@arex-18012
Last seen 5.4 years ago

 

 

I am completely new to using R and DeSeq2 for RNA-seq analysis. My experimental set up is such that I have 3 biological conditions and 2 replicates per condition. I used featurescount to count transcript per genomic interval. I then plugged this into the following script: 

library(DESeq2)
countdata <- read.table("featurescountmatrix.txt", header=TRUE, row.names=1)
countdata <- countdata[ ,6:ncol(countdata)]
colnames(countdata) <- gsub(".[sb]am$", "", colnames(countdata))
countdata <- as.matrix(countdata)
(condition <- factor(c(rep("cond1", 2), rep("cond2", 2),rep("cond3", 2))))
(coldata <- data.frame(row.names=colnames(countdata), condition))
dds <- DESeqDataSetFromMatrix(countData=countdata, colData=coldata, design=~condition)
dds <- DESeq(dds)
res <- results(dds,contrast=c("cond1","cond2","cond3"))
table(res$padj<0.05)
res <- res[order(res$padj), ]
resdata <- merge(as.data.frame(res), as.data.frame(counts(dds, normalized=TRUE)), by="row.names", sort=FALSE)
names(resdata)[1] <- "Gene"
head(resdata)
write.csv(resdata, file="cond123diffexpr-results.csv")

I do not understand, whether from the code above, the p-value is calculated based on the statistical difference between cond1 and cond3 or all three conditions?? 

 

 

 

deseq2 • 626 views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 1 hour ago
United States

A good place to start is our workflow which explains what DESeq2 is testing:

https://bioconductor.org/packages/rnaseqGene

You can also read over the DESeq2 publication which helps out a lot understanding what is happening when you run the software:

https://genomebiology.biomedcentral.com/articles/10.1186/s13059-014-0550-8

For specific functions you can look up what happens and how the different arguments work by typing ? and the function name. 

If you want to know how contrasts work in the results function type:

?results

And read about the contrast argument.

ADD COMMENT

Login before adding your answer.

Traffic: 761 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6