Question: How to edit count matrix of a DESeq object?
0
gravatar for kjkjindal
10 months ago by
kjkjindal0
kjkjindal0 wrote:

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.

sequencing rna-seq • 582 views
ADD COMMENTlink modified 10 months ago by Friederike3.3k • written 10 months ago by kjkjindal0

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

ADD REPLYlink modified 10 months ago • written 10 months ago by Kevin Blighe39k
0
gravatar for YaGalbi
10 months ago by
YaGalbi1.4k
Biocomputing, MRC Harwell Institute, Oxford, UK
YaGalbi1.4k wrote:

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

ADD COMMENTlink modified 10 months ago • written 10 months ago by YaGalbi1.4k
0
gravatar for Bastien Hervé
10 months ago by
Bastien Hervé3.7k
Limoges, CBRS, France
Bastien Hervé3.7k wrote:

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 COMMENTlink modified 10 months ago • written 10 months ago by Bastien Hervé3.7k
0
gravatar for Friederike
10 months ago by
Friederike3.3k
United States
Friederike3.3k wrote:

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 COMMENTlink modified 10 months ago • written 10 months ago by Friederike3.3k
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 2.3.0
Traffic: 1121 users visited in the last hour