PlotCounts DESeq2 - how to plot count s for specific samples?
1
0
Entering edit mode
@e7994b78
Last seen 21 months ago
Norway

I am trying to plot counts only for wildtype and one of three mutant conditions but I don't know how to access these values form dds. My colData looks like this:

>  samples condition batch
1    C10_1       C10   b_1
2    C10_2       C10   b_2
3    C10_3       C10   b_3
4     C3_1        C3   b_1
5     C3_2        C3   b_2
6     C3_3        C3   b_3
7     C6_1        C6   b_1
8     C6_2        C6   b_2
9     C6_3        C6   b_3
10    WT_1        WT   b_1
11    WT_2        WT   b_2
12    WT_3        WT   b_3

Could someone help me on how to only plot counts for C3 samples and WT samples?

DESeq2 PlotCounts • 2.1k views
ADD COMMENT
0
Entering edit mode
Basti ▴ 780
@7d45153c
Last seen 2 days ago
France

You can use counts(dds,normalized = TRUE) to access to normalized counts. What do you want to plot precisely ? A single gene, multiple genes ?

ADD COMMENT
0
Entering edit mode

I woudl like to make several plots for some genes (one plot per gene) but only for samples C3_1, C3_2, C3_3 and WT_1, WT_2, WT_3. My problem is how to access the specific samples, now I am using:

    Counts <- plotCounts(dds, gene="ARHGAP21", intgroup="condition", returnData=TRUE)
colourPallette <- c("#7145cd","#bbcfc4","#90de4a","#cd46c1","#77dd8e", "#463d25")
p <- ggplot(Counts, aes(x=condition, y=count, colour = condition)) + lims(y = c(0, 2)) + geom_point() + theme_bw() + theme(axis.text.x=element_text(angle=15, hjust=1)) + scale_colour_manual(values=colourPallette) + guides(colour=guide_legend(ncol=3)) + ggtitle("ARHGAP21")
p <- p  + ylab("expression counts") 
p

And what I get is a plot for each condition (WT, C3, C6 and C10).

ADD REPLY
0
Entering edit mode

You need to filter the samples you want to keep before creating the ggplot

ADD REPLY
0
Entering edit mode

I am not sure how to access the samples form dds, could you please explain how to filter? edit: I found out :)

Counts <- plotCounts(dds[, c(4:6,10:12)], gene, intgroup="samples", returnData=TRUE)
colourPallette <- c("#7145cd","#bbcfc4")
p <- ggplot(Counts, aes(x=samples, y=count)) + geom_point() + lims(y = c(0, 2))  + theme_bw() + theme(axis.text.x=element_text(angle=15, hjust=1)) + scale_colour_manual(values=colourPallette) + guides(colour=guide_legend(ncol=3)) + ggtitle("gene name")
p <- p  + ylab("expression counts") 
p
ADD REPLY
1
Entering edit mode

I would create a dds.sub object by selecting the columns of interest :

dds.sub = dds[,colData$samples[which(colData$condition %in% c("C3","WT")]]
Counts <- plotCounts(dds.sub, gene="ARHGAP21", intgroup="condition", returnData=TRUE)
ADD REPLY
0
Entering edit mode

thank you!

ADD REPLY

Login before adding your answer.

Traffic: 894 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6