Question: DESeq2 time course experiments: how to make plots for specific genes?
gravatar for CandiceChuDVM
3.3 years ago by
United States/College Station/Texas A&M University
CandiceChuDVM1.9k wrote:

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 • 2.9k views
ADD COMMENTlink modified 3.3 years ago • written 3.3 years ago by CandiceChuDVM1.9k
gravatar for Devon Ryan
3.3 years ago by
Devon Ryan91k
Freiburg, Germany
Devon Ryan91k wrote:

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 COMMENTlink written 3.3 years ago by Devon Ryan91k

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 REPLYlink modified 3.3 years ago • written 3.3 years ago by CandiceChuDVM1.9k

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

ADD REPLYlink written 3.3 years ago by Devon Ryan91k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1504 users visited in the last hour