Question: Conditional modification of counts in the DESeq Data Set
0
gravatar for lech.kaczmarczyk
2.7 years ago by
lech.kaczmarczyk50 wrote:

Hi All,

I know it should be simple but I am really struggling. I want to change zeros to 1s. Here is what I tried so far:

> dds[ counts(dds)[counts(dds) == "0"] <- 1]
Error in validObject(object) : 
  invalid class "DESeqDataSet" object: the count data is not in integer mode
>
> dds[ revalue(as.factor(counts(dds))), c("0"="1") ]
Error: cannot subset by character when rownames are NULL

The count data is in fact integer, so I don't know why the first option fails. For the second, the syntax doesn't seem correct, but it is somehow beyond me to get it right...

deseq2 • 975 views
ADD COMMENTlink modified 2.7 years ago by James Ashmore2.9k • written 2.7 years ago by lech.kaczmarczyk50

I think this is very important to not hack the data. Genes or transcripts not having any expression is fine. Also if the library quality is poor you might end up with not having mRNA abundances for few genes. The best is to check the house keeping genes if they are in line or not or you have ERCC spike-ins you can check them to understand the library quality unless the FASTQC report is not that informative. But simply pushing 0 counts to 1 is not correct. If you want to select for DE with genes above a certain threshold then that is a different thing. But why do you intend to replace all 0 values to 1. This will change the distribution of your genes across samples and also across conditions.

ADD REPLYlink written 2.7 years ago by ivivek_ngs4.9k

Yes, I couldn't agree more. I needed that only to prove something...

ADD REPLYlink written 2.7 years ago by lech.kaczmarczyk50
1
gravatar for James Ashmore
2.7 years ago by
James Ashmore2.9k
UK/Edinburgh/MRC Centre for Regenerative Medicine
James Ashmore2.9k wrote:

I'm not sure why you'd want to replace zero values, but you can do it this way:

assay(dds)[assay(dds) == 0] <- 1
ADD COMMENTlink modified 2.7 years ago • written 2.7 years ago by James Ashmore2.9k
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: 2247 users visited in the last hour