How to edit count matrix of a DESeq object?
3
0
Entering edit mode
5.9 years ago
kjkjindal • 0

Hi,

In the counts documentation (https://www.rdocumentation.org/packages/DESeq2/versions/1.12.3/topics/counts) there is a line which implies the count matrix of a deseq object can be edited:

## S4 replacement method for signature 'DESeqDataSet,matrix'
counts(object) <- value

However, when I try this, I get the following error:

Error in (function (classes, fdef, mtable)  : 
unable to find an inherited method for function ‘counts<-’ for signature ‘"DESeqDataSet", "data.frame"’

Does anyone know how to solve this?

P.S. I am using the tximport function of DESeq2, so I can't plug in a custom count matrix, unlike the 'import from Matrix' function.

RNA-Seq sequencing rna-seq • 3.2k views
ADD COMMENT
0
Entering edit mode

Why would you want to edit it as opposed to just modifying your source data and then reading in whatever data you want?

ADD REPLY
0
Entering edit mode
5.9 years ago
BioinfGuru ★ 1.7k

Apart from the documentation, I suggest posting this in Bioconductor.

ADD COMMENT
0
Entering edit mode
5.9 years ago

From the DESeq2 documentation

The argument minReplicatesForReplace is used to decide which samples are eligible for automatic replacement in the case of extreme Cook’s distance. By default, DESeq will replace outliers if the Cook’s distance is large for a sample which has 7 or more replicates (including itself). This replacement is performed by the replaceOutliers function. This default behavior helps to prevent filtering genes based on Cook’s distance when there are many degrees of freedom. See results for more information about filtering using Cook’s distance, and the ’Dealing with outliers’ section of the vignette. Unlike the behavior of replaceOutliers, here original counts are kept in the matrix returned by counts, original Cook’s distances are kept in assays(dds)[["cooks"]], and the replacement counts used for fitting are kept in assays(dds)[["replaceCounts"]].

As you can read it is not about editing the counts by yourself but a DESeq behaviour when you have extreme Cook’s distance.

If minReplicatesForReplace is used by DESeq, you have an option in counts function to use these replaceCounts or not.

ADD COMMENT
0
Entering edit mode
5.9 years ago

try:

counts(object) <- as.matrix(value)

As the error message implies, the function counts does not know how to handle a data.frame, which I'm assuming value is.

ADD COMMENT

Login before adding your answer.

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