Bioconductor / MatrixGenerics

S4 Generic Summary Statistic Functions that Operate on Matrix-Like Objects
https://bioconductor.org/packages/MatrixGenerics
12 stars 1 forks source link

Error in MatrixGenerics while running Pando #30

Closed yojetsharma closed 1 year ago

yojetsharma commented 1 year ago

I ran the Joint RNA and ATAC multiomic tutorial till the Peak Calling and added MACS2 peak set to the Seurat Object (d149 in this case) and started running Pando from thereon. But later I get error in MatrixGenerics:::. I am not sure what I did wrong. Please help. I have ran this on 3 different systems and still getting the same error! Is there a sequence/order to which packages are installed in R?

library(Pando)
data(motifs)
d149.pando <-Seurat::FindVariableFeatures(d149, assay='RNA')
Calculating gene variances
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating feature variances of standardized and clipped values
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
> d149.pando <- initiate_grn(d149.pando)
> d149.pando <- find_motifs(
    d149.pando,
    pfm = motifs,
    genome = BSgenome.Hsapiens.UCSC.hg38
)
Adding TF info
Building motif matrix
Finding motif positions
Creating Motif object
> d149.pando <- infer_grn(d149.pando)
Selecting candidate regulatory regions near genes
Error in MatrixGenerics:::.load_next_suggested_package_to_search(x) : 
  Failed to find a rowMaxs() method for lgCMatrix objects.

sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /ncbs_gs/nlsas_data/usershares/praghu/yojetsharma/.conda/envs/Signac/lib/libopenblasp-r0.3.21.so

locale:
 [1] LC_CTYPE=C                 LC_NUMERIC=C              
 [3] 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   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] DelayedMatrixStats_1.19.0         DelayedArray_0.23.2              
 [3] Matrix_1.5-1                      MatrixGenerics_1.9.1             
 [5] matrixStats_0.62.0                Pando_0.5.1                      
 [7] BSgenome.Hsapiens.UCSC.hg38_1.4.4 BSgenome_1.65.2                  
 [9] rtracklayer_1.57.0                Biostrings_2.65.6                
[11] XVector_0.37.1                    EnsDb.Hsapiens.v86_2.99.0        
[13] ensembldb_2.21.5                  AnnotationFilter_1.21.0          
[15] GenomicFeatures_1.49.7            AnnotationDbi_1.59.1             
[17] Biobase_2.57.1                    GenomicRanges_1.49.1             
[19] GenomeInfoDb_1.33.7               IRanges_2.31.2                   
[21] S4Vectors_0.35.4                  BiocGenerics_0.43.4              
[23] sp_1.5-0                          SeuratObject_4.1.2               
[25] Seurat_4.2.0                      Signac_1.8.0                     

loaded via a namespace (and not attached):
  [1] rappdirs_0.3.3              scattermore_0.8            
  [3] R.methodsS3_1.8.2           tidyr_1.2.1                
  [5] ggplot2_3.3.6               bit64_4.0.5                
  [7] knitr_1.40                  R.utils_2.12.0             
  [9] irlba_2.3.5                 data.table_1.14.2          
 [11] rpart_4.1.16                KEGGREST_1.37.3            
 [13] TFBSTools_1.35.0            RCurl_1.98-1.8             
 [15] generics_0.1.3              cowplot_1.1.1              
 [17] RSQLite_2.2.17              RANN_2.6.1                 
 [19] future_1.28.0               ggpointdensity_0.1.0       
 [21] bit_4.0.4                   tzdb_0.3.0                 
 [23] spatstat.data_2.2-0         xml2_1.3.3                 
 [25] httpuv_1.6.6                SummarizedExperiment_1.27.3
 [27] assertthat_0.2.1            DirichletMultinomial_1.39.0
 [29] viridis_0.6.2               xfun_0.33                  
 [31] hms_1.1.2                   promises_1.2.0.1           
 [33] fansi_1.0.3                 restfulr_0.0.15            
 [35] progress_1.2.2              caTools_1.18.2             
 [37] dbplyr_2.2.1                igraph_1.3.5               
 [39] DBI_1.1.3                   htmlwidgets_1.5.4          
 [41] spatstat.geom_2.4-0         purrr_0.3.4                
 [43] ellipsis_0.3.2              dplyr_1.0.10               
 [45] backports_1.4.1             annotate_1.75.0            
 [47] biomaRt_2.53.2              deldir_1.0-6               
 [49] sparseMatrixStats_1.9.0     vctrs_0.4.1                
 [51] ROCR_1.0-11                 abind_1.4-5                
 [53] cachem_1.0.6                withr_2.5.0                
 [55] grr_0.9.5                   ggforce_0.3.4              
 [57] progressr_0.11.0            checkmate_2.1.0            
 [59] sctransform_0.3.5           GenomicAlignments_1.33.1   
 [61] prettyunits_1.1.1           goftest_1.2-3              
 [63] cluster_2.1.4               lazyeval_0.2.2             
 [65] seqLogo_1.63.0              crayon_1.5.1               
 [67] hdf5r_1.3.6                 pkgconfig_2.0.3            
 [69] tweenr_2.0.2                nlme_3.1-159               
 [71] ProtGenerics_1.29.0         nnet_7.3-17                
 [73] pals_1.7                    rlang_1.0.5                
 [75] globals_0.16.1              lifecycle_1.0.2            
 [77] miniUI_0.1.1.1              filelock_1.0.2             
 [79] BiocFileCache_2.5.0         dichromat_2.0-0.1          
 [81] polyclip_1.10-0             lmtest_0.9-40              
 [83] Matrix.utils_0.9.8          zoo_1.8-11                 
 [85] base64enc_0.1-3             ggridges_0.5.3             
 [87] png_0.1-7                   viridisLite_0.4.1          
 [89] rjson_0.2.21                bitops_1.0-7               
 [91] R.oo_1.25.0                 KernSmooth_2.23-20         
 [93] blob_1.2.3                  stringr_1.4.1              
 [95] parallelly_1.32.1           spatstat.random_2.2-0      
 [97] readr_2.1.2                 jpeg_0.1-9                 
 [99] CNEr_1.33.0                 scales_1.2.1               
