Remove any rows with 0 count in S4
2
0
Entering edit mode
shintzen • 0
@shintzen-18932
Last seen 5.3 years ago

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?

S4 deseq2 • 725 views
ADD COMMENT
1
Entering edit mode
swbarnes2 ★ 1.3k
@swbarnes2-14086
Last seen 20 minutes ago
San Diego

rowCounts?

I think you want

dds <-dds[rowSums(counts(dds)) > 1,]
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 3 hours ago
United States

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 COMMENT

Login before adding your answer.

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