abelson-lab / scATOMIC

Pan-Cancer Single Cell Classifier
MIT License
61 stars 4 forks source link

Matrix package version / CNV mode issue #16

Closed StefanosVoglis closed 1 year ago

StefanosVoglis commented 1 year ago

Hi, there seems to be an issue with the Matrix package version and using the CNV mode within scATOMIC.

Apparently the newest Matrix package (v. 1.6.0) does not work with the current Seurat version (see here https://github.com/satijalab/seurat/issues/6746 and after calling

lung_cancer_demo_data <- demo_lung_data
cell_predictions <- run_scATOMIC(lung_cancer_demo_data)
results_lung <- create_summary_matrix(prediction_list = cell_predictions, use_CNVs = T, modify_results = T, mc.cores = detectCores(), raw_counts = lung_cancer_demo_data, min_prop = 0.5 )

the following error appears:

Computing nearest neighbor graph Computing SNN Error in validityMethod(as(object, superClass)) : object 'csparse_validate' not found

However, when installing a previous version of the Matrix package (e.g. 1.5-4.1), there seems to be a problem with the copykat call:

Maximum modularity in 10 random starts: 0.9276 Number of communities: 18 Elapsed time: 0 seconds [1] "step1: read and filter data ..." [1] "33694 genes, 2998 cells in raw data" [1] "9094 genes past LOW.DR filtering" [1] "step 2: annotations gene coordinates ..." [1] "start annotation ..." [1] "step 3: smoothing data with dlm ..." [1] "step 4: measuring baselines ..." [1] "1784 known normal cells found in dataset" [1] "run with known normal..." [1] "baseline is from known input" [1] "step 5: segmentation..." Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : namespace ‘Matrix’ 1.5-4.1 is already loaded, but >= 1.6.0 is required

> sessionInfo()
R version 4.3.0 (2023-04-21)
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=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C
[10] 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
[8] base

other attached packages:
 [1] copykat_1.1.0         cutoff.scATOMIC_0.1.0 agrmt_1.42.8
 [4] SeuratObject_4.1.3    Seurat_4.3.0.1        Rmagic_2.0.3
 [7] Matrix_1.5-4.1        reticulate_1.30       caret_6.0-94
[10] lattice_0.20-45       ggplot2_3.4.2         randomForest_4.7-1.1
[13] data.table_1.14.8     dplyr_1.1.2           plyr_1.8.8
[16] scATOMIC_2.0.1

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3     jsonlite_1.8.7         magrittr_2.0.3
  [4] spatstat.utils_3.0-3   vctrs_0.6.3            ROCR_1.0-11
  [7] spatstat.explore_3.2-1 htmltools_0.5.5        pROC_1.18.4
 [10] sctransform_0.3.5      parallelly_1.36.0      KernSmooth_2.23-20
 [13] htmlwidgets_1.6.2      ica_1.0-3              plotly_4.10.2
 [16] zoo_1.8-12             lubridate_1.9.2        igraph_1.5.0.1
 [19] mime_0.12              lifecycle_1.0.3        iterators_1.0.14
 [22] pkgconfig_2.0.3        R6_2.5.1               fastmap_1.1.1
 [25] fitdistrplus_1.1-11    future_1.33.0          shiny_1.7.4.1
 [28] numDeriv_2016.8-1.1    digest_0.6.33          colorspace_2.1-0
 [31] patchwork_1.1.2        rprojroot_2.0.3        tensor_1.5
 [34] irlba_2.3.5.1          progressr_0.13.0       fansi_1.0.4
 [37] spatstat.sparse_3.0-2  timechange_0.2.0       httr_1.4.6
 [40] polyclip_1.10-4        abind_1.4-5            compiler_4.3.0
 [43] here_1.0.1             withr_2.5.0            MASS_7.3-58.3
 [46] lava_1.7.2.1           tree_1.0-43            rappdirs_0.3.3
 [49] ModelMetrics_1.2.2.2   tools_4.3.0            lmtest_0.9-40
 [52] httpuv_1.6.11          future.apply_1.11.0    nnet_7.3-18
 [55] goftest_1.2-3          glue_1.6.2             nlme_3.1-162
 [58] promises_1.2.0.1       grid_4.3.0             Rtsne_0.16
 [61] cluster_2.1.4          reshape2_1.4.4         generics_0.1.3
 [64] recipes_1.0.6          gtable_0.3.3           spatstat.data_3.0-1
 [67] class_7.3-21           tidyr_1.3.0            sp_2.0-0
 [70] utf8_1.2.3             spatstat.geom_3.2-4    RcppAnnoy_0.0.21
 [73] ggrepel_0.9.3          RANN_2.6.1             foreach_1.5.2
 [76] pillar_1.9.0           stringr_1.5.0          later_1.3.1
 [79] splines_4.3.0          survival_3.5-5         deldir_1.0-9
 [82] SparseM_1.81           tidyselect_1.2.0       miniUI_0.1.1.1
 [85] pbapply_1.7-2          gridExtra_2.3          mcmc_0.9-7
 [88] scattermore_1.2        stats4_4.3.0           hardhat_1.3.0
 [91] timeDate_4022.108      matrixStats_1.0.0      stringi_1.7.12
 [94] lazyeval_0.2.2         codetools_0.2-19       bbmle_1.0.25
 [97] tibble_3.2.1           cli_3.6.1              RcppParallel_5.1.7
[100] uwot_0.1.16            rpart_4.1.19           xtable_1.8-4
[103] munsell_0.5.0          Rcpp_1.0.11            globals_0.16.2
[106] spatstat.random_3.1-5  coda_0.19-4            png_0.1-8
[109] bdsmatrix_1.3-6        ellipsis_0.3.2         gower_1.0.1
[112] parallelDist_0.2.6     listenv_0.9.0          mvtnorm_1.2-2
[115] viridisLite_0.4.2      ipred_0.9-14           scales_1.2.1
[118] prodlim_2023.03.31     ggridges_0.5.4         leiden_0.4.3
[121] purrr_1.0.1            rlang_1.1.1            cowplot_1.1.1

Any ideas what a solution may be ?

Kind regards,

inofechm commented 1 year ago

I've updated my Matrix version to 1.6 yet am not getting the same error, one difference is that I have Seurat v5 beta installed instead of 4.3, so maybe that code works with the newer version of Matrix. Can you try installing Seurat v5 https://satijalab.org/seurat/articles/install and let me know if that works?

Alternatively, we can also remove the step in the CNV workflow which also reports Seurat Clusters and then the function that is causing the error wouldnt be run.

Let me know if you can use Seurat v5, otherwise I will write a modified version in a dev branch that may fix this.

StefanosVoglis commented 1 year ago

Apparently it is very important to load the Matrix package (v1.6.0) BEFORE Seurat. Then it works fine in my case.