Question: Remove any rows with 0 count in S4
0
gravatar for shintzen
8 months ago by
shintzen0
shintzen0 wrote:

I have run

>dds <- DESeqDataSet(se, design = ~ Cal+ Cal:Time + Cal:Cell + Time + Time:Cell + Cell)

And dds has some rows with 0 and NAs which is causing issues when I try to take the log2 fold changes

>idx.numerator = which(sampleTable$Cell=="4" & sampleTable$Time=="24" & sampleTable$Cal=="y")
idx.denominator = which(sampleTable$Cell=="4" & sampleTable$Time=="24" & sampleTable$Cal=="n")
assay(dds)[,idx.numerator]
c1_l2fc =  log2(foldchange(assay(dds)[,idx.numerator], assay(dds)[,idx.denominator]))

I have removed the NAs c1l2fc <- c1l2fc[!is.na(c1_l2fc)]

but I still had 0's which makes some of my values come out as Inf

>sum(c1_l2fc, na.rm=TRUE)
[1] Inf

I had thought that maybe I should just remove those rows but I haven't been able to succeed. I tried:

> dds <- dds[ rowCounts(counts(dds)) > 1 ]

But that got rid of all the rows so I tried:

> dds <- dds[apply(dds[, -1], MARGIN = 1, function(x) all(x > 10)), ]

which doesn't work because dds is S4. What suggestions do you have for this?

deseq2 s4 • 153 views
ADD COMMENTlink modified 8 months ago by swbarnes2330 • written 8 months ago by shintzen0
Answer: Remove any rows with 0 count in S4
1
gravatar for swbarnes2
8 months ago by
swbarnes2330
swbarnes2330 wrote:

rowCounts?

I think you want

dds <-dds[rowSums(counts(dds)) > 1,]
ADD COMMENTlink written 8 months ago by swbarnes2330
Answer: Remove any rows with 0 count in S4
0
gravatar for Michael Love
8 months ago by
Michael Love25k
United States
Michael Love25k wrote:

foldchange is not a function in DESeq2, so I'm not responsible for the NA's you are generating.

Why don't you use results or lfcShrink instead?

ADD COMMENTlink written 8 months ago by Michael Love25k
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 16.09
Traffic: 241 users visited in the last hour