Skip to content

Error in t.default(enrichment) : argument is not a matrix #152

@AhmedAbd5

Description

@AhmedAbd5

Hello,

Thanks for a great package! I am trying to normalize using performNormalization but I'm getting the following error:

Seu_escape <- performNormalization(Seu_escape, 
                                      assay = "escape.ssGSEA", 
                                      gene.sets = geneSets)
Computing expressed-gene counts per cell...
Normalizing enrichment scores...
Error in t.default(enrichment) : argument is not a matrix

My input is seurat object, SCT normalized. I'm using a custom gene set.

My full code is below:

Merged_Seurat <- readRDS("./Merged_Seurat.rds")

#load custom geneset
X3datasets <- read.delim("./CustomGeneSet.txt")
GS1<- X3datasets$GeneSet1
GS2<- X3datasets$GeneSet2
GS3<- X3datasets$GeneSet3

#transform them into the GeneSet format
gs1  <- GeneSet(GS1)
gs2  <- GeneSet(GS2)
gs3  <- GeneSet(GS3)

geneSets <- list(geneSet1=gs1, geneSet2=gs2, geneSet3=gs3)
geneSets <- GeneSetCollection(geneSets)


Seu_escape <- runEscape(Merged_Seurat, gene.sets = geneSets, groups = 5000, min.size = 3,
                           new.assay.name = "escape.ssGSEA")

Seu_escape <- performNormalization(Seu_escape, 
                                      assay = "escape.ssGSEA", 
                                      gene.sets = geneSets)

I tried to look at the sturcture of the input and here it is:

> enrichment_scores <- GetAssayData(Seu_escape, assay = "escape.ssGSEA")
> str(enrichment_scores)
Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  ..@ i       : int [1:433491] 0 1 2 0 1 2 0 1 2 0 ...
  ..@ p       : int [1:144498] 0 3 6 9 12 15 18 21 24 27 ...
  ..@ Dim     : int [1:2] 3 144497
  ..@ Dimnames:List of 2
  .. ..$ : chr [1:3] "geneSet1" "geneSet2" "geneSet3"
  .. ..$ : chr [1:144497] "XXXX_AAACCCAAGCACCTGC-1" "XXXX_AAACGAAAGATGCGAC-1" "XXXX_AAACGAAAGTCAATCC-1" "XXXX_AAACGAACACAACCGC-1" ...
  ..@ x       : num [1:433491] 5405 7396 7417 5506 7623 ...
  ..@ factors : list()

Session info below:

> sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.3.so;  LAPACK version 3.8.0

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

time zone: America/Los_Angeles
tzcode source: system (glibc)

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

other attached packages:
 [1] MAST_1.28.0                 gridExtra_2.3               dittoSeq_1.14.3            
 [4] lubridate_1.9.4             forcats_1.0.0               stringr_1.5.1              
 [7] purrr_1.0.4                 readr_2.1.5                 tidyverse_2.0.0            
