I have 4 tissue types which I am trying to contrast between different groups using DeSeq2 in order to find genes unique to each tissue type(Let's say tissueA vs all others). I went through some posts: https://support.bioconductor.org/p/86347/ and https://www.biostars.org/p/317843/ and tried the numeric contrast option.
dds_test <- DESeq(dds_gene)
results(dds_test, contrast = c(1, -1/3, -1/3, -1/3))
As, I did not fully understand which number referred to what condition, and tried using the list form in contrast but the commands were throwing an error. I went through the post https://support.bioconductor.org/p/105087/ and tried to follow the same.
dds_test2<- DESeq(dds_gene, betaPrior=T)
resultsNames(dds_test2)
[1] "Intercept" "tissueA" "tissueB" "tissueC" "tissueD"
results(dds_test2, contrast = list(c("tissueA"),c("tissueB","tissueC","tissueD")), listValues=c(1, -1/3))
This resulted in completely different outputs. Then I tried to check the previous design resultnames using the resultsNames(dds_test) command which showed the following output:
[1] "Intercept" "tissue_B_vs_A" "tissue_C_vs_A" "tissue_D_vs_A"
What is the difference between the two approaches? Which way is the correct way of doing this? Have I misinterpreted something?
Thanks for the reply. But I still do not understand what the above formulas do. Also, why is it important to remove the intercept in this case?
Take a look at the linear models chapter here:
http://genomicsclass.github.io/book/
In particular the part about contrasts, and also the difference between including an intercept or not in a linear model.