Question: unable to find an inherited method for function counts for signature DESeqTransform
0
gravatar for Casper Peters
20 months ago by
Kampen, Netherlands
Casper Peters0 wrote:

I have a problem in regards to making a variance plot from our data. I tried to use a code snippet from here (Effects of transformations on the variance): https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html

 

when trying the code snippet;

# this gives log2(n + 1)
ntd <- normTransform(dds)
library("vsn")
notAllZero <- (rowSums(counts(dds))>0)
meanSdPlot(assay(ntd)[notAllZero,])

 

The counts function returns the error;

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘counts’ for signature ‘"DESeqTransform"’

This is my sessioninfo and traceback;

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Netherlands.1252  LC_CTYPE=English_Netherlands.1252    LC_MONETARY=English_Netherlands.1252 LC_NUMERIC=C                        
[5] LC_TIME=English_Netherlands.1252    

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] BiocInstaller_1.26.1       vsn_3.44.0                 DESeq2_1.16.1              SummarizedExperiment_1.6.5 DelayedArray_0.2.7        
 [6] matrixStats_0.52.2         Biobase_2.36.2             GenomicRanges_1.28.6       GenomeInfoDb_1.12.3        IRanges_2.10.5            
[11] S4Vectors_0.14.7           BiocGenerics_0.22.1        RColorBrewer_1.1-2        

loaded via a namespace (and not attached):
Error in x[["Version"]] : subscript out of bounds
In addition: Warning message:
In FUN(X[[i]], ...) :
  DESCRIPTION file of package 'backports' is missing or broken
> traceback()
7: FUN(X[[i]], ...)
6: lapply(X = X, FUN = FUN, ...)
5: sapply(L[[n]], function(x) x[["Version"]])
4: mkLabel(x, "loadedOnly")
3: print(mkLabel(x, "loadedOnly"), quote = FALSE, ...)
2: print.sessionInfo(x)
1: function (x, ...) 
   UseMethod("print")(x)

 

I have no idea what I'm doing wrong.

Thanks in advance for anyone replying to this!

ADD COMMENTlink modified 20 months ago by Michael Love24k • written 20 months ago by Casper Peters0

I already tried validating my install with

biocValid(), my session is valid.

ADD REPLYlink written 20 months ago by Casper Peters0
Answer: unable to find an inherited method for function counts for signature DESeqTransf
0
gravatar for Michael Love
20 months ago by
Michael Love24k
United States
Michael Love24k wrote:

What is class(dds)? The counts() method is only defined for DESeqDataSet. You may have overwritten dds with an object of a different class.

ADD COMMENTlink written 20 months ago by Michael Love24k

Running the class and typeof command returns the following (my variable has a different name);

 

> class(cds)
[1] "DESeqDataSet"
attr(,"package")
[1] "DESeq2"
> typeof(cds)
[1] "S4"

So, seeing the output, I don't think I have a wrong object that I'm putting in.

However, looking at ntd (nds in my case) it returns a DESeqtransform object.

 

> typeof(nds)
[1] "S4"
> class(nds)
[1] "DESeqTransform"
attr(,"package")
[1] "DESeq2"

 

Might this have to do with the error? If so, then the example in the doc is just plain wrong.

Edit1: code runs if I directly put in my cds (dds), so normalizing it will change the class type and cause counts to return an error.

ADD REPLYlink modified 20 months ago • written 20 months ago by Casper Peters0

In your first post you said you called counts() on dds:

notAllZero <- (rowSums(counts(dds))>0)

This code should not give an error. 

Maybe you got an error calling counts() on a DESeqTransform object? These objects don't contain counts. It contains transformed counts. The way to get out the transformed counts is using assay().

The docs (workflows and vignettes) are checked nightly and would throw an error if there were a problem, and then you wouldn't see the broken version, but an older version. Generally, if you see code in an evaluated chunk in a workflow or vignette, it should run without error on your end, given the same version of packages.

 

ADD REPLYlink written 20 months ago by Michael Love24k

Maybe you got an error calling counts() on a DESeqTransform object?

This. I didn't see I used the wrong variable there. We have a saying in dutch; "I can't see the forest through all the trees." We use it when we're being too short-sighted / get confused because of clusterfucks (like my code.)

 

For anybody else ever having the same problem; double check that you put the correct object in the correct function.

ADD REPLYlink written 20 months ago by Casper Peters0
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 16.09
Traffic: 196 users visited in the last hour