prabhakarlab / Banksy

BANKSY: spatial clustering
https://prabhakarlab.github.io/Banksy
Other
74 stars 12 forks source link

Error in RunBanksy code #41

Open salasd opened 1 month ago

salasd commented 1 month ago

Hi, I am running through the Seurat tutorial Pipeline and having trouble with just the first part of the Banksy code and getting the following error while using the training data suggested:

> object <- RunBanksy(object,
+                     lambda = 0.5, verbose = TRUE,
+                     assay = "Spatial.008um", slot = "data", features = "variable",
+                     k_geom = 20
+ )

Fetching data from slot data from assay Spatial.008um Subsetting by features Calculating gene variances 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| Calculating feature variances of standardized and clipped values 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| Error in order(hvf.info$vst.variance.standardized, decreasing = TRUE) : argument 1 is not a vector In addition: Warning messages: 1: In get_data(object, assay, slot, features, verbose) : No variable features found. Running Seurat::FindVariableFeatures 2: In FindVariableFeatures.Assay(object = object[[assay]], selection.method = selection.method, : selection.method set to 'vst' but count slot is empty; will use data slot instead

The rest of the code runs okay until I get to the SpatialDimPlot()portion

DefaultAssay(object) <- "BANKSY"
object <- RunPCA(object, assay = "BANKSY", reduction.name = "pca.banksy", features = rownames(object), npcs = 30)
object <- FindNeighbors(object, reduction = "pca.banksy", dims = 1:30)
object <- FindClusters(object, cluster.name = "banksy_cluster", resolution = 0.5)

Idents(object) <- "banksy_cluster"
B <- SpatialDimPlot(object, group.by = "banksy_cluster", label = T, repel = T, label.size = 4)

Scale for fill is already present. Adding another scale for fill, which will replace the existing scale. Error in order(labels.loc[, id]) : argument 1 is not a vector

Here is my sessionInfo() sessionInfo()

R version 4.4.1 (2024-06-14 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C LC_TIME=English_United States.utf8

time zone: America/New_York tzcode source: internal

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

other attached packages: [1] Banksy_1.0.0 SeuratWrappers_0.3.5 presto_1.0.0 data.table_1.16.0 Rcpp_1.0.13
[6] dplyr_1.1.4 patchwork_1.3.0 ggplot2_3.5.1 Seurat_5.1.0 SeuratObject_5.0.2
[11] sp_2.1-4

loaded via a namespace (and not attached): [1] RcppHungarian_0.3 RcppAnnoy_0.0.22 splines_4.4.1 later_1.3.2
[5] tibble_3.2.1 R.oo_1.26.0 polyclip_1.10-7 fastDummies_1.7.4
[9] lifecycle_1.0.4 aricode_1.0.3 globals_0.16.3 processx_3.8.4
[13] lattice_0.22-6 hdf5r_1.3.11 MASS_7.3-60.2 magrittr_2.0.3
[17] plotly_4.10.4 remotes_2.5.0 httpuv_1.6.15 sctransform_0.4.1
[21] spam_2.11-0 sessioninfo_1.2.2 pkgbuild_1.4.4 spatstat.sparse_3.1-0
[25] reticulate_1.39.0 cowplot_1.1.3 pbapply_1.7-2 RColorBrewer_1.1-3
[29] zlibbioc_1.50.0 abind_1.4-8 pkgload_1.4.0 GenomicRanges_1.56.1
[33] Rtsne_0.17 purrr_1.0.2 R.utils_2.12.3 BiocGenerics_0.50.0
[37] GenomeInfoDbData_1.2.12 IRanges_2.38.1 S4Vectors_0.42.1 ggrepel_0.9.6
[41] irlba_2.3.5.1 listenv_0.9.1 spatstat.utils_3.1-0 goftest_1.2-3
[45] RSpectra_0.16-2 spatstat.random_3.3-2 fitdistrplus_1.2-1 parallelly_1.38.0
[49] DelayedArray_0.30.1 leiden_0.4.3.1 codetools_0.2-20 tidyselect_1.2.1
[53] UCSC.utils_1.0.0 farver_2.1.2 matrixStats_1.4.1 stats4_4.4.1
[57] spatstat.explore_3.3-2 jsonlite_1.8.9 ellipsis_0.3.2 progressr_0.14.0
[61] ggridges_0.5.6 survival_3.6-4 dbscan_1.2-0 tools_4.4.1
[65] ica_1.0-3 glue_1.8.0 SparseArray_1.4.8 gridExtra_2.3
[69] MatrixGenerics_1.16.0 usethis_3.0.0 GenomeInfoDb_1.40.1 withr_3.0.1
[73] BiocManager_1.30.25 fastmap_1.2.0 fansi_1.0.6 callr_3.7.6
[77] digest_0.6.37 rsvd_1.0.5 R6_2.5.1 mime_0.12
[81] colorspace_2.1-1 scattermore_1.2 sccore_1.0.5 tensor_1.5
[85] spatstat.data_3.1-2 R.methodsS3_1.8.2 utf8_1.2.4 tidyr_1.3.1
[89] generics_0.1.3 S4Arrays_1.4.1 httr_1.4.7 htmlwidgets_1.6.4
[93] uwot_0.2.2 pkgconfig_2.0.3 gtable_0.3.5 lmtest_0.9-40
[97] XVector_0.44.0 SingleCellExperiment_1.26.0 htmltools_0.5.8.1 profvis_0.4.0
[101] dotCall64_1.2 Biobase_2.64.0 scales_1.3.0 png_0.1-8
[105] SpatialExperiment_1.14.0 spatstat.univar_3.0-1 rstudioapi_0.16.0 rjson_0.2.23
[109] reshape2_1.4.4 nlme_3.1-164 curl_5.2.3 cachem_1.1.0
[113] zoo_1.8-12 stringr_1.5.1 KernSmooth_2.23-24 parallel_4.4.1
[117] miniUI_0.1.1.1 arrow_17.0.0.1 desc_1.4.3 pillar_1.9.0
[121] grid_4.4.1 vctrs_0.6.5 RANN_2.6.2 urlchecker_1.0.1
[125] promises_1.3.0 xtable_1.8-4 cluster_2.1.6 magick_2.8.5
[129] cli_3.6.3 compiler_4.4.1 crayon_1.5.3 rlang_1.1.4
[133] future.apply_1.11.2 labeling_0.4.3 mclust_6.1.1 ps_1.8.0
[137] plyr_1.8.9 fs_1.6.4 stringi_1.8.4 viridisLite_0.4.2
[141] deldir_2.0-4 assertthat_0.2.1 munsell_0.5.1 lazyeval_0.2.2
[145] devtools_2.4.5 spatstat.geom_3.3-3 Matrix_1.7-0 RcppHNSW_0.6.0
[149] bit64_4.5.2 future_1.34.0 shiny_1.9.1 SummarizedExperiment_1.34.0 [153] ROCR_1.0-11 leidenAlg_1.1.3 igraph_2.0.3 memoise_2.0.1
[157] bit_4.5.0 ape_5.8

I ran it a second time and got the following

> object <- RunBanksy(object,
+                     lambda = 0.5, verbose = TRUE,
+                     assay = "Spatial.008um", slot = "data", features = "variable",
+                     k_geom = 20
+ )

Fetching data from slot data from assay Spatial.008um Subsetting by features Computing neighbors... Spatial mode is kNN_median Parameters: k_geom=20 Done Computing harmonic m = 0 Using 20 neighbors Processed 393543 groups out of 393543. 100% done. Time elapsed: 399s. ETA: 0s.. Done Creating Banksy matrix Scaling BANKSY matrix. Do not call ScaleData on assay BANKSY Setting default assay to BANKSY Warning: Layer counts isn't present in the assay object; returning NULL Warning message: In asMethod(object) : sparse->dense coercion: allocating vector of size 5.9 GiB

DefaultAssay(object) <- "BANKSY"
 object <- RunPCA(object, assay = "BANKSY", reduction.name = "pca.banksy", features = rownames(object), npcs = 30)

PC 1 Positive: Ptk2b.m0, Calm3.m0, Dnm1.m0, Gria2.m0, Chn1.m0, Rtn1.m0, Gpm6a.m0, Ppp3r1.m0, Calm2.m0, Olfm1.m0 Atp6v1b2.m0, Nrgn.m0, Snap25.m0, Serinc1.m0, Ppp3ca.m0, Ptprn.m0, Atp6v1a.m0, Syp.m0, Ywhah.m0, Stxbp1.m0 Ncdn.m0, Enc1.m0, Syt1.m0, Cadm3.m0, Atp1b1.m0, Mapk1.m0, Slc17a7.m0, Nell2.m0, Cadm2.m0, Phyhip.m0 Negative: Mbp.m0, Mobp.m0, Plp1.m0, Trf.m0, Apod.m0, Mal.m0, Cldn11.m0, Gatm.m0, Cnp.m0, Mag.m0 Ugt8a.m0, Mbp, Cryab.m0, Gfap.m0, Ermn.m0, Apoe.m0, Car2.m0, Ptgds.m0, Tspan2.m0, Plp1 Mog.m0, Mobp, Ppp1r14a.m0, Gjc3.m0, Pllp.m0, Ndrg1.m0, Ttyh2.m0, Fa2h.m0, Myrf.m0, Tmem88b.m0 PC 2 Positive: Slc17a7.m0, Camk2n1.m0, Nrgn.m0, Olfm1.m0, Cnksr2.m0, Ptk2b.m0, Vxn.m0, Zbtb18.m0, Cck.m0, Inka2.m0 Hpca.m0, Cabp1.m0, Rasgrp1.m0, Arc.m0, Kalrn.m0, Egr3.m0, Chn1.m0, Mef2c.m0, Itpka.m0, Mical2.m0 Tbr1.m0, Camk2n1, Neurod2.m0, Neurod6.m0, Tmem178.m0, Stx1a.m0, Lingo1.m0, Kctd1.m0, Camk4.m0, Satb2.m0 Negative: Baiap3.m0, Nap1l5.m0, Gaa.m0, Hap1.m0, Resp18.m0, Ndn.m0, Tmem130.m0, Peg3.m0, Ahi1.m0, Gpx3.m0 Zcchc12.m0, Nrsn2.m0, Gprasp2.m0, Sparc.m0, Scg2.m0, AW551984.m0, Wdr6.m0, Impact.m0, Vat1l.m0, Gprasp1.m0 Grb10.m0, Nnat.m0, Vat1.m0, Podxl2.m0, Pnck.m0, Maged1.m0, Calb2.m0, Ecel1.m0, Ache.m0, Gap43.m0 PC 3 Positive: Prkcd.m0, Pcp4.m0, Rora.m0, Slc17a6.m0, Tnnt1.m0, Amotl1.m0, Ccdc136.m0, Synpo2.m0, Ntng1.m0, Uchl1.m0 Tcf7l2.m0, Shox2.m0, Rab37.m0, Nefh.m0, Pdp1.m0, Cplx1.m0, Ramp3.m0, Kcnc2.m0, Vamp1.m0, Plekhg1.m0 Plcb4.m0, Grm1.m0, Rims3.m0, Ptpn3.m0, Nrip3.m0, Rgs16.m0, Spock3.m0, Atp2a2.m0, Grm4.m0, Rab3c.m0 Negative: Igf2.m0, Ahnak.m0, Ptgds.m0, Vim.m0, Mgp.m0, Fn1.m0, Col1a2.m0, Rbp1.m0, Cald1.m0, Dcn.m0 Igfbp2.m0, Nbl1.m0, Pcolce.m0, Bgn.m0, Cfh.m0, Aldh1a2.m0, Aebp1.m0, Islr.m0, Bmp6.m0, Slc13a4.m0 Slc6a20a.m0, Col1a1.m0, Anxa2.m0, Ifitm2.m0, Igfbp7.m0, Apod.m0, Vtn.m0, Cavin1.m0, Bmp7.m0, Slc6a13.m0 PC 4 Positive: Hap1.m0, Ly6h.m0, Ahi1.m0, Baiap3.m0, Atp2b4.m0, Ndn.m0, AW551984.m0, Pnmal2.m0, Ecel1.m0, Gpx3.m0 Pnck.m0, Ptpro.m0, Tmem130.m0, Fxyd6.m0, Gda.m0, Gad2.m0, Zcchc12.m0, Gaa.m0, Wdr6.m0, Vat1l.m0 Ngb.m0, Gap43.m0, Peg10.m0, Ctxn1.m0, Efnb3.m0, Penk.m0, Hap1, Rasal1.m0, Rcn1.m0, Resp18.m0 Negative: Prkcd.m0, Rora.m0, Tnnt1.m0, Synpo2.m0, Ptpn3.m0, Plekhg1.m0, Pdp1.m0, Pcp4.m0, Atp2a2.m0, Rgs16.m0 Rab37.m0, Plcb4.m0, Amotl1.m0, Ccdc136.m0, Shox2.m0, Ramp3.m0, Ntng1.m0, Zic1.m0, Cplx1.m0, Tcf7l2.m0 Nefh.m0, Kcnc2.m0, Rgs4.m0, Prkcd, Grm1.m0, Ildr2.m0, Patj.m0, Nrip3.m0, Rasd1.m0, Pcp4l1.m0 PC 5 Positive: Plp1.m0, Cldn11.m0, Mal.m0, Trf.m0, Mobp.m0, Mbp.m0, Mag.m0, Ugt8a.m0, Cnp.m0, Sgk1.m0 Efnb3.m0, Tspan2.m0, Gatm.m0, Car2.m0, Ermn.m0, Mog.m0, Cryab.m0, Sept4.m0, Plp1, Phldb1.m0 Zbtb20.m0, Slc44a1.m0, Ddr1.m0, Pllp.m0, Myrf.m0, Fa2h.m0, Prox1.m0, Gjc3.m0, Ppp1r14a.m0, Ttyh2.m0 Negative: Camk2n1.m0, Mef2c.m0, Stx1a.m0, Ngef.m0, Camk2n1, Igfbp6.m0, Cabp1.m0, Lamp5.m0, Car10.m0, Arpp21.m0 Cacnb3.m0, Snap25.m0, Ddit4l.m0, Atp2b4.m0, Stxbp1.m0, Ttc9b.m0, Lingo1.m0, Tbr1.m0, Satb2.m0, Slc1a3.m0 Camk4.m0, Pdzrn3.m0, Vsnl1.m0, Dkkl1.m0, Slc39a10.m0, Nptxr.m0, Cxcl14.m0, Gpr26.m0, Plxnd1.m0, Kcnh5.m0 Warning message: Key 'PC' taken, using 'pcabanksy_' instead

>object <- FindNeighbors(object, reduction = "pca.banksy", dims = 1:30)
Computing nearest neighbor graph
Computing SNN
> object <- FindClusters(object, cluster.name = "banksy_cluster", resolution = 0.5)

Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 393543 Number of edges: 10655699

Running Louvain algorithm... 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| Maximum modularity in 10 random starts: 0.9306 Number of communities: 22 Elapsed time: 184 seconds

> Idents(object) <- "banksy_cluster"
> B <- SpatialDimPlot(object, group.by = "banksy_cluster", label = T, repel = T, label.size = 4)

Scale for fill is already present. Adding another scale for fill, which will replace the existing scale. Error in order(labels.loc[, id]) : argument 1 is not a vector

sessionInfo()

R version 4.4.1 (2024-06-14 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C LC_TIME=English_United States.utf8

time zone: America/New_York tzcode source: internal

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

other attached packages: [1] Banksy_1.0.0 SeuratWrappers_0.3.5 BPCells_0.2.0 SeuratDisk_0.0.0.9021 arrow_17.0.0.1
[6] hdf5r_1.3.11 presto_1.0.0 data.table_1.16.0 Rcpp_1.0.13 dplyr_1.1.4
[11] patchwork_1.3.0 ggplot2_3.5.1 Seurat_5.1.0 SeuratObject_5.0.2 sp_2.1-4
[16] Azimuth_0.5.0 shinyBS_0.61.1

loaded via a namespace (and not attached): [1] fs_1.6.4 ProtGenerics_1.36.0 matrixStats_1.4.1
[4] spatstat.sparse_3.1-0 bitops_1.0-9 DirichletMultinomial_1.46.0
[7] TFBSTools_1.42.0 httr_1.4.7 RColorBrewer_1.1-3
[10] tools_4.4.1 sctransform_0.4.1 utf8_1.2.4
[13] R6_2.5.1 DT_0.33 lazyeval_0.2.2
[16] uwot_0.2.2 rhdf5filters_1.16.0 withr_3.0.1
[19] gridExtra_2.3 progressr_0.14.0 cli_3.6.3
[22] Biobase_2.64.0 spatstat.explore_3.3-2 fastDummies_1.7.4
[25] EnsDb.Hsapiens.v86_2.99.0 shinyjs_2.1.0 labeling_0.4.3
[28] spatstat.data_3.1-2 readr_2.1.5 ggridges_0.5.6
[31] pbapply_1.7-2 Rsamtools_2.20.0 dbscan_1.2-0
[34] R.utils_2.12.3 aricode_1.0.3 parallelly_1.38.0
[37] BSgenome_1.72.0 rstudioapi_0.16.0 RSQLite_2.3.7
[40] generics_0.1.3 BiocIO_1.14.0 gtools_3.9.5
[43] ica_1.0-3 spatstat.random_3.3-2 googlesheets4_1.1.1
[46] GO.db_3.19.1 Matrix_1.7-0 fansi_1.0.6
[49] S4Vectors_0.42.1 abind_1.4-8 R.methodsS3_1.8.2
[52] lifecycle_1.0.4 yaml_2.3.10 SummarizedExperiment_1.34.0
[55] rhdf5_2.48.0 SparseArray_1.4.8 Rtsne_0.17
[58] grid_4.4.1 blob_1.2.4 promises_1.3.0
[61] shinydashboard_0.7.2 crayon_1.5.3 pwalign_1.0.0
[64] miniUI_0.1.1.1 lattice_0.22-6 cowplot_1.1.3
[67] GenomicFeatures_1.56.0 annotate_1.82.0 KEGGREST_1.44.1
[70] magick_2.8.5 pillar_1.9.0 GenomicRanges_1.56.1
[73] rjson_0.2.23 future.apply_1.11.2 codetools_0.2-20
[76] fastmatch_1.1-4 leiden_0.4.3.1 glue_1.8.0
[79] spatstat.univar_3.0-1 remotes_2.5.0 vctrs_0.6.5
[82] png_0.1-8 spam_2.11-0 cellranger_1.1.0
[85] gtable_0.3.5 poweRlaw_0.80.0 assertthat_0.2.1
[88] cachem_1.1.0 Signac_1.14.0 S4Arrays_1.4.1
[91] mime_0.12 pracma_2.4.4 survival_3.7-0
[94] gargle_1.5.2 SingleCellExperiment_1.26.0 RcppHungarian_0.3
[97] RcppRoll_0.3.1 fitdistrplus_1.2-1 ROCR_1.0-11
[100] nlme_3.1-166 bit64_4.5.2 RcppAnnoy_0.0.22
[103] GenomeInfoDb_1.40.1 irlba_2.3.5.1 KernSmooth_2.23-24
[106] colorspace_2.1-1 seqLogo_1.70.0 BiocGenerics_0.50.0
[109] DBI_1.2.3 tidyselect_1.2.1 processx_3.8.4
[112] bit_4.5.0 compiler_4.4.1 curl_5.2.3
[115] desc_1.4.3 DelayedArray_0.30.1 plotly_4.10.4
[118] rtracklayer_1.64.0 scales_1.3.0 caTools_1.18.3
[121] lmtest_0.9-40 callr_3.7.6 rappdirs_0.3.3
[124] SpatialExperiment_1.14.0 stringr_1.5.1 digest_0.6.37
[127] goftest_1.2-3 spatstat.utils_3.1-0 XVector_0.44.0
[130] htmltools_0.5.8.1 pkgconfig_2.0.3 MatrixGenerics_1.16.0
[133] fastmap_1.2.0 ensembldb_2.28.1 rlang_1.1.4
[136] htmlwidgets_1.6.4 UCSC.utils_1.0.0 shiny_1.9.1
[139] farver_2.1.2 zoo_1.8-12 jsonlite_1.8.9
[142] mclust_6.1.1 BiocParallel_1.38.0 R.oo_1.26.0
[145] RCurl_1.98-1.16 magrittr_2.0.3 GenomeInfoDbData_1.2.12
[148] dotCall64_1.2 Rhdf5lib_1.26.0 munsell_0.5.1
[151] ape_5.8 reticulate_1.39.0 leidenAlg_1.1.3
[154] stringi_1.8.4 zlibbioc_1.50.0 MASS_7.3-61
[157] plyr_1.8.9 pkgbuild_1.4.4 parallel_4.4.1
[160] listenv_0.9.1 ggrepel_0.9.6 deldir_2.0-4
[163] CNEr_1.40.0 sccore_1.0.5 Biostrings_2.72.1
[166] splines_4.4.1 tensor_1.5 hms_1.1.3
[169] BSgenome.Hsapiens.UCSC.hg38_1.4.5 ps_1.8.0 igraph_2.0.3
[172] spatstat.geom_3.3-3 RcppHNSW_0.6.0 reshape2_1.4.4
[175] stats4_4.4.1 TFMPvalue_0.0.9 XML_3.99-0.17
[178] BiocManager_1.30.25 JASPAR2020_0.99.10 tzdb_0.4.0
[181] httpuv_1.6.15 RANN_2.6.2 tidyr_1.3.1
[184] purrr_1.0.2 polyclip_1.10-7 future_1.34.0
[187] SeuratData_0.2.2.9001 scattermore_1.2 rsvd_1.0.5
[190] xtable_1.8-4 restfulr_0.0.15 AnnotationFilter_1.28.0
[193] RSpectra_0.16-2 later_1.3.2 googledrive_2.1.1
[196] viridisLite_0.4.2 tibble_3.2.1 memoise_2.0.1
[199] AnnotationDbi_1.66.0 GenomicAlignments_1.40.0 IRanges_2.38.1
[202] cluster_2.1.6 globals_0.16.3