satijalab / seurat-object

https://satijalab.github.io/seurat-object/
Other
24 stars 25 forks source link

Issue with SCTransform #221

Open AnupaSP opened 2 months ago

AnupaSP commented 2 months ago

Hi!

I have tried to carry out SCTransform on my seurat object and it keeps showing me "Error in .subscript.2ary(x, i, j, drop = TRUE) : subscript out of bounds" and failing to complete the SCTransform. I redid this multiple times and made sure I replaced underscores in all feature names, and that the number of cells in the count matrix matches the metadata.

I am not really sure where I am going wrong unfortunately. I would really appreciate any help I could get!

This is the complete error I get in my console after it runs for a while.

Thank you!

SCTransform_seurat <- SCTransform(seurat, method = "glmGamPoi", vars.to.regress = "mitoPercent", verbose = TRUE)

_**> SCTransform_seurat <- SCTransform(seurat, method = "glmGamPoi", vars.to.regress = "mitoPercent", verbose = TRUE)
Running SCTransform on assay: RNA
Running SCTransform on layer: counts
vst.flavor='v2' set. Using model with fixed slope and excluding poisson genes.
Variance stabilizing transformation of count matrix of size 26597 by 41152
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 2000 genes, 5000 cells
Found 604 outliers - those will be ignored in fitting/regularization step

Second step: Get residuals using fitted parameters for 26597 genes
Computing corrected count matrix for 26597 genes
Calculating gene attributes
Wall clock passed: Time difference of 18.78205 mins
Determine variable features
Regressing out mitoPercent
  |===================================================================================================================| 100%
Centering data matrix
  |===================================================================================================================| 100%
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Getting residuals for block 1(of 9) for counts dataset
Getting residuals for block 2(of 9) for counts dataset
Getting residuals for block 3(of 9) for counts dataset
Getting residuals for block 4(of 9) for counts dataset
Getting residuals for block 5(of 9) for counts dataset
Getting residuals for block 6(of 9) for counts dataset
Getting residuals for block 7(of 9) for counts dataset
Getting residuals for block 8(of 9) for counts dataset
Getting residuals for block 9(of 9) for counts dataset
Regressing out mitoPercent
  |===================================================================================================================| 100%
Centering data matrix
  |===================================================================================================================| 100%
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Finished calculating residuals for counts
Error in .subscript.2ary(x, i, j, drop = TRUE) : subscript out of bounds
In addition: Warning message:
Feature names cannot have underscores ('_'), replacing with dashes ('-')**_
aljohnson10 commented 1 month ago

I'm having a similar issue with scTransform and getting Error in .subscript.2ary(x, i, , drop = drop) : subscript out of bounds Thanks!

Command and error message below:

kidney.rna_sub <- SCTransform(kidney.rna_sub, vars.to.regress = "percent.mt", verbose = TRUE)

Number of workers: 8 
Max global size: 75 GB
Running SCTransform on assay: RNA
Running SCTransform on layer: counts
vst.flavor='v2' set. Using model with fixed slope and excluding poisson genes.
Variance stabilizing transformation of count matrix of size 37783 by 177747
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 2000 genes, 5000 cells
Found 194 outliers - those will be ignored in fitting/regularization step

