unable to find an inherited method for function counts for signature DESeqTransform
1
0
Entering edit mode
@casper-peters-14190
Last seen 18 months ago
Finland

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!

deseq2 counts DESeqtransform variance deviation • 7.2k views
ADD COMMENT
0
Entering edit mode

I already tried validating my install with

biocValid(), my session is valid.

ADD REPLY
0
Entering edit mode
@mikelove
Last seen 5 days ago
United States

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 COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

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