gtluu / cardinalscripts

MIT License
0 stars 2 forks source link

spatialShrunkenCentroidsWrapper and optimizeSParam errors #5

Open goterm opened 9 months ago

goterm commented 9 months ago

Hi, I am trying to implement your functions into my workflow but I have encountered an issue.

1-When I run: ssc2 <- spatialShrunkenCentroidsWrapper(mydata2, r=c(2, 4), k=c(5, 10), s=c(0)) I get this error message: Error in spatialShrunkenCentroidsWrapper(mydata2, r = c(2, 4), k = c(5, : object 'rparam' not found I solved this by replacing the first line of the function with: function (dataset, rparam = 1, kparam = 3, sparam = 0, ...))

2- When I run Ssc3 <- spatialShrunkenCentroids(mydata2, r=rparam, k=kparam, s=sparam) sscParams <- optimizeSSCParams(Ssc3, sparam, rparam, kparam) I get this error message: Error in optimizeSParam(sscDf, sparam, plotS) : object 'kneed' not foundCalled from:

I have tried debugging this second part but I failed. I was wondering if you could help me out. Thanks

gtluu commented 7 months ago

Hi @goterm , as of cardinalscripts 0.3.0, I've made some updates to no longer require Python packages to run optimizeSSCParams(). I've also also deprecated the various wrapper functions, as those were written for Cardinal 2.4.0 and should no longer be necessary. I've tested this on R 4.3.1 using Cardinal 3.4.1 using an imaging dataset found in MSV000091441 (2022FEB02_jbc_ims_tims) and converted to imzML using TIMSCONVERT 1.6.1. The complete sessionInfo() can be found below. Let me know if you have any further issues or encounter any more bugs.

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

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

time zone: America/Chicago
tzcode source: internal

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

other attached packages:
 [1] cardinalscripts_0.3.0 devtools_2.4.5        usethis_2.2.2        
 [4] ggplot2_3.4.4         kneedle_1.0.0         Cardinal_3.4.1       
 [7] S4Vectors_0.40.1      EBImage_4.44.0        BiocParallel_1.36.0  
[10] BiocGenerics_0.48.1   ProtGenerics_1.34.0  

loaded via a namespace (and not attached):
 [1] DBI_1.1.3          bitops_1.0-7       remotes_2.4.2.1    testthat_3.2.0    
 [5] rlang_1.1.2        magrittr_2.0.3     compiler_4.3.1     png_0.1-8         
 [9] fftwtools_0.9-11   callr_3.7.3        vctrs_0.6.4        stringr_1.5.0     
[13] profvis_0.3.8      pkgconfig_2.0.3    crayon_1.5.2       fastmap_1.1.1     
[17] ellipsis_0.3.2     utf8_1.2.4         promises_1.2.1     sessioninfo_1.2.2 
[21] ps_1.7.5           purrr_1.0.2        cachem_1.0.8       jsonlite_1.8.7    
[25] later_1.3.1        jpeg_0.1-10        tiff_0.1-11        irlba_2.3.5.1     
[29] parallel_4.3.1     prettyunits_1.2.0  R6_2.5.1           biglm_0.9-2.1     
[33] stringi_1.7.12     reticulate_1.34.0  pkgload_1.3.3      brio_1.1.3        
[37] Rcpp_1.0.11        zoo_1.8-12         httpuv_1.6.12      Matrix_1.5-4.1    
[41] tidyselect_1.2.0   rstudioapi_0.15.0  abind_1.4-5        codetools_0.2-19  
[45] miniUI_0.1.1.1     curl_5.1.0         processx_3.8.2     pkgbuild_1.4.2    
[49] lattice_0.21-8     tibble_3.2.1       Biobase_2.62.0     shiny_1.8.0       
[53] quantmod_0.4.25    withr_2.5.2        signal_0.7-7       ontologyIndex_2.11
[57] desc_1.4.2         urlchecker_1.0.1   xts_0.13.1         mclust_6.0.0      
[61] pillar_1.9.0       matter_2.4.0       generics_0.1.3     TTR_0.24.3        
[65] rprojroot_2.0.4    RCurl_1.98-1.13    munsell_0.5.0      fuzzyjoin_0.1.6   
[69] scales_1.2.1       xtable_1.8-4       glue_1.6.2         tools_4.3.1       
[73] locfit_1.5-9.8     fs_1.6.3           grid_4.3.1         colorspace_2.1-0  
[77] nlme_3.1-162       CardinalIO_1.0.0   cli_3.6.1          fansi_1.0.5       
[81] viridisLite_0.4.2  dplyr_1.1.3        gtable_0.3.4       digest_0.6.33     
[85] htmlwidgets_1.6.2  memoise_2.0.1      htmltools_0.5.7    lifecycle_1.0.4   
[89] mime_0.12          MASS_7.3-60