openCyto Problem: Registered Gating Function Executes Twice when Called
1
0
Entering edit mode
@geoffreylewen-23586
Last seen 16 months ago

When calling a registered openCyto gating function using gs_add_gating_method(), the gating function is executed twice. As you can see from the example below, the plugin "testme" is executed twice when it is called. (This was discovered while testing actual gating functions, but this example is being used for the purpose of illustration.)

Any advice on how to fix this will be appreciated..

> library(openCyto)
> library(flowCore)
> library(flowWorkspace)
> 
> .testme<-function(fr,pp_res=NULL,channels, ...) {
+          print("Test")
+          Gate<-matrix(cbind(c(0,1,1,0),c(0,0,1,1)),byrow=TRUE,ncol=2)
+          colnames(Gate)<-channels
+          return(polygonGate(.gate = Gate))
+ }
> register_plugins(.testme, "testme")
Registered testme
[1] TRUE
> fcsfiles <- list.files(pattern = "CytoTrol", system.file("extdata", package = "flowWorkspaceData"), full = TRUE)
> fs <- read.flowSet(fcsfiles)
> gs<-GatingSet(fs)
> gs_add_gating_method(gs, alias="test",parent="root",dims="FSC-A,SSC-A", gating_method="testme")
...
[1] "Test"
[1] "Test"
done


> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] SDcycles_0.1.0      testthat_2.3.2      raster_3.1-5        sp_1.4-1           
[5] flowWorkspace_4.0.1 flowCore_2.0.0      openCyto_2.0.0     

loaded via a namespace (and not attached):
  [1] ncdfFlow_2.34.0     fs_1.4.1            matrixStats_0.56.0  usethis_1.6.1      
  [5] devtools_2.3.0      RColorBrewer_1.1-2  rprojroot_1.3-2     Rgraphviz_2.32.0   
  [9] backports_1.1.7     tools_4.0.0         R6_2.4.1            KernSmooth_2.23-17 
 [13] BiocGenerics_0.34.0 colorspace_1.4-1    withr_2.2.0         gridExtra_2.3      
 [17] tidyselect_1.1.0    prettyunits_1.1.1   mnormt_1.5-7        processx_3.4.2     
 [21] compiler_4.0.0      graph_1.66.0        cli_2.0.2           Biobase_2.48.0     
 [25] TSP_1.1-10          flowClust_3.26.0    ggcyto_1.16.0       desc_1.2.0         
 [29] flowStats_4.0.0     scales_1.1.1        DEoptimR_1.0-8      hexbin_1.28.1      
 [33] mvtnorm_1.1-0       robustbase_0.93-6   callr_3.4.3         RBGL_1.64.0        
 [37] stringr_1.4.0       digest_0.6.25       R.utils_2.9.2       rrcov_1.5-2        
 [41] jpeg_0.1-8.1        pkgconfig_2.0.3     sessioninfo_1.1.1   rlang_0.4.6        
 [45] rstudioapi_0.11     Rclusterpp_0.2.5    FNN_1.1.3           mclust_5.4.6       
 [49] gtools_3.8.2        dplyr_0.8.5         R.oo_1.23.0         magrittr_1.5       
 [53] RProtoBufLib_2.0.0  Matrix_1.2-18       Rcpp_1.0.4.6        munsell_0.5.0      
 [57] fansi_0.4.1         lifecycle_0.2.0     R.methodsS3_1.8.0   stringi_1.4.6      
 [61] MASS_7.3-51.6       zlibbioc_1.34.0     pkgbuild_1.0.8      plyr_1.8.6         
 [65] grid_4.0.0          parallel_4.0.0      crayon_1.3.4        lattice_0.20-41    
 [69] splines_4.0.0       SDMTools_1.1-221.2  ps_1.3.3            pillar_1.4.4       
 [73] igraph_1.2.5        fda_5.1.4           corpcor_1.6.9       codetools_0.2-16   
 [77] stats4_4.0.0        pkgload_1.0.2       XML_3.99-0.3        glue_1.4.1         
 [81] latticeExtra_0.6-29 remotes_2.1.1       data.table_1.12.8   RcppParallel_5.0.1 
 [85] foreach_1.5.0       png_0.1-7           vctrs_0.3.0         gtable_0.3.0       
 [89] citrus_0.08         purrr_0.3.4         clue_0.3-57         assertthat_0.2.1   
 [93] ggplot2_3.3.0       ks_1.11.7           pracma_2.2.9        CEC_0.10.2         
 [97] IDPmisc_1.1.20      pcaPP_1.9-73        tibble_3.0.1        iterators_1.0.12   
[101] cytolib_2.0.2       memoise_1.1.0       flowViz_1.52.0      ellipse_0.4.1      
[105] cluster_2.1.0       EMCluster_0.2-12    ellipsis_0.3.1     
openCyto register_plugins gs_add_gating_method • 163 views
ADD COMMENT
0
Entering edit mode
@geoffreylewen-23586
Last seen 16 months ago

There is nothing awry here. There are two flowFrames in the gating set, so when you call gs_add_gating_method, it runs the function twice.

ADD COMMENT
0
Entering edit mode

Sorry for the delay. Yes, you are correct that the method is just executing once for each sample.

ADD REPLY

Login before adding your answer.

Traffic: 214 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6