Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindSpatiallyVariableFeatures Error #4611

Closed
royfrancis opened this issue Jun 10, 2021 · 6 comments
Closed

FindSpatiallyVariableFeatures Error #4611

royfrancis opened this issue Jun 10, 2021 · 6 comments
Assignees
Labels
bug Something isn't working more-information-needed We need more information before this can be addressed

Comments

@royfrancis
Copy link
Contributor

> FindSpatiallyVariableFeatures(brain,selection.method='markvariogram')
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'as.matrix': subscript out of bounds

Reproducible example:

library(Seurat)
#> Registered S3 method overwritten by 'spatstat.geom':
#>   method     from
#>   print.boxx cli
#> Attaching SeuratObject
library(SeuratData)
#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used
#> ── Installed datasets ───────────────────────────────────── SeuratData v0.2.1 ──
#> ✓ stxBrain 0.1.1
#> ────────────────────────────────────── Key ─────────────────────────────────────
#> ✓ Dataset loaded successfully
#> > Dataset built with a newer version of Seurat than installed
#> ❓ Unknown version of Seurat installed
brain1 <- LoadData("stxBrain", type = "anterior1")
#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used
brain2 <- LoadData("stxBrain", type = "posterior1")
#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used

#> Warning in if (is.na(desc)) {: the condition has length > 1 and only the first
#> element will be used
brain <- merge(brain1,brain2)
#> Warning in CheckDuplicateCellNames(object.list = objects): Some cell names are
#> duplicated across objects provided. Renaming to enforce unique cell names.
brain <- NormalizeData(brain, assay = "Spatial")
brain <- FindVariableFeatures(brain)
brain <- ScaleData(brain)
#> Centering and scaling data matrix
brain <- RunPCA(brain,verbose=F,seed.use=100)
brain <- RunUMAP(brain,reduction="pca",seed.use=100,dims=1:30)
#> Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
#> To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
#> This message will be shown once per session
#> 23:16:55 UMAP embedding parameters a = 0.9922 b = 1.112
#> 23:16:55 Read 6049 rows and found 30 numeric columns
#> 23:16:55 Using Annoy for neighbor search, n_neighbors = 30
#> 23:16:55 Building Annoy index with metric = cosine, n_trees = 50
#> 0%   10   20   30   40   50   60   70   80   90   100%
#> [----|----|----|----|----|----|----|----|----|----|
#> **************************************************|
#> 23:16:56 Writing NN index file to temp file /tmp/RtmpTPieYQ/file1719b335506cd
#> 23:16:56 Searching Annoy index using 1 thread, search_k = 3000
#> 23:16:57 Annoy recall = 100%
#> 23:16:57 Commencing smooth kNN distance calibration using 1 thread
#> 23:16:58 Initializing from normalized Laplacian + noise
#> 23:16:58 Commencing optimization for 500 epochs, with 248746 positive edges
#> 23:17:04 Optimization finished
FindSpatiallyVariableFeatures(brain,selection.method='markvariogram')
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'as.matrix': subscript out of bounds

