Greetings,
Our set up is comprised of 4 comparisons (using Contrast). Our Counts table contains 20 samples (columns), which we normalized as a whole. We loop through the various Contrast options to build up graphs, results and so forth.
When preparing DESeq2 results, we typically merge the counts data back the DE results, something like:
resdata <- merge(as.data.frame(results), as.data.frame(counts(dds, normalized=TRUE)), by="row.names", sort=FALSE)
For any particular contrast, we are only interested in the samples being contrasted/tested. Hence, we don't need to have all 20 columns of counts attached to the results. The above code snippet will merge all 20 samples back onto a results, that effectively tested 3 vs 3 samples (6, in total, not 20).
Is there a way, via DESeq2 (or otherwise) to create a new dataframe for those samples that are being tested in the contrast the results are relevant to? It's easier to interpret the output for the end-user, and it provides the ability to also filter out low/bad count data, using the rowSums approach (which we don't want to do on 20 samples as a whole).
Cheers,
JP
It looks like you solved your own question :)