DESeq2 plotCount question
1
0
Entering edit mode
Antonio Ahn ▴ 10
@antonio-ahn-10629
Last seen 2.2 years ago
University of Otago

Hi everyone

I am trying to do the plotCounts function in DESeq2 and have a question on how to plot for a specific gene that i am interested in. 

Wherever i look the codes that is recommended is:

plotCounts(dds, gene=which.min(res$padj), intgroup="dex")

plotCounts(dds, gene="ENSG____", intgroup="dex")

What code would you use to make the plotCounts using the gene symbol instead of looking at the gene with the lowest padj or the ENSG number. 

I already have a "symbol" column with the gene names.

Currently my dds or results table (res) looks something like this: 

 

                                           baseMean log2FoldChange      lfcSE       stat      symbol      entrez
                                   <numeric>      <numeric>  <numeric>  <numeric> <character> <character>
ENSG00000000003 708.60217    -0.37424998 0.09873107 -3.7906000      TSPAN6        7105
ENSG00000000005   0.00000                      NA                NA         NA        TNMD       64102
ENSG00000000419 520.29790     0.20215551 0.10929899  1.8495642        DPM1        8813
ENSG00000000457 237.16304     0.03624826 0.13684258  0.2648902       SCYL3       57147
ENSG00000000460  57.93263    -0.08523371 0.24654402 -0.3457140    C1orf112       55732
 

 

 

 

deseq2 • 1.9k views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 8 hours ago
United States
What happens when you try the ENSG? See the help page ?plotCounts
ADD COMMENT
0
Entering edit mode

Oh I see now... you want to look up with Symbol instead. 

You can provide a character to 'gene', but it has to be the rownames of the DESeqResults object.

You might then think to try setting rownames of the results table to the Symbol, but you will likely encounter an error because the Symbol often contains missing values and repeated values (ENSG is not a 1-1 mapping with Symbol), neither of which are allowed for rownames of a DataFrame. 

Why not look up the ENSG id's for the genes you are interested in as a separate step, then provide these to plotCounts?

ADD REPLY
0
Entering edit mode

Hi Michael. Would you be able to tell me how i can get the ENSG id for the gene of interest in res$symbol ? Sorry i am quite new to R. 

ADD REPLY
0
Entering edit mode

You can use the square bracket and a logical index to get the rowname for the row with a certain Symbol.

I'd recommend you take a short R course (some of these are ~1 hour, some longer). Here are some examples at the top:

http://genomicsclass.github.io/book/pages/resources.html

You can learn a lot and this will help you with basic bioinformatic tasks.

Here's an example of using square bracket to find a particular rowname:

> res <- data.frame(symbol=letters[1:4], row.names=letters[5:8])
> res
  symbol
e      a
f      b
g      c
h      d

> rownames(res)[res$symbol == "b"]
[1] "f"

For doing this many times, you could use the match() function, but this example above should get you started.

ADD REPLY
0
Entering edit mode

Thank you so much for your help! and also for the recommendation of the short R courses. 

 

ADD REPLY

Login before adding your answer.

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