Created on 2021-06-10 by the reprex package (v2.0.0)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.1.0 (2021-05-18)
#>  os       Ubuntu 20.04.2 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language en_GB:en                    
#>  collate  en_GB.UTF-8                 
#>  ctype    en_GB.UTF-8                 
#>  tz       Europe/Stockholm            
#>  date     2021-06-10                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package             * version date       lib
#>  abind                 1.4-5   2016-07-21 [1]
#>  assertthat            0.2.1   2019-03-21 [1]
#>  cli                   2.5.0   2021-04-26 [1]
#>  cluster               2.1.2   2021-04-17 [1]
#>  codetools             0.2-18  2020-11-04 [1]
#>  colorspace            2.0-1   2021-05-04 [1]
#>  cowplot               1.1.1   2020-12-30 [1]
#>  crayon                1.4.1   2021-02-08 [1]
#>  data.table            1.14.0  2021-02-21 [1]
#>  DBI                   1.1.1   2021-01-15 [1]
#>  deldir                0.2-10  2021-02-16 [1]
#>  digest                0.6.27  2020-10-24 [1]
#>  dplyr                 1.0.6   2021-05-05 [1]
#>  ellipsis              0.3.2   2021-04-29 [1]
#>  evaluate              0.14    2019-05-28 [1]
#>  fansi                 0.5.0   2021-05-25 [1]
#>  fastmap               1.1.0   2021-01-25 [1]
#>  fitdistrplus          1.1-5   2021-05-28 [1]
#>  fs                    1.5.0   2020-07-31 [1]
#>  future                1.21.0  2020-12-10 [1]
#>  future.apply          1.7.0   2021-01-04 [1]
#>  generics              0.1.0   2020-10-31 [1]
#>  ggplot2               3.3.3   2020-12-30 [1]
#>  ggrepel               0.9.1   2021-01-15 [1]
#>  ggridges              0.5.3   2021-01-08 [1]
#>  globals               0.14.0  2020-11-22 [1]
#>  glue                  1.4.2   2020-08-27 [1]
#>  goftest               1.2-2   2019-12-02 [1]
#>  gridExtra             2.3     2017-09-09 [1]
#>  gtable                0.3.0   2019-03-25 [1]
#>  highr                 0.9     2021-04-16 [1]
#>  htmltools             0.5.1.1 2021-01-22 [1]
#>  htmlwidgets           1.5.3   2020-12-10 [1]
#>  httpuv                1.6.1   2021-05-07 [1]
#>  httr                  1.4.2   2020-07-20 [1]
#>  ica                   1.0-2   2018-05-24 [1]
#>  igraph                1.2.6   2020-10-06 [1]
#>  irlba                 2.3.3   2019-02-05 [1]
#>  jsonlite              1.7.2   2020-12-09 [1]
#>  KernSmooth            2.23-20 2021-05-03 [1]
#>  knitr                 1.33    2021-04-24 [1]
#>  later                 1.2.0   2021-04-23 [1]
#>  lattice               0.20-44 2021-05-02 [1]
#>  lazyeval              0.2.2   2019-03-15 [1]
#>  leiden                0.3.8   2021-05-24 [1]
#>  lifecycle             1.0.0   2021-02-15 [1]
#>  listenv               0.8.0   2019-12-05 [1]
#>  lmtest                0.9-38  2020-09-09 [1]
#>  magrittr              2.0.1   2020-11-17 [1]
#>  MASS                  7.3-54  2021-05-03 [1]
#>  Matrix                1.3-4   2021-06-01 [1]
#>  matrixStats           0.59.0  2021-06-01 [1]
#>  mgcv                  1.8-36  2021-06-01 [1]
#>  mime                  0.10    2021-02-13 [1]
#>  miniUI                0.1.1.1 2018-05-18 [1]
#>  munsell               0.5.0   2018-06-12 [1]
#>  nlme                  3.1-152 2021-02-04 [1]
#>  parallelly            1.25.0  2021-04-30 [1]
#>  patchwork             1.1.1   2020-12-17 [1]
#>  pbapply               1.4-3   2020-08-18 [1]
#>  pillar                1.6.1   2021-05-16 [1]
#>  pkgconfig             2.0.3   2019-09-22 [1]
#>  plotly                4.9.3   2021-01-10 [1]
#>  plyr                  1.8.6   2020-03-03 [1]
#>  png                   0.1-7   2013-12-03 [1]
#>  polyclip              1.10-0  2019-03-14 [1]
#>  promises              1.2.0.1 2021-02-11 [1]
#>  purrr                 0.3.4   2020-04-17 [1]
#>  R6                    2.5.0   2020-10-28 [1]
#>  RANN                  2.6.1   2019-01-08 [1]
#>  rappdirs              0.3.3   2021-01-31 [1]
#>  RColorBrewer          1.1-2   2014-12-07 [1]
#>  Rcpp                  1.0.6   2021-01-15 [1]
#>  RcppAnnoy             0.0.18  2020-12-15 [1]
#>  reprex                2.0.0   2021-04-02 [1]
#>  reshape2              1.4.4   2020-04-09 [1]
#>  reticulate            1.20    2021-05-03 [1]
#>  rlang                 0.4.11  2021-04-30 [1]
#>  rmarkdown             2.8     2021-05-07 [1]
#>  ROCR                  1.0-11  2020-05-02 [1]
#>  rpart                 4.1-15  2019-04-12 [1]
#>  RSpectra              0.16-0  2019-12-01 [1]
#>  rstudioapi            0.13    2020-11-12 [1]
#>  Rtsne                 0.15    2018-11-10 [1]
#>  scales                1.1.1   2020-05-11 [1]
#>  scattermore           0.7     2020-11-24 [1]
#>  sctransform           0.3.2   2020-12-16 [1]
#>  sessioninfo           1.1.1   2018-11-05 [1]
#>  Seurat              * 4.0.2   2021-05-20 [1]
#>  SeuratData          * 0.2.1   2021-06-03 [1]
#>  SeuratObject        * 4.0.1   2021-05-08 [1]
#>  shiny                 1.6.0   2021-01-25 [1]
#>  spatstat.core         2.1-2   2021-04-18 [1]
#>  spatstat.data         2.1-0   2021-03-21 [1]
#>  spatstat.geom         2.1-0   2021-04-15 [1]
#>  spatstat.sparse       2.0-0   2021-03-16 [1]
#>  spatstat.utils        2.1-0   2021-03-15 [1]
#>  stringi               1.6.2   2021-05-17 [1]
#>  stringr               1.4.0   2019-02-10 [1]
#>  stxBrain.SeuratData * 0.1.1   2021-06-03 [1]
#>  survival              3.2-11  2021-04-26 [1]
#>  tensor                1.5     2012-05-05 [1]
#>  tibble                3.1.2   2021-05-16 [1]
#>  tidyr                 1.1.3   2021-03-03 [1]
#>  tidyselect            1.1.1   2021-04-30 [1]
#>  utf8                  1.2.1   2021-03-12 [1]
#>  uwot                  0.1.10  2020-12-15 [1]
#>  vctrs                 0.3.8   2021-04-29 [1]
#>  viridisLite           0.4.0   2021-04-13 [1]
#>  withr                 2.4.2   2021-04-18 [1]
#>  xfun                  0.23    2021-05-15 [1]
#>  xtable                1.8-4   2019-04-21 [1]
#>  yaml                  2.2.1   2020-02-01 [1]
#>  zoo                   1.8-9   2021-03-09 [1]
#>  source                                
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  Github (satijalab/seurat-data@b59556b)
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  local                                 
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#>  CRAN (R 4.1.0)                        
#> 
#> [1] /home/roy/miniconda3/envs/r-4.1/lib/R/library
@andrewwbutler
Copy link
Collaborator

