Change order of conditions when plotting: plotCounts {DESeq2}
3
0
Entering edit mode
ecg1g15 ▴ 30
@ecg1g15-19970
Last seen 4.0 years 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,

IMAGEhere

R deseq2 plotcounts • 2.3k views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 3 days 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.

ADD COMMENT
0
Entering edit mode
ecg1g15 ▴ 30
@ecg1g15-19970
Last seen 4.0 years ago

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

ddsMat$location <- factor(ddsMat$location, levels=c("West", "Mid", "East"))
ADD COMMENT
0
Entering edit mode
ecg1g15 ▴ 30
@ecg1g15-19970
Last seen 4.0 years ago

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

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

Login before adding your answer.

Traffic: 302 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