This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Contrasts for comparing condition within tissue

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?

limma deseq2 edger contrasts

2 answers

No, and I can't really say what this contrast will perform.

If you want to have contrast conditionB-conditionA for samples from tissueA as if only samples from tissueA were kept, we have to build a factor combining the condition factor and the tissue factor, which will result in assigning samples to levels such as conditionB_tissueA, conditionA_tissueA, conditionB_tissueB, etc. for example. Then, we can build the desired contrast as conditionB_tissueA-conditionA_tissueA.

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)

I can only speak for DESeq2, but with that software, the usual way to compare A-B in tissue A only is to make a column of meta data that is condition_tissue, and then specify in the contrast that you want to compare conditionA_tissueA to conditionB_tissueA.

Log in to answer this question.