RGLab / openCyto

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

quadGate.tmix and quadGate.seq not working #201

Closed jonasmac16 closed 3 years ago

jonasmac16 commented 4 years ago

I am trying to use the automated quadrant gating capability of openCyto via quadGate.seq and quadGate.tmix. However, I am running into issues and I went back to the example data to see if it was my dataset which caused the problem or if it was something else.

When I am running the above gating functions on the example data:

library(flowCore)
library(flowWorkspace)
library(openCyto)
library(ggcyto)

gs <- load_gs(system.file("extdata/gs_DC_auto", package = "flowWorkspaceData"))
fr <- getData(gs[[2]], "HLADR+")
chnl <- c("CD11c", "CD123")
p <- autoplot(fr, chnl[1], chnl[2])
g <- openCyto:::.quadGate.seq(fr, chnl, channels = chnl, gFunc="mindensity")
p + geom_gate(g)

I get the following error which is also the same error which is the same error I get when working on my dataset and calling it via add_pop:

Error in UseMethod("filter_") : 
  no applicable method for 'filter_' applied to an object of class "flowFrame"

What is going wrong here?

sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.3 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8
[6] LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] ggcyto_1.12.0 ggplot2_3.2.1 CytoML_1.10.0 CytoRSuite_0.9.9 flowStats_3.42.0
[6] cluster_2.1.0 flowClust_3.22.0 openCyto_1.22.2 dplyr_0.8.3 stringr_1.4.0
[11] here_0.1 flowWorkspace_3.32.0 ncdfFlow_2.30.1 BH_1.69.0-1 RcppArmadillo_0.9.800.1.0 [16] flowCore_1.50.0

loaded via a namespace (and not attached): [1] matrixStats_0.55.0 RColorBrewer_1.1-2 rprojroot_1.3-2 Rgraphviz_2.28.0 tools_3.6.1 backports_1.1.5 R6_2.4.0
[8] KernSmooth_2.23-16 lazyeval_0.2.2 BiocGenerics_0.30.0 colorspace_1.4-1 withr_2.1.2 tidyselect_0.2.5 gridExtra_2.3
[15] mnormt_1.5-5 compiler_3.6.1 graph_1.62.0 Biobase_2.44.0 rhandsontable_0.3.7 scales_1.0.0 DEoptimR_1.0-8
[22] hexbin_1.27.3 mvtnorm_1.0-11 robustbase_0.93-5 RBGL_1.60.0 digest_0.6.22 R.utils_2.9.0 rrcov_1.4-7
[29] base64enc_0.1-3 pkgconfig_2.0.3 htmltools_0.4.0 fastmap_1.0.1 htmlwidgets_1.5.1 rlang_0.4.1 shiny_1.4.0
[36] jsonlite_1.6 mclust_5.4.5 gtools_3.8.1 R.oo_1.22.0 magrittr_1.5 Matrix_1.2-17 Rcpp_1.0.2
[43] munsell_0.5.0 R.methodsS3_1.7.1 stringi_1.4.3 yaml_2.2.0 MASS_7.3-51.4 zlibbioc_1.30.0 plyr_1.8.4
[50] grid_3.6.1 promises_1.1.0 crayon_1.3.4 lattice_0.20-38 splines_3.6.1 pillar_1.4.2 RUnit_0.4.32
[57] fda_2.4.8 corpcor_1.6.9 stats4_3.6.1 XML_3.98-1.20 glue_1.3.1 latticeExtra_0.6-28 BiocManager_1.30.9 [64] data.table_1.12.6 RcppParallel_4.4.4 httpuv_1.5.2 gtable_0.3.0 purrr_0.3.3 clue_0.3-57 assertthat_0.2.1
[71] ks_1.11.5 mime_0.7 xtable_1.8-4 flowUtils_1.48.0 later_1.0.0 IDPmisc_1.1.19 pcaPP_1.9-73
[78] tibble_2.1.3 shinythemes_1.1.2 flowViz_1.48.0 ellipse_0.4.1

mikejiang commented 4 years ago

It works fine for the trunk version (i.e. bioc development branch, which will soon become the next release), so try BiocManager::install("openCyto", version = "devel", dependencies = T) to update packages

[1] hexbin_1.27.2             ggcyto_1.11.5             ncdfFlow_2.31.2           BH_1.69.0-1              
[5] RcppArmadillo_0.9.200.7.0 ggplot2_3.1.1             openCyto_1.23.4           flowWorkspace_3.33.8     
[9] flowCore_1.51.7 
sbg30 commented 2 months ago

Hi,

I am currently facing the same problem, I am trying to add a quad gate to an existing gatingset :

wsfile <- open_flowjo_xml('~/Documents/ICS/240506/fcs_files/07-May-2024.wsp') gatingset <- flowjo_to_gatingset(wsfile)

class(wsfile)

plot(gatingset) autoplot(gatingset[[2]])

gs_add_gating_method_init(gatingset)

gs_add_gating_method( gatingset, alias = "A,B,C,D", pop = "*", parent = "cd3neg", dims = "Comp-BUV563-A,Comp-BV605-A", gating_method = "gate_quad_sequential", gating_args = list(gFunc = 'mindensity') )

But it creates the following error:

Error in (function (fs, pp_res, gFunc, popAlias, channels, gFunc_args) : failed at 181503.fcs_0000000000000123906 Error in UseMethod("filter") : no applicable method for 'filter' applied to an object of class "flowFrame"

I also tried to create all the gates manually from raw data:

fcsfilesloaded <- load_cytoset_from_fcs(fcsfilesraw, transformation = F, compensation = F) [...] But I end up facing the same error

I made sure I had the last version of the different packages:

R version 4.4.1 (2024-06-14) Platform: aarch64-apple-darwin20 Running under: macOS Ventura 13.2.1

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.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0

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

time zone: Europe/Paris tzcode source: internal

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

other attached packages: [1] patchwork_1.2.0 paletteer_1.6.0 ggsci_3.2.0 forcats_1.0.0 rstatix_0.7.2
[6] ggpubr_0.6.0 stringr_1.5.1 gt_0.10.1 purrr_1.0.2 dplyr_1.1.4
[11] ggcyto_1.33.0 ncdfFlow_2.51.0 BH_1.84.0-0 ggplot2_3.5.1 flowAI_1.35.0
[16] CytoML_2.17.0 openCyto_2.17.1 flowWorkspace_4.17.0 flowCore_2.17.0

loaded via a namespace (and not attached): [1] changepoint_2.2.4 tidyselect_1.2.1 farver_2.1.2 fastmap_1.2.0 XML_3.99-0.17
[6] digest_0.6.36 lifecycle_1.0.4 magrittr_2.0.3 compiler_4.4.1 rlang_1.1.4
[11] tools_4.4.1 utf8_1.2.4 yaml_2.3.8 data.table_1.15.4 knitr_1.47
[16] ggsignif_0.6.4 labeling_0.4.3 htmlwidgets_1.6.4 plyr_1.8.9 xml2_1.3.6
[21] RColorBrewer_1.1-3 abind_1.4-5 withr_3.0.0 RProtoBufLib_2.17.0 BiocGenerics_0.51.0 [26] grid_4.4.1 stats4_4.4.1 fansi_1.0.6 colorspace_2.1-0 scales_1.3.0
[31] cli_3.6.3 rmarkdown_2.27 generics_0.1.3 rstudioapi_0.16.0 reshape2_1.4.4
[36] zlibbioc_1.51.1 parallel_4.4.1 BiocManager_1.30.23 matrixStats_1.3.0 vctrs_0.6.5
[41] jsonlite_1.8.8 carData_3.0-5 cytolib_2.17.0 car_3.1-2 S4Vectors_0.43.0
[46] RBGL_1.81.0 Rgraphviz_2.49.0 hexbin_1.28.3 tidyr_1.3.1 glue_1.7.0
[51] rematch2_2.1.2 stringi_1.8.4 gtable_0.3.5 munsell_0.5.1 tibble_3.2.1
[56] pillar_1.9.0 htmltools_0.5.8.1 graph_1.83.0 R6_2.5.1 evaluate_0.24.0
[61] lattice_0.22-6 Biobase_2.65.0 backports_1.5.0 broom_1.0.6 Rcpp_1.0.12
[66] flowClust_3.43.0 gridExtra_2.3 xfun_0.45 zoo_1.8-12 pkgconfig_2.0.3

Is there something I am doing wrong ?

Thanks