Question: Change order of conditions when plotting: plotCounts {DESeq2}
0
6 weeks ago by
ecg1g150
ecg1g150 wrote:

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,

deseq2 R plotcounts • 79 views
modified 6 weeks ago • written 6 weeks ago by ecg1g150
Answer: Change order of conditions when plotting: plotCounts {DESeq2}
0
6 weeks ago by
Michael Love24k
United States
Michael Love24k wrote:

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.

Answer: Change order of conditions when plotting: plotCounts {DESeq2}
0
6 weeks ago by
ecg1g150
ecg1g150 wrote:

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

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

Answer: Change order of conditions when plotting: plotCounts {DESeq2}
0
6 weeks ago by
ecg1g150
ecg1g150 wrote:

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

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