DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
60 stars 13 forks source link

Cryptic Error when using cyto_plot #174

Open rwbaer opened 1 year ago

rwbaer commented 1 year ago

Briefly describe what you hope to achieve: I have defined some gating sets based on the master gating set using the cyto_select() command. After extracting the transfrom from the master dataset, I try to use cyto_plot to make a series of plots.

The requested plots seem to occur, but for each plot in the layout, I get the following cryptic error (and warning)

Error in if (cnt%%np == 0 | cnt == length(fr_list)) { : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In par(pars) : argument 1 does not name a graphical parameter

Am I doning something wrong? What does the error indicate? Is ;the warning of any importance, and what is it ltelling me? Am I failing to initialize somehting?

Outline the steps taken to attempt to reach this goal (paste code below):


# Pull transformers from GatingSet to use in drawing axis
tr <- cyto_transformer_extract(gsSamp)

# Pull out cytoset of single cells
macro <- cyto_extract(gsSamp, "HiOrange")
lowviolet = cyto_extract(gsSamp, "LowViolet")
medviolet = cyto_extract(gsSamp, "MedViolet")
hiviolet = cyto_extract(gsSamp, "HiViolet")
phago = cyto_extract(gsSamp, "Phagocytic")
unexposed = cyto_extract(gsSamp[[18]], parent = "HiOrange")

# 2 x 2 Layout of macrophage data
cyto_plot_custom(c(1,2))

# Axes on current scale
cyto_plot(macro,
          channels = c("FL3-AREA","FL1-AREA"),
          axes_trans = tr,
#          overlay = c(lowviolet, medviolet, hiviolet),
          title = "Macrophage Staining",
          layout = FALSE)

# Axes appropriately transformed
cyto_plot(macro,
          channels = c("FL3-AREA","FL1-AREA"),
          axes_trans = tr,
          overlay = unexposed,
          legend = FALSE,
          title = "Macrophage Staining (trans)", 
          layout = FALSE)

0# Compare M0 to M2 with Melanoma
gs_LM45_M0 = cyto_select(gsSamp, list(Phenotype = "M0", Bait = "LM45"))
gs_LM45_M2 = cyto_select(gsSamp, list(Phenotype = "M2", Bait = "LM45"))
gs_Jurkat_M0 = cyto_select(gsSamp, list(Phenotype = "M0", Bait = "Jurkat"))
gs_Jurkat_M2 = cyto_select(gsSamp, list(Phenotype = "M2", Bait = "Jurkat"))

tr <- cyto_transformer_extract(gsSamp)

# Plot M0 and M2 against melanoma bait
cyto_plot_custom(c(2,2))

cyto_plot(gs_LM45_M0,
          parent = "Single Cells",
          channels = c("FL3-AREA","FL1-AREA"),
          axes_trans = tr,
          title = paste0("M0 macrophages with LM45 Bait, ", eDate), 
          layout = FALSE)

cyto_plot(gs_LM45_M2,
          parent = "Single Cells",
          channels = c("FL3-AREA","FL1-AREA"),
          axes_trans = tr,
          title = paste0("M2 macrophages with LM45 Bait, ", eDate), 
          layout = FALSE)

cyto_plot(gs_Jurkat_M0,
          parent = "Single Cells",
          channels = c("FL3-AREA","FL1-AREA"),
          axes_trans = tr,
          title = paste0("M0 macrophages with Jurkat Bait, ", eDate), 
          layout = FALSE)

cyto_plot(gs_Jurkat_M2,
          parent = "Single Cells",
          channels = c("FL3-AREA","FL1-AREA"),
          contour_lines = 15,
          axes_trans = tr,
          title = paste0("M2 macrophages with Jurlat Bait, ", eDate), 
          layout = FALSE)

Include any associated screenshots or images here: Screenshot 2023-02-01 081349

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

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

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

other attached packages: [1] shiny_1.7.2 CytoExploreR_1.1.0 openCyto_2.8.4
[4] patchwork_1.1.2 ggcyto_1.24.1 flowWorkspace_4.8.0
[7] ncdfFlow_2.42.1 BH_1.78.0-0 RcppArmadillo_0.11.4.0.1 [10] flowCore_2.8.0 forcats_0.5.2 stringr_1.4.1
[13] dplyr_1.0.10 purrr_0.3.5 readr_2.1.3
[16] tidyr_1.2.1 tibble_3.1.8 ggplot2_3.3.6
[19] 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
[5] fda_6.0.5 digest_0.6.29 htmltools_0.5.3 fansi_1.0.3
[9] memoise_2.0.1 magrittr_2.0.3 googlesheets4_1.0.1 cluster_2.1.3
[13] ks_1.13.5 tzdb_0.3.0 hdrcde_3.4 aws.signature_0.6.0 [17] 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
[25] colorspace_2.0-3 rvest_1.0.3 rrcov_1.7-1 haven_2.5.1
[29] xfun_0.33 crayon_1.5.2 RCurl_1.98-1.9 jsonlite_1.8.2
[33] hexbin_1.28.2 graph_1.74.0 zoo_1.8-11 glue_1.6.2
[37] flowClust_3.34.0 gtable_0.3.1 gargle_1.2.1 zlibbioc_1.42.0
[41] DelayedArray_0.22.0 IDPmisc_1.1.20 Rgraphviz_2.40.0 BiocGenerics_0.42.0 [45] DEoptimR_1.0-11 scales_1.2.1 mvtnorm_1.1-3 DBI_1.1.3
[49] Rcpp_1.0.9 xtable_1.8-4 clue_0.3-61 reticulate_1.26
[53] rsvd_1.0.5 mclust_5.4.10 deSolve_1.33 umap_0.2.9.0
[57] stats4_4.2.1 htmlwidgets_1.5.4 httr_1.4.4 RColorBrewer_1.1-3
[61] ellipsis_0.3.2 rainbow_3.7 pkgconfig_2.0.3 XML_3.99-0.11
[65] R.methodsS3_1.8.2 flowViz_1.60.2 sass_0.4.2 dbplyr_2.2.1
[69] deldir_1.0-6 utf8_1.2.2 later_1.3.0 flowStats_4.8.2
[73] tidyselect_1.1.2 rlang_1.0.6 reshape2_1.4.4 visNetwork_2.1.2
[77] munsell_0.5.0 cellranger_1.1.0 tools_4.2.1 cachem_1.0.6
[81] cli_3.4.1 generics_0.1.3 broom_1.0.1 aws.s3_0.3.21
[85] evaluate_0.17 fastmap_1.1.0 yaml_2.3.5 knitr_1.40
[89] fs_1.5.2 EmbedSOM_2.1.2 robustbase_0.95-0 RBGL_1.72.0
[93] mime_0.12 rhandsontable_0.3.8 R.oo_1.25.0 pracma_2.4.2
[97] xml2_1.3.3 compiler_4.2.1 rstudioapi_0.14 curl_4.3.3
[101] png_0.1-7 reprex_2.0.2 bslib_0.4.0 pcaPP_2.0-2
[105] stringi_1.7.8 RSpectra_0.16-1 lattice_0.20-45 Matrix_1.5-1
[109] vctrs_0.4.2 pillar_1.8.1 lifecycle_1.0.3 flowAI_1.26.0
[113] jquerylib_0.1.4 data.table_1.14.2 bitops_1.0-7 corpcor_1.6.10
[117] httpuv_1.6.6 R6_2.5.1 latticeExtra_0.6-30 promises_1.2.0.1
[121] KernSmooth_2.23-20 gridExtra_2.3 RProtoBufLib_2.8.0 IRanges_2.30.1
[125] MASS_7.3-57 gtools_3.9.3 assertthat_0.2.1 openssl_2.0.3
[129] withr_2.5.0 mnormt_2.1.1 S4Vectors_0.34.0 parallel_4.2.1
[133] hms_1.1.2 grid_4.2.1 rmarkdown_2.17 MatrixGenerics_1.8.1 [137] googledrive_2.0.0 Rtsne_0.16 Biobase_2.56.0 lubridate_1.8.0
[141] base64enc_0.1-3 interp_1.1-3

emanuellegrody commented 1 year ago

Also ran into this problem (it actually wouldn't even plot for me beyond my first plot). The work around I used is to plot individually (gs[i]) and loop through your plots.