Hi,

Thanks for the reprex! By default FindSpatiallyVariableFeatures() will run on all features if not specified. If some of these hadn't been scaled prior to running this function, you would likely hit this error. I've updated the function on the develop branch to warn and continue with available features rather than erroring here. Please try installing (instructions here) and see if that resolves the issue.

@andrewwbutler andrewwbutler added the more-information-needed We need more information before this can be addressed label Jul 8, 2021
@no-response
Copy link

no-response bot commented Jul 22, 2021

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Jul 22, 2021
@tingchiafelix
Copy link

tingchiafelix commented Dec 27, 2023

Hi,

I was attempting to run "FindSpatiallyVariableFeatures" on a single object merging from multiple Visium slices data. I got a similar error as shown above. I used Seurat_5.0.1. Should I install the develop version to get rid of this error? Any suggestion?

Best,
TC

Error:

Error in (function (cond)  : 
  error in evaluating the argument 'x' in selecting a method for function 'as.matrix': subscript out of bounds
a <- obj_a
b <- obj_b
c <- obj_c

HN_visium.merge <- merge(x = a, 
                  y = c(b, c))

DefaultAssay(HN_visium.merge) <- "SCT"
VariableFeatures(HN_visium.merge) <- c(VariableFeatures(a), VariableFeatures(b),VariableFeatures(c))

HN_visium.merge <- RunPCA(HN_visium.merge, verbose = FALSE)
HN_visium.merge <- FindNeighbors(HN_visium.merge, dims = 1:30)
HN_visium.merge <- FindClusters(HN_visium.merge, verbose = FALSE)
HN_visium.merge <- RunUMAP(HN_visium.merge, dims = 1:30)
HN_visium.merge<- PrepSCTFindMarkers(HN_visium.merge, assay = "SCT", verbose = TRUE)

HN_visium.merge <- FindSpatiallyVariableFeatures(HN_visium.merge, assay = "SCT", features = VariableFeatures(HN_visium.merge)[1:1000],selection.method = "moransi")
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS 14.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] Seurat_5.0.1                SeuratObject_5.0.1          sp_2.1-2                    SpatialExperiment_1.8.1    
 [5] SingleCellExperiment_1.20.1 SummarizedExperiment_1.28.0 Biobase_2.58.0              GenomicRanges_1.50.2       
 [9] GenomeInfoDb_1.34.9         IRanges_2.32.0              S4Vectors_0.36.2            BiocGenerics_0.44.0        
[13] MatrixGenerics_1.10.0       matrixStats_1.1.0           STdeconvolve_1.3.1          dplyr_1.1.4                
[17] patchwork_1.1.3             ggplot2_3.4.4              

