saezlab / mistyR

Multiview Intercellular SpaTial modeling framework

Home Page:https://saezlab.github.io/mistyR/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

run_misty illegal column names error

mcaponegro opened this issue · comments

I have successfully used mistyR before, but for some reason with a new data set it is failing at the run_misty step with the following error:

misty.views %>% run_misty(results.folder = results_dir)

Training models
Error in (function (.x, .f, ..., .progress = FALSE)  : 
  ℹ In index: 1.
Caused by error in `purrr::map()`:
ℹ In index: 1.
ℹ With name: intraview.
Caused by error in `parse.formula()`:
! Error: Illegal column names in formula interface. Fix column names or use alternative interface in ranger.

Any idea why this might occur?

Additionally, this line is required, but not present in the vignette

misty.views[["intraview"]][["data"]] <- as_tibble(misty.views[["intraview"]][["data"]])

or run_misty throws:

Error in `purrr::map_int()`:
ℹ In index: 1.
ℹ With name: AATK.
Caused by error in `UseMethod()`:
! no applicable method for 'pull' applied to an object of class "c('matrix', 'array', 'double', 'numeric')"
Run `rlang::last_error()` to see where the error occurred.

I thought it may be column/row names, but nothing I altered would fix this result.
Thank you for your support.

R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] ComplexHeatmap_2.15.1 paletteer_1.5.0       dittoSeq_1.10.0       forcats_0.5.2        
 [5] stringr_1.5.0         readr_2.1.4           tidyr_1.3.0           tibble_3.1.8         
 [9] tidyverse_1.3.2       SeuratObject_4.1.3    Seurat_4.3.0          ggplot2_3.4.0        
[13] distances_0.1.9       purrr_1.0.1           dplyr_1.1.0           future_1.31.0        
[17] mistyR_1.8.1         

loaded via a namespace (and not attached):
  [1] utf8_1.2.3                  spatstat.explore_3.0-5      reticulate_1.28            
  [4] R.utils_2.12.2              tidyselect_1.2.0            htmlwidgets_1.6.1          
  [7] ranger_0.15.1               Rtsne_0.16                  aws.signature_0.6.0        
 [10] munsell_0.5.0               codetools_0.2-18            ica_1.0-3                  
 [13] miniUI_0.1.1.1              withr_2.5.0                 spatstat.random_3.0-1      
 [16] colorspace_2.1-0            progressr_0.13.0            Biobase_2.58.0             
 [19] filelock_1.0.2              knitr_1.41                  rstudioapi_0.14            
 [22] stats4_4.2.0                SingleCellExperiment_1.20.1 ROCR_1.0-11                
 [25] tensor_1.5                  listenv_0.9.0               MatrixGenerics_1.10.0      
 [28] labeling_0.4.2              GenomeInfoDbData_1.2.9      polyclip_1.10-4            
 [31] pheatmap_1.0.12             farver_2.1.1                parallelly_1.34.0          
 [34] vctrs_0.5.2                 generics_0.1.3              xfun_0.36                  
 [37] timechange_0.2.0            doParallel_1.0.17           rlist_0.4.6.2              
 [40] R6_2.5.1                    GenomeInfoDb_1.34.9         clue_0.3-63                
 [43] DelayedArray_0.24.0         bitops_1.0-7                spatstat.utils_3.0-1       
 [46] assertthat_0.2.1            promises_1.2.0.1            scales_1.2.1               
 [49] googlesheets4_1.0.1         gtable_0.3.1                globals_0.16.2             
 [52] goftest_1.2-3               rlang_1.0.6                 GlobalOptions_0.1.2        
 [55] splines_4.2.0               lazyeval_0.2.2              gargle_1.2.1               
 [58] spatstat.geom_3.0-5         broom_1.0.2                 BiocManager_1.30.19        
 [61] yaml_2.3.7                  reshape2_1.4.4              abind_1.4-5                
 [64] modelr_0.1.10               backports_1.4.1             httpuv_1.6.8               
 [67] tools_4.2.0                 ellipsis_0.3.2              RColorBrewer_1.1-3         
 [70] BiocGenerics_0.44.0         ggridges_0.5.4              Rcpp_1.0.10                
 [73] plyr_1.8.8                  base64enc_0.1-3             zlibbioc_1.44.0            
 [76] RCurl_1.98-1.10             deldir_1.0-6                GetoptLong_1.0.5           
 [79] pbapply_1.7-0               cowplot_1.1.1               S4Vectors_0.36.2           
 [82] lisi_1.0                    zoo_1.8-11                  SummarizedExperiment_1.28.0
 [85] haven_2.5.1                 ggrepel_0.9.2               cluster_2.1.4              
 [88] fs_1.6.0                    furrr_0.3.1                 magrittr_2.0.3             
 [91] data.table_1.14.6           scattermore_0.8             circlize_0.4.15            
 [94] lmtest_0.9-40               reprex_2.0.2                RANN_2.6.1                 
 [97] googledrive_2.0.0           fitdistrplus_1.1-8          matrixStats_0.63.0         