[10] AUCell_1.24.0               escape_2.5.0                GSEABase_1.64.0            
[13] graph_1.80.0                annotate_1.80.0             XML_3.99-0.18              
[16] AnnotationDbi_1.64.1        monocle3_1.3.7              SingleCellExperiment_1.24.0
[19] SummarizedExperiment_1.32.0 GenomicRanges_1.54.1        GenomeInfoDb_1.38.8        
[22] IRanges_2.36.0              S4Vectors_0.40.2            MatrixGenerics_1.14.0      
[25] matrixStats_1.5.0           Biobase_2.66.0              BiocGenerics_0.48.1        
[28] tidyr_1.3.1                 tibble_3.2.1                gprofiler2_0.2.3           
[31] RColorBrewer_1.1-3          viridis_0.6.5               viridisLite_0.4.2          
[34] DoubletFinder_2.0.4         patchwork_1.3.0             dplyr_1.1.4                
[37] cowplot_1.1.3               pheatmap_1.0.12             ggplot2_3.5.2              
[40] Signac_1.14.0               Seurat_5.2.1                SeuratObject_5.0.2         
[43] sp_2.2-0                   

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.22          splines_4.3.3             later_1.4.1              
  [4] bitops_1.0-9              R.oo_1.27.0               polyclip_1.10-7          
  [7] fastDummies_1.7.5         lifecycle_1.0.4           Rdpack_2.6.4             
 [10] globals_0.16.3            lattice_0.22-6            MASS_7.3-60.0.1          
 [13] ggdist_3.3.3              magrittr_2.0.3            plotly_4.10.4            
 [16] httpuv_1.6.15             sctransform_0.4.1         spam_2.11-1              
 [19] spatstat.sparse_3.1-0     reticulate_1.41.0.1       pbapply_1.7-2            
 [22] DBI_1.2.3                 minqa_1.2.8               abind_1.4-8              
 [25] zlibbioc_1.48.2           Rtsne_0.17                R.utils_2.13.0           
 [28] RCurl_1.98-1.17           GenomeInfoDbData_1.2.11   ggrepel_0.9.6            
 [31] irlba_2.3.5.1             listenv_0.9.1             spatstat.utils_3.1-3     
 [34] goftest_1.2-3             RSpectra_0.16-2           spatstat.random_3.3-3    
 [37] fitdistrplus_1.2-2        parallelly_1.43.0         DelayedMatrixStats_1.24.0
 [40] codetools_0.2-20          DelayedArray_0.28.0       RcppRoll_0.3.1           
 [43] tidyselect_1.2.1          farver_2.1.2              lme4_1.1-37              
 [46] spatstat.explore_3.4-2    jsonlite_1.9.1            progressr_0.15.1         
 [49] ggridges_0.5.6            survival_3.8-3            systemfonts_1.2.3        
 [52] tools_4.3.3               ragg_1.3.3                ica_1.0-3                
 [55] Rcpp_1.0.14               glue_1.8.0                SparseArray_1.2.4        
 [58] distributional_0.5.0      withr_3.0.2               fastmap_1.2.0            
 [61] boot_1.3-31               digest_0.6.37             timechange_0.3.0         
 [64] R6_2.6.1                  mime_0.13                 textshaping_1.0.0        
 [67] colorspace_2.1-1          scattermore_1.2           tensor_1.5               
 [70] dichromat_2.0-0.1         spatstat.data_3.1-6       RSQLite_2.3.9            
 [73] R.methodsS3_1.8.2         generics_0.1.4            data.table_1.17.0        
 [76] httr_1.4.7                htmlwidgets_1.6.4         S4Arrays_1.2.1           
 [79] uwot_0.2.3                pkgconfig_2.0.3           gtable_0.3.6             
 [82] blob_1.2.4                lmtest_0.9-40             XVector_0.42.0           
 [85] htmltools_0.5.8.1         dotCall64_1.2             scales_1.4.0             
 [88] png_0.1-8                 spatstat.univar_3.1-2     reformulas_0.4.0         
 [91] rstudioapi_0.17.1         tzdb_0.5.0                reshape2_1.4.4           
 [94] nlme_3.1-167              nloptr_2.1.1              zoo_1.8-13               
 [97] cachem_1.1.0              KernSmooth_2.23-26        parallel_4.3.3           
[100] miniUI_0.1.1.1            pillar_1.10.2             vctrs_0.6.5              
[103] RANN_2.6.2                promises_1.3.2            xtable_1.8-4             
[106] cluster_2.1.8.1           cli_3.6.5                 compiler_4.3.3           
[109] Rsamtools_2.18.0          rlang_1.1.6               crayon_1.5.3             
[112] future.apply_1.11.3       labeling_0.4.3            plyr_1.8.9               
[115] stringi_1.8.7             deldir_2.0-4              BiocParallel_1.36.0      
[118] Biostrings_2.70.3         lazyeval_0.2.2            spatstat.geom_3.3-6      
[121] Matrix_1.6-5              RcppHNSW_0.6.0            hms_1.1.3                
[124] sparseMatrixStats_1.14.0  bit64_4.6.0-1             future_1.34.0            
[127] KEGGREST_1.42.0           shiny_1.10.0              rbibutils_2.3            
[130] ROCR_1.0-11               igraph_2.1.4              memoise_2.0.1            
[133] fastmatch_1.1-6           bit_4.6.0 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions