On a similar note  I am trying to perform differential expression contrasts for 2 different populations  one resistant to a given drug and one wild type (i.e. sensitive). Within each population, I have samples that were treated at just one given concentration of the drug, and samples that were treated with a drug vehicle (control).
So the basic study design for this experiment is :
Population A (resistant):Treatment (Y) vs Control (X)
Population B (wild type): Treatment (Y) vs Control (X)
In addition to population and treatment variables, I also have to adjust for a very strong batch effect (3 batches).
So the formula for my design matrix at the moment is:
~ Batch + Population + Treatment + Population:Treatment
and the resulting design matrix looks like so:
(Intercept) Batch2 Batch3 PopulationB TreatmentY PopulationB:TreatmentY
Sample_1 1 0 0 0 0 0
Sample_2 1 0 0 0 0 0
Sample_3 1 0 0 0 0 0
Sample_4 1 1 0 0 0 0
Sample_5 1 1 0 0 0 0
Sample_6 1 0 0 0 1 0
Sample_7 1 0 0 0 1 0
Sample_8 1 0 0 0 1 0
Sample_9 1 1 0 0 1 0
Sample_10 1 1 0 0 1 0
Sample_11 1 1 0 1 0 0
Sample_12 1 1 0 1 0 0
Sample_13 1 0 1 1 0 0
Sample_14 1 0 1 1 0 0
Sample_15 1 0 1 1 0 0
Sample_16 1 1 0 1 1 1
Sample_17 1 1 0 1 1 1
Sample_18 1 0 1 1 1 1
Sample_19 1 0 1 1 1 1
Sample_20 1 0 1 1 1 1
What I don't understand is given this complete linear model formula, how do I specify contrasts (both edgeR and DESEq) to compare the two treatment methods WITHIN each population?
i.e. I want to test the effect of treatment separately for population A and for population B, adjusting for Batch effect, using this complete model.
Specifying coef=4 would give me the overall difference in expression between the two populations and specifying coef=5 will give me the overall difference in expression between the two treatment methods, but that is less interesting a question given my study design
Any help would be greatly appreciated
Regards
