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?