RGLab / openCyto

A package that provides data analysis pipeline for flow cytometry.
GNU Affero General Public License v3.0
77 stars 29 forks source link

Potential errors in "An Introduction to the openCyto package" vignette #209

Closed stefankolling closed 4 years ago

stefankolling commented 4 years ago

When running the openCytoVignette.R script, I receive the following 2 errors:

I've tried to wrap my head around these error messages, but can't seem to understand them. Maybe the code is not up to date anymore? I've run the actual vignette script above, but will attach a file with minimal code (openCytoVignette_U.zip) to reproduce the errors and also copy the console output and session info below.

Cheers, Stefan

Console:

library(flowWorkspaceData) library(flowWorkspace) library(ggcyto) library(openCyto) library(data.table)

----load-xml, eval=TRUE------------------------------------------------------

flowDataPath <- system.file("extdata", package = "flowWorkspaceData") gtFile <- system.file("extdata/gating_template/tcell.csv", package = "openCyto") gt_tcell <- gatingTemplate(gtFile, autostart = 1L) expanding pop: -/++/-

expanding pop: +/-+/-

expanding pop: +/-+/-

Adding population:nonDebris Adding population:singlets Adding population:lymph Adding population:cd3 Adding population:cd4+ Adding population:cd8+ Adding population:cd4+cd8+ Adding population:cd4-cd8+ Adding population:cd4+cd8- Adding population:cd4-cd8- Adding population:CD38+ Adding population:HLA+ Adding population:activated cd4 Adding population:CD38+ Adding population:HLA+ Adding population:activated cd8 Adding population:CD45_neg Adding population:CCR7_gate Adding population:CCR7+CD45RA+ Adding population:CCR7-CD45RA+ Adding population:CCR7+CD45RA- Adding population:CCR7-CD45RA- Adding population:CCR7+ Adding population:CD45RA+ Adding population:CCR7+CD45RA+ Adding population:CCR7-CD45RA+ Adding population:CCR7+CD45RA- Adding population:CCR7-CD45RA- Warning message: In fread(x, ...) : 'autostart' is now deprecated and ignored. Consider skip='string' or skip=n

gt_tcell --- Gating Template: default with 29 populations defined plot(gt_tcell) Error in .getMethodsTableMetaData(fdef, where, optional) : no methods table for generic ‘plot’ from package ‘base’ in package ‘Rgraphviz’

----load-fcs-----------------------------------------------------------------

fcsFiles <- list.files(pattern = "CytoTrol", flowDataPath, full = TRUE) ncfs <- read.ncdfFlowSet(fcsFiles) All FCS files have the same following channels: FSC-A FSC-H FSC-W SSC-A B710-A R660-A R780-A V450-A V545-A G560-A G780-A Time write CytoTrol_CytoTrol_1.fcs to empty cdf slot... write CytoTrol_CytoTrol_2.fcs to empty cdf slot... done! Warning messages: 1: '.local' is deprecated. Use 'keyword' instead. See help("Deprecated") 2: '.local' is deprecated. Use 'keyword' instead. See help("Deprecated") fr <- ncfs[[1]] gs <- GatingSet(ncfs) Error in unlink(normalizePath(tmp), recursive = TRUE) : 3 arguments passed to .Internal(unlink) which requires 4 gs A GatingSet with 1 samples`

SessionInfo():

`R version 4.0.0 alpha (2020-03-27 r78091) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale: [1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Portuguese_Portugal.1252 LC_MONETARY=Portuguese_Portugal.1252 [4] LC_NUMERIC=C LC_TIME=Portuguese_Portugal.1252

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

other attached packages: [1] Rgraphviz_2.31.0 graph_1.65.2 BiocGenerics_0.33.3 data.table_1.12.8
[5] openCyto_1.25.3 ggcyto_1.15.2 ncdfFlow_2.33.0 BH_1.72.0-3
[9] RcppArmadillo_0.9.850.1.0 flowCore_1.53.17 ggplot2_3.3.0 flowWorkspace_3.35.16
[13] knitr_1.28 flowWorkspaceData_2.23.2

loaded via a namespace (and not attached): [1] Biobase_2.47.3 splines_4.0.0 R.utils_2.9.2 ellipse_0.4.1 gtools_3.8.1 RcppParallel_5.0.0 [7] assertthat_0.2.1 highr_0.8 BiocManager_1.30.10 stats4_4.0.0 latticeExtra_0.6-29 RBGL_1.63.1
[13] robustbase_0.93-6 pillar_1.4.3 lattice_0.20-40 glue_1.3.2 digest_0.6.25 RColorBrewer_1.1-2 [19] colorspace_1.4-1 Matrix_1.2-18 R.oo_1.23.0 plyr_1.8.6 pcaPP_1.9-73 XML_3.99-0.3
[25] pkgconfig_2.0.3 fda_2.4.8.1 zlibbioc_1.33.1 mvtnorm_1.1-0 purrr_0.3.3 corpcor_1.6.9
[31] scales_1.1.0 jpeg_0.1-8.1 flowStats_3.45.5 tibble_3.0.0 farver_2.0.3 ellipsis_0.3.0
[37] withr_2.1.2 flowViz_1.51.0 hexbin_1.28.1 cli_2.0.2 mnormt_1.5-6 mclust_5.4.5
[43] magrittr_1.5 crayon_1.3.4 IDPmisc_1.1.20 evaluate_0.14 ks_1.11.7 R.methodsS3_1.8.0
[49] fansi_0.4.1 MASS_7.3-51.5 tools_4.0.0 flowClust_3.25.1 lifecycle_0.2.0 matrixStats_0.56.0 [55] stringr_1.4.0 munsell_0.5.0 cluster_2.1.0 compiler_4.0.0 rlang_0.4.5 rstudioapi_0.11
[61] labeling_0.3 cytolib_1.9.23 gtable_0.3.0 rrcov_1.5-2 R6_2.4.1 RProtoBufLib_1.9.7 [67] gridExtra_2.3 dplyr_0.8.5 clue_0.3-57 KernSmooth_2.23-16 stringi_1.4.6 Rcpp_1.0.4
[73] vctrs_0.2.4 png_0.1-7 DEoptimR_1.0-8 tidyselect_1.0.0 xfun_0.12 `

gfinak commented 4 years ago

I suspect these are issues related to R 4.0.0, I can confirm this is all running fine on R 3.6.1 I've heard of other issues related to "unlink" in R 4.0.0 but I don't know the specifics. I know we have put in or are in the process of putting in fixes to the flow packages related to these. Also the generic "plot" has been moved to "base" from "graphics" and it sounds like that's related to your plotting issue. This is also building error free on BiocC dev. We'll see if we can reproduce this. See the R 4.0.0 news file: https://cran.r-project.org/doc/manuals/r-devel/NEWS.html

mikejiang commented 4 years ago

The unlink error was fixed by @jacobpwagner in RGLab/flowWorkspace@6c1f8200a2ccca7ccdf2b022bc975234e82e6568, which should be in the latest flowWorkspace is 3.35.17 . Tts bioc windows binary is yet to be built, which requires the data package flowWorkspaceData 2.23.2 to be built first (probably will happen today).

jacobpwagner commented 4 years ago

The 3 vs 4 arguments error is probably resulting from a clash between the R versions. https://github.com/RGLab/flowWorkspace/commit/6c1f8200a2ccca7ccdf2b022bc975234e82e6568 fixed a slightly different issue.

unlink added an argument in R 4.0 (to make it 4), but it should have a default (so passing 3 arguments should be fine). However, if you do a simple installation of the newer development builds, it appears to continue to utilize some older files that don't appropriately pass down the default 4th arg. @stefankolling , I'd recommend removing your old R installation completely from the target installation directory before a clean install of the R-devel build. That is what it took for me to fix this 3 vs 4 error.

I may file a bug report/patch if I do some more digging, but anyway, this is a core R issue.

stefankolling commented 4 years ago

After @gfinak's comment, I went back to using R 3.6.3 and can confirm that everything works well there.

@jacobpwagner My copying of my R 3.6.3 library across to my R 4.0 folder may have been the culprit then. I will do a clean install of R 4.0 from scratch tomorrow to see if your solution works.

gfinak commented 4 years ago

First item in the NEW file for R 4.0.0 is: