Upon analysing my RIPseq data with DESeq2, I noticed I had a large number of genes for which the fold change was read as "NA". This is because many of the genes have no reads in them. I wanted to change all the reads in my DESeqDataSet with a value of "0" to a value of "1" in order to avoid divide-by-zero errors resulting in "NA" fold changes. I thought it would work something like this:
But that gives me this error, probably because DESeqDataSets can't be indexed like normal data frames:
The help file on SummarizedExperiment instances (of which DESeqDataSet is a subtype) says this:
My problem is that I don't really understand what that means. I thought I should do something like this:
But that doesn't work either. I also tried extracting the counts with the assay function and then changing them inside the matrix:
But then I couldn't figure out how to get the new matrix back into the DESeqDataSet object.
Can anyone help me with this?
Code:
Trimmed_BIP_dds[Trimmed_BIP_dds$assay == 0] <- 1
Code:
Error in Trimmed_BIP_dds[Trimmed_BIP_dds$assay == 0] <- 1 : object of type 'S4' is not subsettable
x[i,j], x[i,j] <- value:
Create or replace a subset of x. i, j can be numeric, logical, character, or missing. value must be a SummarizedExperiment instance with dimensions, dimension names, and assay elements consistent with the subset x[i,j] being replaced.
Create or replace a subset of x. i, j can be numeric, logical, character, or missing. value must be a SummarizedExperiment instance with dimensions, dimension names, and assay elements consistent with the subset x[i,j] being replaced.
Code:
Trimmed_BIP_dds$assay[==0] <-1
Code:
Trimmed_BIP_matrix <- assay(Trimmed_BIP_dds) Trimmed_BIP_matrix[Trimmed_BIP_matrix == 0] <- 1
Can anyone help me with this?
Comment