I am fitting linear models with limma with coefficients: conditionA, conditionB, tissueA, tissueB, tissueC.
If I specified a contrast like c(-1,1,1,0,0)
, will that compare conditionB-conditionA in tissueA only? In a differential expression analysis, this would identify differentially expressed genes in conditionB vs conditionA specifically in tissue A - correct?
Thank you Sam and swbarnes2 for your answers. That makes more sense now. Another question, if I then wanted to compare condition B vs condition A across all tissues, would I set my contrast to be 1 for all of the conditionB coefficients (regardless of tissue) and then -1 for all of the conditionA coefficients? e.g. conditionA_tissueA, conditionA_tissueB, conditionB_tissueA, conditionB_tissueB -> c(1, 1, -1, -1)
Yes. For edgeR, I think it would be easier/clearer to define a model matrix using the condition factor only, and then define a contrast conditionB-conditionA.
If you want to improve your design skills, you should read the following article, which I refer to regularly.
A guide to creating design matrices for gene expression experiments