Question: DESeq2 time course experiments: how to make plots for specific genes?
1
gravatar for CandiceChuDVM
2.9 years ago by
CandiceChuDVM1.8k
United States/College Station/Texas A&M University
CandiceChuDVM1.8k 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.6k views
ADD COMMENTlink modified 2.9 years ago • written 2.9 years ago by CandiceChuDVM1.8k
2
gravatar for Devon Ryan
2.9 years ago by
Devon Ryan88k
Freiburg, Germany
Devon Ryan88k 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 2.9 years ago by Devon Ryan88k

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 2.9 years ago • written 2.9 years ago by CandiceChuDVM1.8k
1

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

ADD REPLYlink written 2.9 years ago by Devon Ryan88k
Please log in to add an answer.

Help
Access

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