loaded via a namespace (and not attached):
  [1] spam_2.10-0               plyr_1.8.9                igraph_1.6.0              lazyeval_0.2.2           
  [5] splines_4.2.2             RcppHNSW_0.5.0            BiocParallel_1.32.6       listenv_0.9.0            
  [9] scattermore_1.2           digest_0.6.33             htmltools_0.5.7           magick_2.8.2             
 [13] fansi_1.0.6               magrittr_2.0.3            tensor_1.5                cluster_2.1.6            
 [17] ROCR_1.0-11               limma_3.54.2              globals_0.16.2            R.utils_2.12.3           
 [21] spatstat.sparse_3.0-3     colorspace_2.1-0          ggrepel_0.9.4             crayon_1.5.2             
 [25] RCurl_1.98-1.13           jsonlite_1.8.8            progressr_0.14.0          spatstat.data_3.0-3      
 [29] survival_3.5-7            zoo_1.8-12                glue_1.6.2                polyclip_1.10-6          
 [33] gtable_0.3.4              zlibbioc_1.44.0           XVector_0.38.0            leiden_0.4.3.1           
 [37] DelayedArray_0.24.0       DropletUtils_1.18.1       Rhdf5lib_1.20.0           future.apply_1.11.0      
 [41] HDF5Array_1.26.0          abind_1.4-5               scales_1.3.0              edgeR_3.40.2             
 [45] spatstat.random_3.2-2     miniUI_0.1.1.1            Rcpp_1.0.11               viridisLite_0.4.2        
 [49] xtable_1.8-4              reticulate_1.34.0         dqrng_0.3.2               bit_4.0.5                
 [53] dotCall64_1.1-1           htmlwidgets_1.6.4         MERINGUE_1.0              httr_1.4.7               
 [57] RColorBrewer_1.1-3        ellipsis_0.3.2            ica_1.0-3                 farver_2.1.1             
 [61] pkgconfig_2.0.3           R.methodsS3_1.8.2         scuttle_1.8.4             uwot_0.1.16              
 [65] deldir_2.0-2              locfit_1.5-9.8            utf8_1.2.4                labeling_0.4.3           
 [69] tidyselect_1.2.0          rlang_1.1.2               reshape2_1.4.4            later_1.3.2              
 [73] munsell_0.5.0             tools_4.2.2               cli_3.6.2                 generics_0.1.3           
 [77] ggridges_0.5.5            stringr_1.5.1             fastmap_1.1.1             goftest_1.2-3            
 [81] bit64_4.0.5               fitdistrplus_1.1-11       purrr_1.0.2               RANN_2.6.1               
 [85] pbapply_1.7-2             future_1.33.0             nlme_3.1-164              sparseMatrixStats_1.10.0 
 [89] mime_0.12                 R.oo_1.25.0               hdf5r_1.3.8               compiler_4.2.2           
 [93] rstudioapi_0.15.0         plotly_4.10.3             png_0.1-8                 spatstat.utils_3.0-4     
 [97] tibble_3.2.1              glmGamPoi_1.10.2          stringi_1.8.3             RSpectra_0.16-1          
[101] lattice_0.22-5            Matrix_1.6-4              vctrs_0.6.5               pillar_1.9.0             
[105] lifecycle_1.0.4           rhdf5filters_1.10.1       spatstat.geom_3.2-7       lmtest_0.9-40            
[109] RcppAnnoy_0.0.21          data.table_1.14.10        cowplot_1.1.2             bitops_1.0-7             
[113] irlba_2.3.5.1             httpuv_1.6.13             R6_2.5.1                  promises_1.2.1           
[117] KernSmooth_2.23-22        gridExtra_2.3             parallelly_1.36.0         codetools_0.2-19         
[121] fastDummies_1.7.3         MASS_7.3-60               rhdf5_2.42.1              rjson_0.2.21             
[125] withr_2.5.2               presto_1.0.0              sctransform_0.4.1         GenomeInfoDbData_1.2.9   
[129] mgcv_1.9-1                parallel_4.2.2            grid_4.2.2                beachmat_2.14.2          
[133] tidyr_1.3.0               DelayedMatrixStats_1.20.0 Rtsne_0.17                spatstat.explore_3.2-5   
[137] shiny_1.8.0              

@peizyi
Copy link

peizyi commented Dec 28, 2023

Modifying the parameter 'return.only.var.genes=FALSE' in the function 'SCTransform()' will help. As 'return.only.var.genes=TRUE' is the default setting, the 'scale.data' in assay "SCT" only reserve the scaled data of HVGs, that's why subscript is out of bounds.

@tingchiafelix
Copy link

@peizyi thanks for your reply.

I got another error after modifying the parameter 'return.only.var.genes=FALSE' in the function 'SCTransform()'.

Error in FindSpatiallyVariableFeatures.default(object = data, spatial.location = spatial.location,  : 
  Please provide the same number of observations as spatial locations.

@ellimarip
Copy link

ellimarip commented Apr 3, 2024

I have the same issue as @tingchiafelix and modifying the parameter 'return.only.var.genes=FALSE' results in the same other error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more-information-needed We need more information before this can be addressed
Projects
None yet
Development

No branches or pull requests

5 participants