This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to find log2fold change values comparing multiple subgroups

Hello all,

I have a dataset with 40 samples, and each sample is labeled with two tags. A sample will be labelled either A or B AND X or Y. So a sample could be 1AX / 1AY / 1BX / 1BY.

Example of the data

I'm trying to perform differential expression analysis using DESeq2. The A/B and X/Y is relatively problem free, but now I need to perform the same steps on AX/BX (for example).

I tried adding the subgroups to my annotation/coldata table as an extra column, but with default settings, the results compared two subgroups that I'm not interested in. An example of what I ran:

sub <- DESeqDataSetFromMatrix(countData=countData, colData=coldata, design=~subgroup)
sub <- DESeq(sub)
res <- results(sub)

This picks AX/BY by default, but I need AX/BX. I don't see a way to specify which subgroups to choose.

The reason for trying to perform it like this is that I need to normalise all 40 samples together, but I need the log2fold change values specific for the subgroups being compared.

I have seen the contrast option in the DESeq2 vignette, which seems to be the appropriate route, but I don't see how I can apply it to this dataset.

So the main question is - how can I get the log2fold change values specific to subgroups, while still having normalised all 40 samples together? Would appreciate any help and/or literature that tackles this.

deseq2 differential-expression

1 answer

res <- results(sub, contrast=c("subgroup", "AX", "BX"))

Does that make sense?

Yes, thanks, that did it! Maybe a quirk, but now I get AX/BX, AY/BY, and AX/BY, but I'm missing AX/AY, for instance. Any ideas as to how to access those?

Edit: running resultsNames(sub) gives me Intercept, subgroup_AX_vs_BY, subgroup_AY_vs_BY, subgroup_AX_vs_BX as names I can use downstream.

It's the same as above. The resultsNames are only relevant if you use coef or name, not contrasts.

Log in to answer this question.