[101] memoise_2.0.1               magrittr_2.0.3             
[103] plyr_1.8.7                  ica_1.0-3                  
[105] zlibbioc_1.43.0             compiler_4.2.0             
[107] BiocIO_1.7.1                RColorBrewer_1.1-3         
[109] fitdistrplus_1.1-8          Rsamtools_2.13.4           
[111] cli_3.4.0                   listenv_0.8.0              
[113] patchwork_1.1.2             pbapply_1.5-0              
[115] htmlTable_2.4.1             Formula_1.2-4              
[117] MASS_7.3-58.1               mgcv_1.8-40                
[119] tidyselect_1.1.2            stringi_1.7.8              
[121] yaml_2.3.5                  latticeExtra_0.6-30        
[123] ggrepel_0.9.1               grid_4.2.0                 
[125] VariantAnnotation_1.43.3    fastmatch_1.1-3            
[127] tools_4.2.0                 future.apply_1.9.1         
[129] parallel_4.2.0              rstudioapi_0.14            
[131] TFMPvalue_0.0.8             foreign_0.8-82             
[133] gridExtra_2.3               farver_2.1.1               
[135] Rtsne_0.16                  ggraph_2.0.6               
[137] BiocManager_1.30.18         digest_0.6.29              
[139] rgeos_0.5-10                pracma_2.4.2               
[141] shiny_1.7.2                 motifmatchr_1.19.0         
[143] Rcpp_1.0.9                  later_1.3.0                
[145] RcppAnnoy_0.0.19            httr_1.4.4                 
[147] biovizBase_1.45.0           colorspace_2.0-3           
[149] XML_3.99-0.10               tensor_1.5                 
[151] reticulate_1.26             splines_4.2.0              
[153] uwot_0.1.14                 RcppRoll_0.3.0             
[155] spatstat.utils_2.3-1        graphlayouts_0.8.1         
[157] mapproj_1.2.8               plotly_4.10.0              
[159] xtable_1.8-4                jsonlite_1.8.0             
[161] poweRlaw_0.70.6             tidygraph_1.2.2            
[163] R6_2.5.1                    Hmisc_4.7-1                
[165] pillar_1.8.1                htmltools_0.5.3            
[167] mime_0.12                   glue_1.6.2                 
[169] fastmap_1.1.0               BiocParallel_1.31.12       
[171] codetools_0.2-18            maps_3.4.0                 
[173] utf8_1.2.2                  lattice_0.20-45            
[175] spatstat.sparse_2.1-1       tibble_3.1.8               
[177] curl_4.3.2                  leiden_0.4.3               
[179] gtools_3.9.3                GO.db_3.15.0               
[181] interp_1.1-3                survival_3.4-0             
[183] munsell_0.5.0               GenomeInfoDbData_1.2.8     
[185] reshape2_1.4.4              gtable_0.3.1               
[187] spatstat.core_2.4-4
PeteHaitch commented 1 year ago

The hint is in this error message

Failed to find a rowMaxs() method for lgCMatrix objects.

MatrixGenerics provides the 'generic' function for functions such as rowMaxs() but not the actual methods[^1]. Other packages provide the actual methods, namely:

Returning to the error message, notably, none of the above packages provide a rowMaxs() method for lgCMatrix objects, which is why there is an error in your code. The Seurat/Pando/Signac[^2] authors would need to import or provide such a method (or coerce the input to a supported class) if they want to that code to work as intended.

[^1]: As written in the DESCRIPTION: https://github.com/Bioconductor/MatrixGenerics/blob/ab97ac048888e497731883715f48bdb2bdb9dfd8/DESCRIPTION#L3-L7 [^2]: It's not clear to me which package should be responsible; in your example there are > 200 packages involved.