Change order of conditions when plotting: plotCounts {DESeq2}
3
0
Entering edit mode
ecg1g15 • 0
@ecg1g15-19970
Last seen 13 months ago

I have a df of 17 variables (my samples) with the condition location which I would like to plot based on a single gene "gene1" When plotting:

library(DeSeq2)
plotCounts(df, "genename", intgroup=c("location"))


By default, the function plots the "conditions" alphabetically on the graph eg: East-Mid-West. But I would like to order them so I can see them on the graph West-Mid-East.

Is there a way of doing this? Thanks,

R deseq2 plotcounts • 837 views
0
Entering edit mode
@mikelove
Last seen 2 hours ago
United States

Take a look at the vignette:

http://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#plot-counts

It gives some code for how to customize this simple plot.

0
Entering edit mode
ecg1g15 • 0
@ecg1g15-19970
Last seen 13 months ago

I have found that you can manually change the order like this:

ddsMat$location <- factor(ddsMat$location, levels=c("West", "Mid", "East"))

0
Entering edit mode
ecg1g15 • 0
@ecg1g15-19970
Last seen 13 months ago

I have found that you can manually change the order like this:

ddsMat$location <- factor(ddsMat$location, levels=c("West", "Mid", "East"))