DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
61 stars 13 forks source link

Rstudio Session Crash on cyto_select() #156

Open rwbaer opened 2 years ago

rwbaer commented 2 years ago

Describe the bug RStudio session crashes when executing cyto_select. Because of the nature of this problem (crash with no error) I'm sharing a link to a zip of an RStudio project that contains "EffrocytosisAnalysisJen.R" that reproducibly (in my hands) causes the RStudio session to crash when running cyto_select() at lines 207, and at lines 230 and 231.

I don't know if the problem is related to my adding a data driven quad gate. (lines 101-162) or something more fundamental with cyto_select() itself. At the end of the day, the best way to share the seems to be google drive since it is above the 25 Mb limit. see https://drive.google.com/file/d/18FwiC-is02v9QCVNF_xwx_d7EkIlEdr5/view?usp=sharing,

To Reproduce Run the attached code "EffrocytosisAnalysisJen.R" through line 206 and watch it crash at line 207. I think if line 207 is replaced by: allBait = gsSamp[c(1:12)] that the crash will not occur. This shouldmanually be creating the same reference gating set as the cyto_select() statement, I believe.

Expected behavior No crash. I expect the cyto_select() selection to work or produce an error message if the code is doing something imporper

Desktop (please complete the following information):

sessionInfo() R version 4.2.1 (2022-06-23 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22622)

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

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

other attached packages: [1] shiny_1.7.2 patchwork_1.1.2 ggcyto_1.24.1 ncdfFlow_2.42.1
[5] BH_1.78.0-0 RcppArmadillo_0.11.2.3.1 CytoExploreR_1.1.0 openCyto_2.8.4
[9] flowWorkspace_4.8.0 flowCore_2.8.0 forcats_0.5.2 stringr_1.4.1
[13] dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0
[17] tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2 readxl_1.4.1

loaded via a namespace (and not attached): [1] changepoint_2.2.3 backports_1.4.1 plyr_1.8.7 splines_4.2.1 fda_6.0.5
[6] digest_0.6.29 htmltools_0.5.3 fansi_1.0.3 memoise_2.0.1 magrittr_2.0.3
[11] googlesheets4_1.0.1 cluster_2.1.3 ks_1.13.5 tzdb_0.3.0 hdrcde_3.4
[16] aws.signature_0.6.0 modelr_0.1.9 RcppParallel_5.1.5 matrixStats_0.62.0 R.utils_2.12.0
[21] askpass_1.1 fds_1.8 cytolib_2.8.0 jpeg_0.1-9 colorspace_2.0-3
[26] rvest_1.0.3 rrcov_1.7-1 haven_2.5.1 xfun_0.32 crayon_1.5.1
[31] RCurl_1.98-1.8 jsonlite_1.8.0 hexbin_1.28.2 graph_1.74.0 zoo_1.8-10
[36] glue_1.6.2 flowClust_3.34.0 gtable_0.3.0 gargle_1.2.0 zlibbioc_1.42.0
[41] IDPmisc_1.1.20 Rgraphviz_2.40.0 BiocGenerics_0.42.0 DEoptimR_1.0-11 scales_1.2.1
[46] mvtnorm_1.1-3 DBI_1.1.3 Rcpp_1.0.9 xtable_1.8-4 clue_0.3-61
[51] reticulate_1.25 rsvd_1.0.5 mclust_5.4.10 deSolve_1.33 umap_0.2.8.0
[56] stats4_4.2.1 htmlwidgets_1.5.4 httr_1.4.4 RColorBrewer_1.1-3 ellipsis_0.3.2
[61] rainbow_3.6 farver_2.1.1 pkgconfig_2.0.3 XML_3.99-0.10 R.methodsS3_1.8.2
[66] flowViz_1.60.2 sass_0.4.2 dbplyr_2.2.1 deldir_1.0-6 utf8_1.2.2
[71] labeling_0.4.2 later_1.3.0 flowStats_4.8.2 tidyselect_1.1.2 rlang_1.0.4
[76] reshape2_1.4.4 visNetwork_2.1.0 munsell_0.5.0 cellranger_1.1.0 tools_4.2.1
[81] cachem_1.0.6 cli_3.3.0 generics_0.1.3 broom_1.0.0 aws.s3_0.3.21
[86] evaluate_0.16 fastmap_1.1.0 yaml_2.3.5 knitr_1.40 fs_1.5.2
[91] EmbedSOM_2.1.2 robustbase_0.95-0 RBGL_1.72.0 mime_0.12 rhandsontable_0.3.8 [96] R.oo_1.25.0 pracma_2.3.8 xml2_1.3.3 compiler_4.2.1 rstudioapi_0.14
[101] curl_4.3.2 png_0.1-7 reprex_2.0.2 bslib_0.4.0 pcaPP_2.0-2
[106] stringi_1.7.8 RSpectra_0.16-1 lattice_0.20-45 Matrix_1.4-1 vctrs_0.4.1
[111] pillar_1.8.1 lifecycle_1.0.1 flowAI_1.26.0 jquerylib_0.1.4 data.table_1.14.2
[116] bitops_1.0-7 corpcor_1.6.10 httpuv_1.6.5 R6_2.5.1 latticeExtra_0.6-30 [121] promises_1.2.0.1 gridExtra_2.3 KernSmooth_2.23-20 RProtoBufLib_2.8.0 MASS_7.3-57
[126] gtools_3.9.3 assertthat_0.2.1 openssl_2.0.2 withr_2.5.0 mnormt_2.1.0
[131] S4Vectors_0.34.0 parallel_4.2.1 hms_1.1.2 grid_4.2.1 rmarkdown_2.16
[136] googledrive_2.0.0 Rtsne_0.16 Biobase_2.56.0 lubridate_1.8.0 base64enc_0.1-3
[141] interp_1.1-3

Additional context Add any other context about the problem here.

rwbaer commented 2 years ago

As a follow-up, I tried replacing the lines of code using cyto_select with the equivalent manual selection, and I rearranged the order of the code. The code now progresses through the previous problems, but causes an RStudio session crash on line 319 which reads: nfiles = length(cyto_details(gsSamp)$name)

So, it appears that under certain circumstances cyto_details can become the cause of a similar crash to that induced previously by cyto_select(). Is this a clue?

I'm attaching the re-ordered code which is run with the same data. EffrocytosisAnalysisJen.zip

rwbaer commented 2 years ago

Perhaps I was making a 'type error' of sorts by writing: allBait = cyto_select(gsSamp, list(SampType = "Sample")) where my column heading in pData is SampType

when I should have written: allBait = cyto_select(gsSamp, list("SampType "= "Sample"))

However, I would have expected an "object SampType not found error" rather than a total RStudio crash. If I am correct about this error, it still be nice if CytoExplorer could somehow make the landing softer.

rwbaer commented 2 years ago

One other comment to make, is that the use of the single "=" operator here rather than the boolean "==" operater here is a little non-intuitive for me. There ARE examples in the documentation, but a slightly expanded verbal description of what's going on could be helpful as a heads-up to those of us "not in the know".