[100] hms_1.1.3                   patchwork_1.1.2             mime_0.12                  
[103] evaluate_0.20               xtable_1.8-4                readxl_1.4.1               
[106] shape_1.4.6                 IRanges_2.32.0              gridExtra_2.3              
[109] compiler_4.2.0              KernSmooth_2.23-20          crayon_1.5.2               
[112] R.oo_1.25.0                 htmltools_0.5.4             segmented_1.6-2            
[115] later_1.3.0                 tzdb_0.4.0                  aws.s3_0.3.21              
[118] lubridate_1.9.2             DBI_1.1.3                   dbplyr_2.2.1               
[121] MASS_7.3-60                 Matrix_1.5-3                cli_3.6.0                  
[124] R.methodsS3_1.8.2           parallel_4.2.0              igraph_1.3.5               
[127] GenomicRanges_1.50.2        pkgconfig_2.0.3             sp_1.6-0                   
[130] plotly_4.10.1               spatstat.sparse_3.0-0       foreach_1.5.2              
[133] xml2_1.3.3                  XVector_0.38.0              webshot_0.5.4              
[136] rvest_1.0.3                 digest_0.6.31               sctransform_0.3.5          
[139] RcppAnnoy_0.0.20            spatstat.data_3.0-0         rmarkdown_2.20             
[142] cellranger_1.1.0            leiden_0.4.3                uwot_0.1.14                
[145] curl_5.0.0                  kernlab_0.9-31              shiny_1.7.4                
[148] rjson_0.2.21                lifecycle_1.0.3             nlme_3.1-157               
[151] jsonlite_1.8.4              viridisLite_0.4.1           fansi_1.0.4                
[154] pillar_1.8.1                lattice_0.20-45             fastmap_1.1.0              
[157] httr_1.4.4                  survival_3.3-1              glue_1.6.2                 
[160] remotes_2.4.2               iterators_1.0.14            png_0.1-8                  
[163] presto_1.0.0                stringi_1.7.12              mixtools_2.0.0             
[166] rematch2_2.1.2              renv_0.16.0                 irlba_2.3.5.1              
[169] future.apply_1.10.0    

Do your variables have some characters that might be misinterpreted, such as '-', '+', '*', '/' etc.? I suggest renaming the variables to avoid this for examle by rename_with(your.tibble, make.names, allow_ = FALSE) or similar. Let me know if this helps.

That was it. I thought so, and I tried to gsub each special character I suspected were in the colnames of misty.intra[["intraview"]][["data"]] , but your solution is much more elegant. This worked for me, and only needs to be run on the input matrix or intraview:

misty.intra[["intraview"]][["data"]] <- as_tibble(misty.intra[["intraview"]][["data"]]) %>% 
     rename_with(., make.names, allow_ = FALSE)

Thank you for your support and timely response

Great to hear it worked out nicely. I'm closing this issue.