How to plot gene counts using plotCounts() with just an individual contrast?
1
0
Entering edit mode
@97dfc144
Last seen 27 days ago
United States

Hello, I am working with a bulk RNA-seq dataset that I am analyzing using DESeq2. This dataset has 3 treatment groups (I, II, III), and 2 genotypes (A, B). I'm mainly looking at the differences between the 2 genotypes under each treatment (eg using 3 contrasts for I_A vs I_B, II_A vs II_B, and III_A vs III_B).

I would like to use plotCounts() to plot the gene counts of a single gene, comparing the counts between the 2 genotypes, but for one contrast. Is there a way to do this without making a separate dds object?

I know I can use the following code to plot the gene counts between genotypes, but it would include samples from all treatments:

plotCounts(dds, gene="gene", intgroup="genotype")


I know I can look at gene counts of a single contrast by making a separate dds object with just the samples from one contrast (eg one with samples just looking at treatment I), but I wanted to know if there was a way to do that without making separate dds objects. I wasn't sure since when making contrasts, it produces a DESeqResults object rather than DESeqDataSet. Thank you!

DESeq2 plotCounts • 99 views
0
Entering edit mode
swbarnes2 ▴ 780
@swbarnes2-14086
Last seen 42 minutes ago
San Diego

If I remember right, plotCounts makes a simple data frame that contains the expression values for the gene you request, and the colData you request. Can't you just edit the content of the plotcounts object to omit the samples you don't want?

0
Entering edit mode

Yes, from ?plotCounts:

returnData - should the function only return the data.frame of counts and covariates for custom plotting (default is FALSE)