I have two controls and four treatments. I calculated gene-counts using htseq.
directory <- "~/d/new_de/gene_counts/"
sampleFiles <- c("P-1.deseqfile",
"P-2.deseqfile",
"P-3.deseqfile",
"P-4.deseqfile",
"NP-3.deseqfile",
"NP-4.deseqfile"
)
sampleNames <- c("P-1", "P-2", "P-3", "P-4","NP-3", "NP-4")
sampleCondition <- c("Treatment", "Treatment", "Treatment", "Treatment","Control", "Control")
sampleTable <- data.frame(sampleName = sampleNames, fileName = sampleFiles, condition = sampleCondition)
View(sampleTable)
ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable, directory = directory, design = ~ condition)
dds<- DESeq(ddsHTSeq)
res<- results(dds)
When I switch the sampleFiles and sampleNames I again get the same treatment vs control
results instead of control vs. treatment
.
I think I am wrong in specifying the design/treatment conditions properly.
Kindly pin-point the error.
Thank you!
I'm not 100% but it could just be taking them in the order you provide them and doing the first obvious comparison.
Try just running the following.
Before you create your sampleTable
data.frame
object and see if that fixes it.Alternatively what is the problem with treatment vs. control ? Just reverse the signs and it should be the same as control vs. treatment?
Specifying
res <- results(dds, contrast=c("condition","B","A"))
worked. Thank you.