feiyoung / PRECAST_Analysis

Main results in PRECAST
GNU General Public License v3.0
2 stars 0 forks source link

Issue with PRECAST:::wpcaCpp #4

Open Jorges1000 opened 5 months ago

Jorges1000 commented 5 months ago

Hi, thanks for the excellent work.

When trying to reproduce the workflow in hepatocellular_carcinoma.R I ran into the following error at step (added PRECAST::: since get_correct_exp is not attached from PRECAST) hX <- PRECAST:::get_correct_exp(XList, Rf, houseKeep) Error: Col::subvec(): indices out of bounds or incorrectly used

which I traced to the .Call(_PRECAST_wpcaCpp, X, nPCs, weighted) function.

sessionInfo() R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.6 LTS

Matrix products: default BLAS: /shared/apps/R/4.3.1/lib/R/lib/libRblas.so LAPACK: /shared/apps/R/4.3.1/lib/R/lib/libRlapack.so; LAPACK version 3.11.0

locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
[5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

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

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

other attached packages: [1] data.table_1.15.4 PRECAST_1.6.5 gtools_3.9.5 dplyr_1.1.4
[5] Matrix_1.6-5 DR.SC_3.4 spatstat.geom_3.2-9 spatstat.data_3.0-4 [9] patchwork_1.2.0 ggplot2_3.5.0 enrichR_3.2 scCustomize_2.1.2
[13] Seurat_5.0.3 SeuratObject_5.0.1 sp_2.1-3 CFS_0.9.9.11
[17] ica_1.0-3 workflowr_1.7.1

loaded via a namespace (and not attached): [1] dichromat_2.0-0.1 IRanges_2.36.0 progress_1.2.3
[4] goftest_1.2-3 DT_0.32 Biostrings_2.70.3
[7] vctrs_0.6.5 spatstat.random_3.2-3 digest_0.6.35
[10] png_0.1-8 shape_1.4.6.1 proxy_0.4-27
[13] registry_0.5-1 git2r_0.33.0 ggrepel_0.9.5
[16] corrplot_0.92 deldir_2.0-4 parallelly_1.37.1
[19] MASS_7.3-60.0.1 GiRaF_1.0.1 reshape2_1.4.4
[22] httpuv_1.6.15 foreach_1.5.2 BiocGenerics_0.48.1
[25] withr_3.0.0 ggrastr_1.0.2 xfun_0.43
[28] ggfun_0.1.4 ggpubr_0.6.0 survival_3.5-8
[31] memoise_2.0.1 ggbeeswarm_0.7.2 janitor_2.2.0
[34] tidytree_0.4.6 zoo_1.8-12 GlobalOptions_0.1.2
[37] pbapply_1.7-2 prettyunits_1.2.0 rematch2_2.1.2
[40] KEGGREST_1.42.0 promises_1.2.1 httr_1.4.7
[43] rstatix_0.7.2 globals_0.16.3 fitdistrplus_1.1-11
[46] ps_1.7.6 rstudioapi_0.16.0 miniUI_0.1.1.1
[49] generics_0.1.3 processx_3.8.4 babelgene_22.9
[52] curl_5.2.1 S4Vectors_0.40.2 zlibbioc_1.48.2
[55] ScaledMatrix_1.10.0 polyclip_1.10-6 ca_0.71.1
[58] GenomeInfoDbData_1.2.11 SparseArray_1.2.4 xtable_1.8-4
[61] stringr_1.5.1 evaluate_0.23 S4Arrays_1.2.1
[64] BiocFileCache_2.10.2 hms_1.1.3 GenomicRanges_1.54.1
[67] irlba_2.3.5.1 colorspace_2.1-0 filelock_1.0.3
[70] visNetwork_2.1.2 ROCR_1.0-11 reticulate_1.35.0
[73] shinyWidgets_0.8.3 magrittr_2.0.3 lmtest_0.9-40
[76] snakecase_0.11.1 ggtree_3.10.1 later_1.3.2
[79] viridis_0.6.5 lattice_0.22-6 mapproj_1.2.11
[82] future.apply_1.11.2 getPass_0.2-4 scattermore_1.2
[85] XML_3.99-0.16.1 scuttle_1.12.0 cowplot_1.1.3
[88] matrixStats_1.2.0 RcppAnnoy_0.0.22 class_7.3-22
[91] pillar_1.9.0 nlme_3.1-164 iterators_1.0.14
[94] compiler_4.3.1 beachmat_2.18.1 RSpectra_0.16-1
[97] stringi_1.8.3 TSP_1.2-4 tensor_1.5
[100] SummarizedExperiment_1.32.0 dendextend_1.17.1 lubridate_1.9.3
[103] plyr_1.8.9 crayon_1.5.2 abind_1.4-5
[106] scater_1.30.1 gridGraphics_0.5-1 pals_1.8
[109] bit_4.0.5 terra_1.7-71 whisker_0.4.1
[112] codetools_0.2-20 BiocSingular_1.18.0 bslib_0.7.0
[115] e1071_1.7-14 paletteer_1.6.0 plotly_4.10.4
[118] mime_0.12 splines_4.3.1 circlize_0.4.16
[121] Rcpp_1.0.12 fastDummies_1.7.3 dbplyr_2.5.0
[124] sparseMatrixStats_1.14.0 interp_1.1-6 grr_0.9.5
[127] shinyFiles_0.9.3 knitr_1.45 blob_1.2.4
[130] utf8_1.2.4 WriteXLS_6.5.0 fs_1.6.3
[133] listenv_0.9.1 DelayedMatrixStats_1.24.0 orthogene_1.8.0
[136] openxlsx_4.2.5.2 ggplotify_0.1.2 ggsignif_0.6.4
[139] tibble_3.2.1 callr_3.7.6 tweenr_2.0.3
[142] pkgconfig_2.0.3 pheatmap_1.0.12 tools_4.3.1
[145] MERINGUE_1.0 cachem_1.0.8 RSQLite_2.3.6
[148] viridisLite_0.4.2 DBI_1.2.2 splitstackshape_1.4.8
[151] shinyalert_3.0.0 fastmap_1.1.1 rmarkdown_2.26
[154] scales_1.3.0 grid_4.3.1 gprofiler2_0.2.3
[157] shinydashboard_0.7.2 broom_1.0.5 sass_0.4.9
[160] ggprism_1.0.5 dotCall64_1.1-1 carData_3.0-5
[163] RANN_2.6.1 farver_2.1.1 mgcv_1.9-1
[166] scatterpie_0.2.2 yaml_2.3.8 MatrixGenerics_1.14.0
[169] ggthemes_5.1.0 cli_3.6.2 purrr_1.0.2
[172] stats4_4.3.1 webshot_0.5.5 leiden_0.4.3.1
[175] lifecycle_1.0.4 uwot_0.1.16 Biobase_2.62.0
[178] homologene_1.4.68.19.3.27 backports_1.4.1 BiocParallel_1.36.0
[181] timechange_0.3.0 gtable_0.3.4 rjson_0.2.21
[184] ggridges_0.5.6 progressr_0.14.0 ape_5.7-1
[187] jsonlite_1.8.8 RcppHNSW_0.6.0 seriation_1.5.4
[190] bitops_1.0-7 bit64_4.0.5 assertthat_0.2.1
[193] Rtsne_0.17 yulab.utils_0.1.4 spatstat.utils_3.0-4
[196] BiocNeighbors_1.20.2 zip_2.3.1 heatmaply_1.5.0
[199] jquerylib_0.1.4 rclipboard_0.2.1 lazyeval_0.2.2
[202] shiny_1.8.1.1 htmltools_0.5.8 sctransform_0.4.1
[205] rappdirs_0.3.3 glue_1.7.0 ggvenn_0.1.10
[208] spam_2.10-0 XVector_0.42.0 RCurl_1.98-1.14
[211] treeio_1.26.0 rprojroot_2.0.4 mclust_6.1
[214] jpeg_0.1-10 gridExtra_2.3 igraph_2.0.3
[217] R6_2.5.1 tidyr_1.3.1 SingleCellExperiment_1.24.0 [220] labeling_0.4.3 CompQuadForm_1.4.3 forcats_1.0.0
[223] cluster_2.1.6 pkgload_1.3.4 aplot_0.2.2
[226] GenomeInfoDb_1.38.8 DelayedArray_0.28.0 tidyselect_1.2.1
[229] vipor_0.4.7 maps_3.4.2 ggforce_0.4.2
[232] xml2_1.3.6 raster_3.6-26 car_3.1-2
[235] AnnotationDbi_1.64.1 future_1.33.2 rsvd_1.0.5
[238] munsell_0.5.1 KernSmooth_2.23-22 htmlwidgets_1.6.4
[241] RColorBrewer_1.1-3 biomaRt_2.58.2 rlang_1.1.3
[244] spatstat.sparse_3.0-3 spatstat.explore_3.2-7 fansi_1.0.6
[247] beeswarm_0.4.0

Jorges1000 commented 5 months ago

The issue is probably related to the previous lines reslist <- selectModel(resList, return_para_est=T) Rf <- attr(reslist, "fit")$Rf

I assumed the first of those lines to be a typo as selectModel requires a Seurat of DR_SC object and does not have have a return_para_est parameter. So I changed to SelectModel(resList, return_para_est=T) but then attr(reslist, "fit")$Rf is NULL because attr(reslist,"fit") does not have an Rf element

feiyoung commented 5 months ago

Due to the update of the SelectModel() function in the new version of the PRECAST package, you can now utilize the following code to acquire Rf:

reslist <- SelectModel(resList, return_para_est=T) Rf <- reslist$Rf