Question: Problem reproducing PCA plot in DeSeq2 totuorial
gravatar for sarahmacdonald86
22 months ago by
sarahmacdonald860 wrote:


I am following the Differential analysis of count data – the DESeq2 package vignette which is great, however when I come to and can produce heatmaps, however when i try a PCA plot i get the following error.

plotPCA(rld, intgroup=c("LesionScore", "Treatment")

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

My data has been input as a matrix following the phyloseq DeSeq2 tutorial

I have found this link where someone has the same problem, however I tried the suggested fix and this didnt work for me

I have been using a mixture of install.packages() and biocLite(), do I need to go through and install all packages using bioLite()?





ADD COMMENTlink modified 22 months ago • written 22 months ago by sarahmacdonald860

Hi James,

I tried this and simply get this:

[1] TRUE




ADD REPLYlink written 22 months ago by sarahmacdonald860

To add comments, please click the ADD COMMENT button and use the box that pops up, rather than the 'Add your answer' box below.

What is the output from sessionInfo()?

ADD REPLYlink written 22 months ago by James W. MacDonald48k

Sorry yes, better to add comment.

> sessionInfo()

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12

[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

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

other packages:
 [1] vsn_3.42.3                 BiocInstaller_1.24.0      
 [3] RColorBrewer_1.1-2         pheatmap_1.0.8            
 [5] plyr_1.8.4                 DESeq_1.26.0              
 [7] lattice_0.20-34            locfit_1.5-9.1            
 [9] DESeq2_1.14.1              SummarizedExperiment_1.4.0
[11] Biobase_2.34.0             GenomicRanges_1.26.2      
[13] GenomeInfoDb_1.10.2        IRanges_2.8.1             
[15] S4Vectors_0.12.1           BiocGenerics_0.20.0       
[17] devtools_1.12.0            ggplot2_2.2.1             
[19] phyloseq_1.19.1           

loaded via a namespace (and not attached):
 [1] jsonlite_1.2          splines_3.3.2         foreach_1.4.3        
 [4] Formula_1.2-1         assertthat_0.1        affy_1.52.0          
 [7] latticeExtra_0.6-28   RSQLite_1.1-2         backports_1.0.4      
[10] limma_3.30.7          digest_0.6.11         XVector_0.14.0       
[13] checkmate_1.8.2       colorspace_1.3-2      preprocessCore_1.36.0
[16] htmltools_0.3.5       Matrix_1.2-7.1        XML_3.98-1.5         
[19] genefilter_1.56.0     zlibbioc_1.20.0       xtable_1.8-2         
[22] scales_0.4.1          affyio_1.44.0         BiocParallel_1.8.1   
[25] htmlTable_1.8         tibble_1.2            annotate_1.52.1      
[28] mgcv_1.8-16           withr_1.0.2           nnet_7.3-12          
[31] lazyeval_0.2.0        survival_2.40-1       magrittr_1.5         
[34] memoise_1.0.0         nlme_3.1-128          MASS_7.3-45          
[37] foreign_0.8-67        vegan_2.4-1           tools_3.3.2          
[40] data.table_1.10.0     stringr_1.1.0         munsell_0.4.3        
[43] cluster_2.0.5         AnnotationDbi_1.36.0  Biostrings_2.42.1    
[46] ade4_1.7-5            rhdf5_2.18.0          grid_3.3.2           
[49] RCurl_1.95-4.8        iterators_1.0.8       biomformat_1.2.0     
[52] igraph_1.0.1          labeling_0.3          bitops_1.0-6         
[55] base64enc_0.1-3       gtable_0.2.0          codetools_0.2-15     
[58] multtest_2.30.0       DBI_0.5-1             reshape2_1.4.2       
[61] gridExtra_2.2.1       knitr_1.15.1          Hmisc_4.0-2          
[64] permute_0.9-4         ape_4.0               stringi_1.1.2        
[67] Rcpp_0.12.8           geneplotter_1.52.0    rpart_4.1-10         
[70] acepack_1.4.1 

ADD REPLYlink written 22 months ago by sarahmacdonald860
gravatar for James W. MacDonald
22 months ago by
United States
James W. MacDonald48k wrote:

You can check your installation by doing



And following the instructions that pop up.


ADD COMMENTlink written 22 months ago by James W. MacDonald48k

I'd guess that you have another package loaded which is masking plotPCA, by not using the generic in BiocGenerics. There are a set of packages that "play by the rules" allowing for proper dispatch, but others may mask it. The user can get around this in the end by using DESeq2::plotPCA.

ADD REPLYlink written 22 months ago by Michael Love20k

Hi Michael,

Yes this seemed to be the problem, loaded a new session with only the packages I needed and this worked.

Thanks everyone. 

ADD REPLYlink written 22 months ago by sarahmacdonald860

Ha! it seems Jim is the offender!

I wouldn't have written the comment above in such a pedantic way if I knew it was you :)

ADD REPLYlink written 22 months ago by Michael Love20k

Urgh. Is this the part where I wave my cane and tell you damn kids to get off my lawn?

I'll change my version of the function to S4 to lower my OQ (offender quotient) to a lower but probably still offensive level. ;-D

ADD REPLYlink written 22 months ago by James W. MacDonald48k

So one of the reasons I never converted plotPCA in affycoretools to S4 was because I felt I would be hijacking the method for ExpressionSets. I'm not sure what happens if two packages get loaded with the same methods dispatching on the same signature, but I've made the changes so DESeq2 and affycoretools no longer clash.

> library(affycoretools)
> library(DESeq2)
> plotPCA
nonstandardGenericFunction for "plotPCA" defined from package "BiocGenerics"

function (object, ...)
<environment: 0x1c57e70>
Methods may be defined for arguments: object
Use  showMethods("plotPCA")  for currently available ones.
> showMethods(plotPCA)
Function: plotPCA (package BiocGenerics)
ADD REPLYlink written 22 months ago by James W. MacDonald48k
Awesome! Thanks, sorry for the hassle
ADD REPLYlink written 22 months ago by Michael Love20k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 423 users visited in the last hour