DESeq2 time course experiments: how to make plots for specific genes?
1
1
Entering edit mode
8.0 years ago
CandiceChuDVM ★ 2.4k

Hi all,

I am new to R but I am analyzing my RNA-Seq data with DESeq2. I managed to use plotCounts to generate a plot for a gene with the smallest adjusted p-value (which.min(resTC$padj)) by following the instruction.

However, I don't know how to make plots for other genes which also have small adjusted p-values. I tried both gene_id and which(resTC$padj)<0.05 but they won't work (please see comment for my error messages)

This is the only plot that I can make:
enter image description here

Here is my data constuction:

sampleFiles <- grep("count",list.files(directory),value=TRUE) 
condition <- factor(c(rep("control",2), rep("rapid",3), rep("slow",3),
                  rep("control",2), rep("rapid",3), rep("slow",3),
                  rep("control",2), rep("rapid",3), rep("slow",3)))
timepoints <- factor(c(rep("t1",8), rep("t2",8), rep("t3",8)))
sampleTable <- data.frame(condition = as.factor(condition),
                      timepoints = as.factor(timepoints))
d.deseq<-DESeqDataSetFromMatrix(countData = countdata,
                            colData = sampleTable,
                            design = ~condition+timepoints+condition:timepoints)
ddsTC$condition <- relevel(ddsTC$condition, ref="control")
ddsTC<-DESeq(d.deseq, test="LRT", reduced = ~ condition+timepoints)
resTC<-results(ddsTC, alpha = 0.05)
resTCOrdered <- resTC[order(resTC$padj),]

Here is how I make the plot. I only know how to use which.min(resTC$padj) :

data<-plotCounts(ddsTC, which.min(resTC$padj),intgroup = c("timepoints","condition"), returnData = TRUE)
ggplot(data, mapping = aes(x=timepoints, y=count, color=condition,     group=condition))+geom_point()+stat_smooth(se=F, method="loess")+scale_y_log10()
RNA-Seq deseq2 r • 5.3k views
ADD COMMENT
2
Entering edit mode
8.0 years ago

Instead of which.min(resTC$padj), specify a gene ID. You get these with something like row.names(resTC)[which(resTC$padj)<0.05] (or 0.1, or whatever significance threshold you want to use).

ADD COMMENT
0
Entering edit mode

Hi Devon,

Thank you for your response. When tried row.names(resTC)[which(resTC$padj)<0.05], R warned me that Error in which(resTC$padj) : argument to 'which' is not logical.

However, when I change the position of < and tried which(resTC$padj<0.05)], it worked.

Also, I can use which(resSig$hgnc_symbol=="SLC22A13") to check specific genes. Thanks!

ADD REPLY
1
Entering edit mode

Oops, you found my typo :P I see you figured it out, though :)

ADD REPLY

Login before adding your answer.

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