seurat icon indicating copy to clipboard operation
seurat copied to clipboard

SCTransform error message

Open whygee1245 opened this issue 4 months ago • 11 comments

Hi, I ran into an error while running my code for scRNA-seq analysis, and this was the last thing on the output of RStudio. Is there any way to debug this issue from our end or do we have to reinstall sctransform? Thank you! Second step: Get residuals using fitted parameters for 20744 genes Computing corrected count matrix for 20744 genes Calculating gene attributes Wall clock passed: Time difference of 5.104079 mins Determine variable features Regressing out nFeature_RNA, percent.mito, Library Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels In addition: There were 50 or more warnings (use warnings() to see the first 50)

whygee1245 avatar Feb 15 '24 00:02 whygee1245

Can you provide the full code you are running with sessionInfo()?

saketkc avatar Feb 15 '24 14:02 saketkc

Hi, I don't know how to provide the code with sessionInfo(). I've shared my file below for better reference SCtransform errors.zip

whygee1245 avatar Feb 16 '24 18:02 whygee1245

thanks for sharing the script, it is however difficult for me to see what is going on without access to the object. Can you please provide minimal code to reproduce the issue along with the object. You can simply paste the output of sessionInfo() in your response.

saketkc avatar Feb 16 '24 18:02 saketkc

I re-ran the code and ran into a different issue - I have posted the output of sessionInfo()

The error I received was this message: Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'which': 'list' object cannot be coerced to type 'double'

Here is the sessionInfo() output.

R version 4.3.2 (2023-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS/LAPACK: /spack/2206/apps/linux-centos7-x86_64_v3/gcc-11.3.0/openblas-0.3.20-n62j5my/lib/libopenblasp-r0.3.20.so; LAPACK version 3.9.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 stats graphics grDevices utils datasets methods base

other attached packages: [1] scater_1.30.1 scuttle_1.12.0 scds_1.18.0
[4] DoubletFinder_2.0.4 dplyr_1.1.4 scales_1.3.0
[7] clustree_0.5.1 ggraph_2.1.0 ggplot2_3.4.4
[10] sctransform_0.4.1 bitops_1.0-7 Seurat_5.0.1
[13] SeuratObject_5.0.1 sp_2.1-3 singleCellTK_2.12.2
[16] DelayedArray_0.28.0 SparseArray_1.2.3 S4Arrays_1.2.0
[19] abind_1.4-5 celda_1.18.1 Matrix_1.6-5
[22] SingleCellExperiment_1.24.0 SummarizedExperiment_1.32.0 Biobase_2.62.0
[25] GenomicRanges_1.54.1 GenomeInfoDb_1.38.6 IRanges_2.36.0
[28] S4Vectors_0.40.2 BiocGenerics_0.48.1 MatrixGenerics_1.14.0
[31] matrixStats_1.2.0

loaded via a namespace (and not attached): [1] RcppAnnoy_0.0.22 splines_4.3.2 later_1.3.2 tibble_3.2.1
[5] R.oo_1.26.0 polyclip_1.10-6 pROC_1.18.5 fastDummies_1.7.3
[9] lifecycle_1.0.4 edgeR_4.0.14 doParallel_1.0.17 globals_0.16.2
[13] lattice_0.22-5 MASS_7.3-60.0.1 magrittr_2.0.3 limma_3.58.1
[17] plotly_4.10.4 httpuv_1.6.14 spam_2.10-0 spatstat.sparse_3.0-3
[21] reticulate_1.35.0 cowplot_1.1.3 pbapply_1.7-2 RColorBrewer_1.1-3
[25] zlibbioc_1.48.0 Rtsne_0.17 purrr_1.0.2 R.utils_2.12.3
[29] RCurl_1.98-1.14 WriteXLS_6.5.0 tweenr_2.0.2 GenomeInfoDbData_1.2.11
[33] ggrepel_0.9.5 irlba_2.3.5.1 listenv_0.9.1 spatstat.utils_3.0-4
[37] eds_1.4.0 goftest_1.2-3 RSpectra_0.16-1 spatstat.random_3.2-2
[41] dqrng_0.3.2 fitdistrplus_1.1-11 parallelly_1.36.0 DelayedMatrixStats_1.24.0 [45] leiden_0.4.3.1 codetools_0.2-19 DropletUtils_1.22.0 ggforce_0.4.1
[49] tidyselect_1.2.0 farver_2.1.1 ScaledMatrix_1.10.0 viridis_0.6.5
[53] spatstat.explore_3.2-6 jsonlite_1.8.8 BiocNeighbors_1.20.2 tidygraph_1.3.1
[57] ellipsis_0.3.2 progressr_0.14.0 ggridges_0.5.6 survival_3.5-7
[61] iterators_1.0.14 dbscan_1.1-12 foreach_1.5.2 tools_4.3.2
[65] ica_1.0-3 Rcpp_1.0.12 glue_1.7.0 gridExtra_2.3
[69] HDF5Array_1.30.0 withr_3.0.0 combinat_0.0-8 fastmap_1.1.1
[73] rhdf5filters_1.14.1 MCMCprecision_0.4.0 fansi_1.0.6 rsvd_1.0.5
[77] digest_0.6.34 R6_2.5.1 mime_0.12 colorspace_2.1-0
[81] scattermore_1.2 tensor_1.5 spatstat.data_3.0-4 R.methodsS3_1.8.2
[85] utf8_1.2.4 tidyr_1.3.1 generics_0.1.3 data.table_1.15.0
[89] FNN_1.1.4 graphlayouts_1.1.0 httr_1.4.7 htmlwidgets_1.6.4
[93] uwot_0.1.16 pkgconfig_2.0.3 gtable_0.3.4 lmtest_0.9-40
[97] XVector_0.42.0 htmltools_0.5.7 dotCall64_1.1-1 png_0.1-8
[101] enrichR_3.2 rstudioapi_0.15.0 reshape2_1.4.4 rjson_0.2.21
[105] nlme_3.1-164 curl_5.2.0 zoo_1.8-12 rhdf5_2.46.1
[109] stringr_1.5.1 KernSmooth_2.23-22 vipor_0.4.7 parallel_4.3.2
[113] miniUI_0.1.1.1 pillar_1.9.0 grid_4.3.2 vctrs_0.6.5
[117] RANN_2.6.1 promises_1.2.1 BiocSingular_1.18.0 beachmat_2.18.0
[121] xtable_1.8-4 cluster_2.1.6 beeswarm_0.4.0 cli_3.6.2
[125] locfit_1.5-9.8 compiler_4.3.2 rlang_1.1.3 crayon_1.5.2
[129] future.apply_1.11.1 ggbeeswarm_0.7.2 plyr_1.8.9 stringi_1.8.3
[133] deldir_2.0-2 viridisLite_0.4.2 BiocParallel_1.36.0 munsell_0.5.0
[137] lazyeval_0.2.2 spatstat.geom_3.2-8 RcppHNSW_0.6.0 RcppEigen_0.3.3.9.4
[141] GSVAdata_1.38.0 patchwork_1.2.0 sparseMatrixStats_1.14.0 future_1.33.1
[145] Rhdf5lib_1.24.2 statmod_1.5.0 shiny_1.8.0 ROCR_1.0-11
[149] igraph_2.0.1.1 xgboost_1.7.7.1

whygee1245 avatar Feb 16 '24 19:02 whygee1245

Sorry, I cannot debug this with the information you have provided. I would need the object and minimum set of code to reproduce this. Which step does this error occur?

saketkc avatar Feb 16 '24 19:02 saketkc

The error occurs at line 174. Is there a way to provide the object on here?

whygee1245 avatar Feb 16 '24 19:02 whygee1245

Your line 174 is genes.use <- names(num.cells[which(num.cells >= min.cells)])

I will need 1) the object 2) minimal code to reproduce this - the easiest would be to save the object (post preprocessing) so that I can run the exact line where the error occurs once you email me the object ([email protected])

saketkc avatar Feb 16 '24 19:02 saketkc

I just shared the post-preprocessed object with you. Please let me know if you need anything else!

whygee1245 avatar Feb 16 '24 19:02 whygee1245

hi @whygee1245, the Rdata file you emailed me is 0 bytes. Can you please send me a '.rds object (saveRDS()`) and also tell me what code should I run so that I can reproduce this error at my end? (I will not be able to run each line of your 500+ line code)

saketkc avatar Feb 16 '24 19:02 saketkc

Ah, okay - I'll make an rds object right now. Thank you and apologies

whygee1245 avatar Feb 16 '24 19:02 whygee1245

Hi @saketkc, I sent the rds files. I am having trouble with lines 163 to 174, so if you could identify what I am doing wrong that would be greatly appreciated.

whygee1245 avatar Feb 16 '24 19:02 whygee1245