nmf function not working
1
0
Entering edit mode
@aslammohammed398-16400
Last seen 6.5 years ago
When I use identifySignatures from somaticsignatures package it throws me out this error. What do I need to change ?
identifySignatures(sca_mm,5,nmfDecomposition)
Error in (new("standardGeneric", .Data = function (x)  : 
  unused arguments (model = list("NMFstd", 5, 0), method = "random")
somaticsignatures NMF • 3.5k views
ADD COMMENT
0
Entering edit mode

Please read the posting guide and provide the required details.

ADD REPLY
0
Entering edit mode

Hi, Aslam

I have encountered an exactly same problem. My code was working but I recently updated NMF packages (following biocLite suggestion). Then, when I ran the command, I had the error:

sigs_nmf = identifySignatures(sca_mm, n_sigs, nmfDecomposition)
Error in (new("standardGeneric", .Data = function (x)  : 
  unused arguments (model = list("NMFstd", 5, 0), method = "random")

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Version of pacakges:

NMF_0.21.0

SomaticSignatures_2.16.0

VariantAnnotation_1.26.1 

ADD REPLY
0
Entering edit mode

Thank you for the report. I have not been able to reproduce this issue with the same package versions as you have. Could you please post a complete example that I can rerun (from the starting of the R session until the error occurs) together with a complete output of the sessionInfo command?

ADD REPLY
0
Entering edit mode
Xin • 0
@xin-18254
Last seen 6.1 years ago

Hi Aslam,

I guess there should be some unknown library conflicts. Detaching and reloading NMF package may work.

ADD COMMENT
0
Entering edit mode

There is an incompatibility here between NMF and SumarizedExperiment. If I start R without attaching any packages and run

library(NMF)

m = matrix(runif(100),nrow=10)
rank = 10

res = nmf(m,rank)

This runs fine and gives me an object of class NMF fit as expected. However, if I start up R without attaching anything and run

library(NMF)
library(SummarizedExperiment)

m = matrix(runif(100),nrow=10)
rank = 10

res = nmf(m,rank)

This reproduces the error:

Error in (new("standardGeneric", .Data = function (x)  : 
  unused arguments (model = list("NMFstd", 10, 0), method = "random")

For completeness, I am appending my sessionInfo():

R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_GB.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_GB.utf8        LC_COLLATE=en_GB.utf8    
 [5] LC_MONETARY=en_GB.utf8    LC_MESSAGES=en_GB.utf8   
 [7] LC_PAPER=en_GB.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C      

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

other attached packages:
 [1] SummarizedExperiment_1.14.0 DelayedArray_0.10.0        
 [3] BiocParallel_1.18.0         matrixStats_0.54.0         
 [5] GenomicRanges_1.36.0        GenomeInfoDb_1.20.0        
 [7] IRanges_2.18.1              S4Vectors_0.22.0           
 [9] NMF_0.21.0                  Biobase_2.44.0             
[11] BiocGenerics_0.30.0         cluster_2.0.8              
[13] rngtools_1.4                pkgmaker_0.27              
[15] registry_0.5-1             

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1             XVector_0.24.0         compiler_3.6.0        
 [4] pillar_1.4.2           RColorBrewer_1.1-2     plyr_1.8.4            
 [7] zlibbioc_1.30.0        bitops_1.0-6           iterators_1.0.10      
[10] tools_3.6.0            digest_0.6.19          lattice_0.20-38       
[13] tibble_2.1.3           gtable_0.3.0           gridBase_0.4-7        
[16] pkgconfig_2.0.2        rlang_0.4.0            Matrix_1.2-17         
[19] foreach_1.4.4          bibtex_0.4.2           GenomeInfoDbData_1.2.1
[22] withr_2.1.2            stringr_1.4.0          grid_3.6.0            
[25] ggplot2_3.2.0          reshape2_1.4.3         magrittr_1.5          
[28] scales_1.0.0           codetools_0.2-16       xtable_1.8-4          
[31] colorspace_1.4-1       stringi_1.4.3          RCurl_1.95-4.12       
[34] lazyeval_0.2.2         doParallel_1.0.14      munsell_0.5.0         
[37] crayon_1.3.4
ADD REPLY
0
Entering edit mode

Both NMF and SummarizedExperiment (through a package it Depends: on, DelayedArray) have implemented a seed generic. Usually a package can be confident that, when it references functions defined in it's own package, it gets only those functions. Here we have

> nmf(m, rank)
Error in (new("standardGeneric", .Data = function (x)  :
  unused arguments (model = list("NMFstd", 10, 0), method = "random")
> traceback()
11: do.call(getGeneric("seed"), c(list(x = x, model = init, method = seed.method),
        parameters.seed))
10: .local(x, rank, method, ...)
9: nmf(x, rank, method = strategy, ...)
8: nmf(x, rank, method = strategy, ...)
7: nmf(x, rank, method, seed = seed, model = model, ...)
6: nmf(x, rank, method, seed = seed, model = model, ...)
5: .local(x, rank, method, ...)
4: nmf(x, rank, NULL, ...)
3: nmf(x, rank, NULL, ...)
2: nmf(m, rank)
1: nmf(m, rank)

Note the getGeneric() call that causes the problem -- it does not have a package= argument, and appears to use the search() path to find the generic. Since SummarizedExperiment was loaded after NMF, it finds the wrong generic.

I think this is a bug in the NMF implementation, and will try to contact the maintainer.

A work-around, which may not be satisfactory if you also want to use DelayedArray::seed(), is to use the new function conflictRules() defined in base R to exclude DelayedArray::seed() from being seen.

conflictRules("DelayedArray", exclude = "seed")
library(NMF)
library(SummarizedExperiment)

UPDATE This issue had already been reported to NMF, and is fixed in the devel version of the package. You can install the devel version of the package with

BiocManager::install("renozao/NMF", ref = "devel")
ADD REPLY

Login before adding your answer.

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