DESEQ2 (R) design/contrast formula questions
Entering edit mode
pete_bioinfo ▴ 10
Last seen 6.5 years ago

Hello, I'm trying to use DESeq2 to analyze some OTU data from phyloseq and despite going through some of the vignettes I'm getting turned around with how I should set up the design/contrast arguments in DESeq()...this probably is because I'm relatively new to R. I'll provide an example of what my data set is like and what I'm trying to do. It's possible DESeq2 isn't appropriate for my analyses, but it seems like it should be. Is there a table somewhere that clearly lays out: Test desired vs. Design (contrast) Formula?

My experiment: I have 3 biological sample types (Type: "A","B","C"), and for each sample type I have a time 0, untreated sample ("A.Control", "B.Control", "C.Control"). I then have 16 treatments of each of the three samples measured at two time points. For simplicity, I've collapsed these 2 variables into a single set of variables (Treatment: "Treat1_time1","Treat1_time2","Treat2_time1",Treat2_time2"......) for each of A, B, C. My goal is to calculate fold change and significance of each treatment at each time vs both the control (time 0) and other treatments. Because my samples are biologically distinct, I want to treat them as paired to account for sample differences at Time 0. I've done the paired analysis of two samples (I think..) by using the design ~Type + Treatment, but I'm not positive on how to do this across all samples, or if that's the appropriate way to address my question. For instance, before trying out DESeq2, I was trying to determine signifance between treatments after correcting normalized counts based on respective time 0 values (i.e., {A.Treat1_time1 - A.Control, B.Treat1_time1 - B.Control, C.Treat1_time1 - C.Control} vs {A.Treat2_time1 - A.Control, B.Treat2_time1 - B.Control, C.Treat2_time1 - C.Control} ).  

I read that it's possible to subtract controls via the design equation, but it wasn't clear to me how to do this.

Thank you for any help, please let me know if you need additional/different information or clarification (if there's a specific vignette that answers this that I overlooked, please let me know). 

deseq2 phyloseq multiple factor design paired samples • 1.8k views
Entering edit mode
Last seen 2 hours ago
United States


This is a pretty complex design, multiple sample types, multiple treatments, two time points with pairing of samples within. I think it would be best if you found a local collaborator with a statistics background to help you set up the design and extract the different tests and help with interpretation. The analysis can be done with DESeq2, it just involves the right choice of design formula and then knowing which terms to contrast after fitting the model. There is nothing DESeq2-specific, you would use the same formula for a linear model in base R, so anyone with knowledge of linear modeling in R can help you. I'm busy writing new software and methods and don't have the time to write this all out myself.

Entering edit mode
mcmurdie ▴ 20
Last seen 8 months ago
United States

This question falls under an entry in the phyloseq FAQ:

"I need help analyzing my data. It has the following study design..."

A local (bio)statistician who is interested in collaboration is a great place to begin addressing this question.


Login before adding your answer.

Traffic: 239 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6