Skip to content

Error in getClassDef(x@superClass, package = packageSlot(x))@virtual : no applicable method for @ applied to an object of class "NULL" #184

Open

Description

@nfancy

Hi,

Thanks for this package, I am getting this error with the MAST::zlm function. I am scratching my head and can't find a solution. Any pointer is hugely appreciated.

>   zlmCond <- MAST::zlm(
     formula = model_formula,
     sca = sca,
     exprs_value = 'logcounts',
     method = "glmer", # note: glmer requires a random effects var
     ebayes = F,
     parallel = F,
     fitArgsD = list(nAGQ = 0)
   )
Error in getClassDef(x@superClass, package = packageSlot(x))@virtual : 
  no applicable method for `@` applied to an object of class "NULL"
> traceback()
22: isVirtualExt(exti)
21: FUN(X[[i]], ...)
20: vapply(ext, F, NA, USE.NAMES = FALSE)
19: .selectSuperClasses(list(dsyMatrix = new("SClassExtension", subClass = structure("dpoMatrix", package = "Matrix"), 
        superClass = structure("dsyMatrix", package = "Matrix"), 
        package = "Matrix", coerce = function (from, strict = TRUE) 
        {
            class(from) <- "dsyMatrix"
            from
        }, test = function (object) 
        TRUE, replace = function (from, to, value) 
        {
            for (what in c("Dim", "Dimnames", "x", "uplo", "factors"
            )) slot(from, what) <- slot(value, what)
            from
        }, simple = TRUE, by = character(0), dataPart = FALSE, distance = 1), 
        unpackedMatrix = new("SClassExtension", subClass = structure("dpoMatrix", package = "Matrix"), 
            superClass = structure("unpackedMatrix", package = "Matrix"), 
            package = "Matrix", coerce = function (from, strict = TRUE) 
            {
                from <- {
                    class(from) <- "dsyMatrix"
                    from
     ...
18: diag(from, names = FALSE)
17: diag(from, names = FALSE)
16: asMethod(object)
15: as(rr, "corMatrix")
14: vcov.merMod(object@fitC)
13: vcov(object@fitC)
12: vcov(object@fitC)
11: .local(object, ...)
10: vcov(object, "C")
9: vcov(object, "C")
8: withCallingHandlers(expr, warning = function(w) {
       if (str_detect(conditionMessage(w), regexp)) 
           invokeRestart("muffleWarning")
   })
7: hushWarning(list(coefC = coef(object, which = "C"), vcovC = vcov(object, 
       "C"), deviance = rowm(deviance(object@fitC), deviance(object@fitD)), 
       df.null = rowm(nobs(object@fitC), nobs(object@fitD)), dispersion = rowm(sigma(object@fitC), 
           NA), coefD = coef(object, which = "D"), vcovD = vcov(object, 
           "D"), loglik = torowm(logLik(object)), converged = torowm(object@fitted)), 
       "nobs")
6: summarize(obj)
5: summarize(obj)
4: FUN(X[[i]], ...)
3: lapply(listEE, .fitGeneSet)
2: lapply(listEE, .fitGeneSet)
1: MAST::zlm(formula = model_formula, sca = sca, exprs_value = "logcounts", 
       method = fargs$mast_method, ebayes = fargs$ebayes, parallel = fargs$parallel, 
       fitArgsD = fit_args_D)
> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
[1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8       
[4] LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
[7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/London
tzcode source: system (glibc)

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

other attached packages:
[1] data.table_1.14.8           MAST_1.27.1                 Matrix_1.6-5               
[4] SummarizedExperiment_1.32.0 SingleCellExperiment_1.24.0 IRanges_2.36.0             
[7] GenomicRanges_1.54.1        S4Vectors_0.40.1           

loaded via a namespace (and not attached):
 [1] R.methodsS3_1.8.2             progress_1.2.2                DirichletReg_0.7-1           
 [4] DT_0.30                       goftest_1.2-3                 Biostrings_2.70.1            
 [7] HDF5Array_1.30.0              vctrs_0.6.4                   spatstat.random_3.2-1        
[10] RApiSerialize_0.1.2           digest_0.6.33                 png_0.1-8                    
[13] ggrepel_0.9.4                 deldir_1.0-9                  parallelly_1.36.0            
[16] MASS_7.3-60                   reshape2_1.4.4                httpuv_1.6.12                
[19] foreach_1.5.2                 BiocGenerics_0.48.0           xfun_0.41                    
[22] ggfun_0.1.3                   ggpubr_0.6.0                  ellipsis_0.3.2               
[25] survival_3.5-7                doRNG_1.8.6                   memoise_2.0.1                
[28] ggbeeswarm_0.7.2              systemfonts_1.0.5             tidytree_0.4.5               
[31] zoo_1.8-12                    pbapply_1.7-2                 R.oo_1.25.0                  
[34] Formula_1.2-5                 prettyunits_1.2.0             rematch2_2.1.2               
[37] KEGGREST_1.42.0               promises_1.2.1                httr_1.4.7                   
[40] rstatix_0.7.2                 globals_0.16.2                fitdistrplus_1.1-11          
[43] rhdf5filters_1.14.0           stringfish_0.15.8             rhdf5_2.46.0                 
[46] rstudioapi_0.15.0             miniUI_0.1.1.1                generics_0.1.3               
[49] base64enc_0.1-3               babelgene_22.9                curl_5.1.0                   
[52] zlibbioc_1.48.0               ScaledMatrix_1.10.0           polyclip_1.10-6              
[55] GenomeInfoDbData_1.2.11       ExperimentHub_2.10.0          SparseArray_1.2.0            
[58] threejs_0.3.3                 interactiveDisplayBase_1.40.0 xtable_1.8-4                 
[61] stringr_1.5.0                 doParallel_1.0.17             evaluate_0.23                
[64] S4Arrays_1.2.0                BiocFileCache_2.10.1          preprocessCore_1.64.0        
[67] hms_1.1.3                     irlba_2.3.5.1                 qs_0.25.5                    
[70] colorspace_2.1-0              filelock_1.0.2                hdf5r_1.3.8                  
[73] apcluster_1.4.11              ROCR_1.0-11                   reticulate_1.34.0            
[76] spatstat.data_3.0-3           magrittr_2.0.3                lmtest_0.9-40                
[79] readr_2.1.4                   later_1.3.1                   viridis_0.6.4                
[82] ggtree_3.10.0                 lattice_0.22-5                spatstat.geom_3.2-7          
[85] future.apply_1.11.0           scattermore_1.2               XML_3.99-0.14                
[88] scuttle_1.12.0                cowplot_1.1.1                 matrixStats_1.1.0            
[91] RcppAnnoy_0.0.21              pillar_1.9.0                  nlme_3.1-163                 
[94] iterators_1.0.14              compiler_4.3.2                beachmat_2.18.0              
[97] stringi_1.7.12                minqa_1.2.6                   tensor_1.5                   
[100] plyr_1.8.9                    crayon_1.5.2                  abind_1.4-5                  
[103] scater_1.30.0                 ggdendro_0.1.23               gridGraphics_0.5-1           
[106] RNOmni_1.0.1.2                locfit_1.5-9.8                bib2df_1.1.2.0               
[109] sp_2.1-1                      terra_1.7-55                  bit_4.0.5                    
[112] UpSetR_1.4.0                  sandwich_3.0-2                dplyr_1.1.3                  
[115] whisker_0.4.1                 codetools_0.2-19              BiocSingular_1.18.0          
[118] crosstalk_1.2.0               monocle3_1.3.4                leaflet_2.2.0                
[121] paletteer_1.5.0               plotly_4.10.3                 mime_0.12                    
[124] splines_4.3.2                 Rcpp_1.0.11                   EWCE_1.10.2                  
[127] dbplyr_2.4.0                  sparseMatrixStats_1.14.0      maxLik_1.5-2                 
[130] knitr_1.45                    grr_0.9.5                     blob_1.2.4                   
[133] utf8_1.2.4                    BiocVersion_3.18.0            lme4_1.1-35.1                
[136] WriteXLS_6.4.0                fs_1.6.3                      listenv_0.9.0                
[139] DelayedMatrixStats_1.24.0     HGNChelper_0.8.1              english_1.2-6                
[142] orthogene_1.8.0               ggsignif_0.6.4                ggplotify_0.1.2              
[145] tibble_3.2.1                  statmod_1.5.0                 tzdb_0.4.0                   
[148] svglite_2.1.2                 pkgconfig_2.0.3               tools_4.3.2                  
[151] cachem_1.0.8                  RSQLite_2.3.2                 viridisLite_0.4.2            
[154] DBI_1.1.3                     rmarkdown_2.25                fastmap_1.1.1                
[157] scales_1.2.1                  grid_4.3.2                    ica_1.0-3                    
[160] gprofiler2_0.2.2              Seurat_4.4.0                  broom_1.0.5                  
[163] AnnotationHub_3.10.0          FNN_1.1.3.2                   patchwork_1.1.3              
[166] BiocManager_1.30.22           kBET_0.99.6                   dotCall64_1.1-0              
[169] carData_3.0-5                 RANN_2.6.1                    scFlow_0.7.2                 
[172] yaml_2.3.7                    MatrixGenerics_1.14.0         cli_3.6.1                    
[175] purrr_1.0.2                   stats4_4.3.2                  leiden_0.4.3                 
[178] lifecycle_1.0.4               uwot_0.1.16                   Biobase_2.62.0               
[181] homologene_1.4.68.19.3.27     backports_1.4.1               DropletUtils_1.22.0          
[184] BiocParallel_1.36.0           gtable_0.3.4                  rjson_0.2.21                 
[187] ggridges_0.5.4                progressr_0.14.0              parallel_4.3.2               
[190] ape_5.7-1                     limma_3.58.1                  jsonlite_1.8.7               
[193] edgeR_4.0.1                   miscTools_0.6-28              bitops_1.0-7                 
[196] ggplot2_3.4.4                 bit64_4.0.5                   assertthat_0.2.1             
[199] WebGestaltR_0.4.6             Rtsne_0.16                    yulab.utils_0.1.0            
[202] spatstat.utils_3.0-4          BiocNeighbors_1.20.0          SeuratObject_4.1.4           
[205] RcppParallel_5.1.7            riverplot_0.10                formattable_0.2.1            
[208] dqrng_0.3.1                   enrichR_3.2                   R.utils_2.12.2               
[211] lazyeval_0.2.2                shiny_1.7.5.1                 htmltools_0.5.7              
[214] sctransform_0.4.1             rappdirs_0.3.3                glue_1.6.2                   
[217] ewceData_1.10.0               rliger_1.0.0                  spam_2.10-0                  
[220] XVector_0.42.0                RCurl_1.98-1.12               treeio_1.26.0                
[223] mclust_6.0.0                  gridExtra_2.3                 boot_1.3-28.1                
[226] humaniformat_0.6.0            igraph_1.5.1                  R6_2.5.1                     
[229] tidyr_1.3.0                   forcats_1.0.0                 DoubletFinder_2.0.3          
[232] cluster_2.1.6                 rngtools_1.5.2                Rhdf5lib_1.24.0              
[235] aplot_0.2.2                   GenomeInfoDb_1.38.0           nloptr_2.0.3                 
[238] DelayedArray_0.28.0           tidyselect_1.2.0              vipor_0.4.5                  
[241] xml2_1.3.5                    car_3.1-2                     AnnotationDbi_1.64.0         
[244] future_1.33.0                 rsvd_1.0.5                    munsell_0.5.0                
[247] KernSmooth_2.23-22            htmlwidgets_1.6.2             RColorBrewer_1.1-3           
[250] biomaRt_2.58.0                rlang_1.1.2                   spatstat.sparse_3.0-3        
[253] spatstat.explore_3.2-5        fansi_1.0.5                   beeswarm_0.4.0        

The file was a little to big to attach here so I uploaded the reproducible data here.

https://www.dropbox.com/scl/fi/2zoiot4zx0ntyt4cg1ff0/mast_sca.zip?rlkey=xjkb7588ip38rq7khwnlge60u&dl=0

Activity

  1. amcdavid commented on Jan 22, 2024

    @amcdavid
    Member

    Hi,
    Thanks the detailed report. What model are you fitting in model_formula?

  2. nfancy commented on Feb 13, 2024

    @nfancy
    Author

    Apologies, for some reason, I didn't get a notification of your response. The model formula was ~cngenseon+(1|manifest) + diagnosis

  3. nfancy commented on Feb 14, 2024

    @nfancy
    Author

    Here's a response I got from Matrix developer.

    https://r-forge.r-project.org/tracker/?func=detail&atid=294&aid=6835&group_id=61

    However, it did not solve the issue. Thanks.

  4. amcdavid commented on Feb 14, 2024

    @amcdavid
    Member

    @nfancy I think this is a binary compatibility issue that might be resolved by recompiling (and/or reinstalling?) some packages. Using the data you provided and a bioconductor 3.17 docker image with installed MAST I could run your model successfully. I'm sorry that I can't provide more guidance than "it works on my machine". The sessionInfo of this container is listed below -- It does have MAST 1.28.0 (which shouldn't matter), but otherwise the same versions of Matrix and lme4 as you reported above. I do see that you are on an ubuntu 18.xx versus ubuntu 20.xx in my container, which could cause some subtle issues with compiled code, I suppose.

    Details > sessionInfo() R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.3 LTS

    Matrix products: default
    BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
    LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0

    locale:
    [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
    [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
    [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

    time zone: Etc/UTC
    tzcode source: system (glibc)

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

    other attached packages:
    [1] MAST_1.28.0 SingleCellExperiment_1.24.0 SummarizedExperiment_1.32.0 Biobase_2.60.0
    [5] GenomicRanges_1.54.1 GenomeInfoDb_1.38.5 IRanges_2.34.1 S4Vectors_0.38.2
    [9] BiocGenerics_0.46.0 MatrixGenerics_1.12.3 matrixStats_1.1.0

    loaded via a namespace (and not attached):
    [1] utf8_1.2.3 generics_0.1.3 SparseArray_1.2.3 bitops_1.0-7 stringi_1.7.12
    [6] lattice_0.21-8 hms_1.1.3 lme4_1.1-35.1 magrittr_2.0.3 grid_4.3.1
    [11] plyr_1.8.9 Matrix_1.6-5 progress_1.2.3 purrr_1.0.2 fansi_1.0.4
    [16] scales_1.3.0 abind_1.4-5 cli_3.6.1 rlang_1.1.1 crayon_1.5.2
    [21] XVector_0.42.0 splines_4.3.1 munsell_0.5.0 DelayedArray_0.28.0 S4Arrays_1.2.0
    [26] tools_4.3.1 reshape2_1.4.4 nloptr_2.0.3 minqa_1.2.6 dplyr_1.1.4
    [31] colorspace_2.1-0 ggplot2_3.4.4 GenomeInfoDbData_1.2.11 boot_1.3-28.1 vctrs_0.6.4
    [36] R6_2.5.1 lifecycle_1.0.3 zlibbioc_1.46.0 stringr_1.5.0 MASS_7.3-60
    [41] pkgconfig_2.0.3 pillar_1.9.0 gtable_0.3.4 glue_1.6.2 data.table_1.14.8
    [46] Rcpp_1.0.11 tibble_3.2.1 tidyselect_1.2.0 rstudioapi_0.15.0 nlme_3.1-163
    [51] compiler_4.3.1 prettyunits_1.1.1 RCurl_1.98-1.13

  5. nfancy commented on Feb 14, 2024

    @nfancy
    Author

    Hi, Thanks for checking. Can you think of any dependencies for MAST which depends on Matrix?

  6. amcdavid commented on Feb 14, 2024

    @amcdavid
    Member

    lme4 depends on matrix, and is being used in the example you provided. Did you reinstall lme4 from source? I sometimes find these issues require deleting packages manually from the R package library and reinstalling, which has its own pitfalls. Otherwise, you could work in one of the docker containers I linked to above (kind of annoying I realize).

  7. nfancy commented on Feb 14, 2024

    @nfancy
    Author

    Thanks. We have incorporated MAST in our own package scFlow, hence it's mandatory that we sort this out. :(

  8. nfancy commented on Feb 14, 2024

    @nfancy
    Author

    You are right, the culprit is lme4 since with method = "glm" it runs file. Unfortunately deleting and reinstalling lme4 with type = "source" did not help.

  9. amcdavid commented on Feb 14, 2024

    @amcdavid
    Member

    Oh nice! Since it's nextflow-based, I suppose you could just run the process that references MAST in a docker image, though that would probably constrain your users too much. What environments are you getting the failure? Just on local workstations, or in CI?

  10. nfancy commented on Feb 15, 2024

    @nfancy
    Author

    We have both an R package with MAST-wrapper and nextflow-based pipeline, hence, we first need to find a fix within our system. The worst case scenario, we may need to wait until the next version release of lme4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions