longmanz / Mixscale

7 stars 0 forks source link

Run_wmvRegDE error. The design matrix contains 'NA's for sample . Please remove them before you call 'glm_gp()' #2

Open gighuarhguggg45 opened 7 months ago

gighuarhguggg45 commented 7 months ago

Hello @longmanz ,

Thank you for the mixscale package. I have been able to run the vignette example as well as my own data without issues. However, when I include the split.by argument in all the functions, I get the following error when I get to the Run_wmvRegDE function: de_res = Run_wmvRegDE(object = seurat_obj, assay = "RNA", slot = "counts", labels = "gene", nt.class.name = "negative_control", PRTB_list = c("GENE_NAME"), logfc.threshold = 0.2, split.by = 'RNA_snn_res.0.2')

Error message:

Running Mixscale weighted DE test...

GENE_NAME is running weighted DE test!

Error in handle_design_parameter(design, data, col_data, reference_level): The design matrix contains 'NA's for sample 1, 2, 3, 4, 5, 6. Please remove them before you call 'glm_gp()'. Traceback:

  1. Run_wmvRegDE(object = seurat_obj, assay = "RNA", . slot = "counts", labels = "gene", nt.class.name = "negative_control", . PRTB_list = c("GENE_NAME"), logfc.threshold = 0.2, split.by = "RNA_snn_res.0.2")
  2. glm_gp(data = count_data2[idx_for_DE, ], design = ~0 + cell_type + . weight:cell_type + log_ct, col_data = mat_all, overdispersion = fit_rough$overdispersions, . overdispersion_shrinkage = F, size_factors = F, on_disk = FALSE)
  3. handle_design_parameter(design, data, col_data, reference_level)
  4. stop("The design matrix contains 'NA's for sample ", paste0(head(which(DelayedMatrixStats::rowAnyNAs(model_matrix))), . collapse = ", "), ". Please remove them before you call 'glm_gp()'.")

sessionInfo:

R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.6 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/liblapack.so.3; LAPACK version 3.9.0

locale: [1] LC_CTYPE=en_US.UTF-8 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

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

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

other attached packages: [1] dplyr_1.1.4 Mixscale_0.3.0 ggplot2_3.4.4 ggridges_0.5.6
[5] SeuratObject_5.0.1 Seurat_4.4.0

loaded via a namespace (and not attached): [1] RColorBrewer_1.1-3 jsonlite_1.8.8
[3] magrittr_2.0.3 spatstat.utils_3.0-4
[5] farver_2.1.1 zlibbioc_1.46.0
[7] vctrs_0.6.5 ROCR_1.0-11
[9] DelayedMatrixStats_1.22.1 spatstat.explore_3.2-6
[11] RCurl_1.98-1.12 base64enc_0.1-3
[13] S4Arrays_1.0.4 htmltools_0.5.7
[15] sctransform_0.4.1 parallelly_1.36.0
[17] KernSmooth_2.23-22 htmlwidgets_1.6.4
[19] ica_1.0-3 plyr_1.8.9
[21] plotly_4.10.4 zoo_1.8-12
[23] uuid_1.1-0 igraph_1.5.0
[25] mime_0.12 lifecycle_1.0.4
[27] pkgconfig_2.0.3 Matrix_1.6-5
[29] R6_2.5.1 fastmap_1.1.1
[31] GenomeInfoDbData_1.2.10 MatrixGenerics_1.12.3
[33] fitdistrplus_1.1-11 future_1.33.1
[35] shiny_1.8.0 digest_0.6.34
[37] colorspace_2.1-0 patchwork_1.2.0
[39] S4Vectors_0.38.2 tensor_1.5
[41] irlba_2.3.5.1 GenomicRanges_1.52.1
[43] labeling_0.4.3 progressr_0.14.0
[45] fansi_1.0.6 spatstat.sparse_3.0-3
[47] httr_1.4.7 polyclip_1.10-6
[49] abind_1.4-5 compiler_4.3.1
[51] withr_3.0.0 gplots_3.1.3.1
[53] MASS_7.3-60 DelayedArray_0.26.7
[55] caTools_1.18.2 gtools_3.9.5
[57] tools_4.3.1 lmtest_0.9-40
[59] httpuv_1.6.14 future.apply_1.11.1
[61] goftest_1.2-3 glmGamPoi_1.12.2
[63] glue_1.7.0 nlme_3.1-162
[65] promises_1.2.1 grid_4.3.1
[67] pbdZMQ_0.3-9 Rtsne_0.17
[69] cluster_2.1.4 reshape2_1.4.4
[71] PMA_1.2-3 generics_0.1.3
[73] protoclust_1.6.4 gtable_0.3.4
[75] spatstat.data_3.0-4 tidyr_1.3.1
[77] data.table_1.15.0 XVector_0.40.0
[79] sp_2.1-3 utf8_1.2.4
[81] BiocGenerics_0.46.0 spatstat.geom_3.2-8
[83] RcppAnnoy_0.0.22 ggrepel_0.9.5
[85] RANN_2.6.1 pillar_1.9.0
[87] stringr_1.5.1 spam_2.10-0
[89] IRdisplay_1.1 later_1.3.2
[91] splines_4.3.1 lattice_0.21-8
[93] survival_3.5-5 deldir_2.0-2
[95] tidyselect_1.2.0 miniUI_0.1.1.1
[97] pbapply_1.7-2 gridExtra_2.3
[99] IRanges_2.34.1 SummarizedExperiment_1.30.2 [101] scattermore_1.2 stats4_4.3.1
[103] Biobase_2.60.0 matrixStats_1.2.0
[105] stringi_1.8.3 lazyeval_0.2.2
[107] evaluate_0.23 codetools_0.2-19
[109] tibble_3.2.1 cli_3.6.2
[111] uwot_0.1.16 IRkernel_1.3.2
[113] xtable_1.8-4 reticulate_1.35.0
[115] repr_1.1.6 munsell_0.5.0
[117] Rcpp_1.0.12 GenomeInfoDb_1.36.4
[119] globals_0.16.2 spatstat.random_3.2-2
[121] png_0.1-8 parallel_4.3.1
[123] ellipsis_0.3.2 dotCall64_1.1-1
[125] sparseMatrixStats_1.12.2 bitops_1.0-7
[127] listenv_0.9.1 viridisLite_0.4.2
[129] scales_1.3.0 leiden_0.4.3.1
[131] purrr_1.0.2 crayon_1.5.2
[133] rlang_1.1.3 cowplot_1.1.3

Is there a way to modify that design matrix manually? Could this be related to issues with dependencies?

Thanks

longmanz commented 7 months ago

Hi @gighuarhguggg45 ,

Thank you for using our package. When you perform the CalcPerterbSig() and RunMixscale(), have you included the "split.by" flag as well? You will need to re-run them if not, otherwise the Run_wmvRegDE() does not support the "split.by" flag. Sorry for the confusion and we will definitely make this more explicit in the vignette in our next update!

Please let me know if the issue persists even if "split.by" is included, and I will look into this further.

gighuarhguggg45 commented 7 months ago

Hi @longmanz thank you for your quick response! I confirm I included "split.by" in CalcPerturbSig and RunxMixscale but still got this error in Run_wmvRegDE.

longmanz commented 7 months ago

Hi @gighuarhguggg45 , Thank you for confirming! Then this might be a bug. I will look into this and get back to you!

longmanz commented 7 months ago

Hi @gighuarhguggg45 , I found a bug and has fixed it in the weighted DE function. However, this does not seem to be related to the error you reported. Could you please try the updated version and let me know if the issue persists? If so, it would be nice if you could provide a minimal reproducible example data to me so that I can test it from my end. My email is ljiang@nygenome.org.

In addition, could you check if your "gene" and "RNA_snn_res.0.2" contains NAs ?