Second step: Get residuals using fitted parameters for 37783 genes
Computing corrected count matrix for 37783 genes
Calculating gene attributes
Wall clock passed: Time difference of 17.08885 mins
Determine variable features
Regressing out percent.mt
Centering data matrix
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Getting residuals for block 1(of 36) for counts dataset
Error in .subscript.2ary(x, i, , drop = drop) : subscript out of bounds
Calls: SCTransform ... get_residuals -> rownames -> %||% -> [ -> [ -> .subscript.2ary
In addition: Warning message:
Feature names cannot have underscores '_', replacing with dashes '-'TRUE 
Execution halted

My env is:

R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Rocky Linux 8.10 (Green Obsidian)

Matrix products: default
BLAS:   /wynton/home/cbi/shared/software/CBI/_rocky8/R-4.4.1-gcc13/lib64/R/lib/libRblas.so 
LAPACK: /wynton/home/cbi/shared/software/CBI/_rocky8/R-4.4.1-gcc13/lib64/R/lib/libRlapack.so;  LAPACK version 3.12.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       

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

other attached packages:
[1] future_1.34.0      glmGamPoi_1.16.0   sctransform_0.4.1  Seurat_5.1.0       SeuratObject_5.0.2
[6] sp_2.1-4           data.table_1.16.0  rhdf5_2.48.0      

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3          rstudioapi_0.16.0           jsonlite_1.8.9             
  [4] magrittr_2.0.3              spatstat.utils_3.1-0        farver_2.1.2               
  [7] zlibbioc_1.50.0             vctrs_0.6.5                 ROCR_1.0-11                
 [10] spatstat.explore_3.3-2      htmltools_0.5.8.1           S4Arrays_1.4.1             
 [13] Rhdf5lib_1.26.0             SparseArray_1.4.8           parallelly_1.38.0          
 [16] KernSmooth_2.23-24          htmlwidgets_1.6.4           ica_1.0-3                  
 [19] plyr_1.8.9                  plotly_4.10.4               zoo_1.8-12                 
 [22] igraph_2.0.3                mime_0.12                   lifecycle_1.0.4            
 [25] pkgconfig_2.0.3             Matrix_1.7-0                R6_2.5.1                   
 [28] fastmap_1.2.0               GenomeInfoDbData_1.2.12     MatrixGenerics_1.16.0      
 [31] fitdistrplus_1.2-1          shiny_1.9.1                 digest_0.6.37              
 [34] colorspace_2.1-1            patchwork_1.3.0             S4Vectors_0.42.1           
 [37] tensor_1.5                  RSpectra_0.16-2             irlba_2.3.5.1              
 [40] GenomicRanges_1.56.1        progressr_0.14.0            fansi_1.0.6                
 [43] spatstat.sparse_3.1-0       httr_1.4.7                  polyclip_1.10-7            
 [46] abind_1.4-8                 compiler_4.4.1              fastDummies_1.7.4          
 [49] MASS_7.3-61                 DelayedArray_0.30.1         tools_4.4.1                
 [52] lmtest_0.9-40               httpuv_1.6.15               future.apply_1.11.2        
 [55] goftest_1.2-3               glue_1.7.0                  nlme_3.1-166               
 [58] rhdf5filters_1.16.0         promises_1.3.0              grid_4.4.1                 
 [61] Rtsne_0.17                  cluster_2.1.6               reshape2_1.4.4             
 [64] generics_0.1.3              gtable_0.3.5                spatstat.data_3.1-2        
 [67] tidyr_1.3.1                 utf8_1.2.4                  XVector_0.44.0             
 [70] BiocGenerics_0.50.0         spatstat.geom_3.3-3         RcppAnnoy_0.0.22           
 [73] ggrepel_0.9.6               RANN_2.6.2                  pillar_1.9.0               
 [76] stringr_1.5.1               spam_2.10-0                 RcppHNSW_0.6.0             
 [79] later_1.3.2                 splines_4.4.1               dplyr_1.1.4                
 [82] lattice_0.22-6              survival_3.7-0              deldir_2.0-4               
 [85] tidyselect_1.2.1            miniUI_0.1.1.1              pbapply_1.7-2              
 [88] gridExtra_2.3               IRanges_2.38.1              SummarizedExperiment_1.34.0
 [91] scattermore_1.2             stats4_4.4.1                Biobase_2.64.0             
 [94] matrixStats_1.4.1           stringi_1.8.4               UCSC.utils_1.0.0           
 [97] lazyeval_0.2.2              codetools_0.2-20            tibble_3.2.1               
[100] cli_3.6.3                   uwot_0.2.2                  xtable_1.8-4               
[103] reticulate_1.39.0           munsell_0.5.1               Rcpp_1.0.13                
[106] GenomeInfoDb_1.40.1         globals_0.16.3              spatstat.random_3.3-2      
[109] png_0.1-8                   spatstat.univar_3.0-1       parallel_4.4.1             
[112] ggplot2_3.5.1               dotCall64_1.1-1             listenv_0.9.1              
[115] viridisLite_0.4.2           scales_1.3.0                ggridges_0.5.6             
[118] leiden_0.4.3.1              purrr_1.0.2                 crayon_1.5.3               
[121] rlang_1.1.4                 cowplot_1.1.3