Closed fbenedett closed 5 years ago
Hi,
I think the CSV file in not in the correct format. Could you add (drag'n drop) the CSV file to your issue?
Could you copy and pas the results of the sessionInfo()
command?
Best.
I don't know about the csv file. I practically took it from the example in the guide and added the gating_args for the "nonDebris". but anyway. Here it is basic_gating.zip
The sessionInfo() is the following: essionInfo() R version 3.6.0 (2019-04-26) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.2 LTS
Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] fpc_2.2-2 hexbin_1.27.3 openCyto_1.22.2 data.table_1.12.2 factoextra_1.0.5.999
[6] cluster_2.0.9 ggrepel_0.8.1 limma_3.40.2 multcomp_1.4-10 TH.data_1.0-10
[11] MASS_7.3-51.4 survival_2.44-1.1 mvtnorm_1.0-10 lme4_1.1-21 Matrix_1.2-17
[16] cowplot_0.9.4 RColorBrewer_1.1-2 ComplexHeatmap_2.0.0 Rtsne_0.15 ConsensusClusterPlus_1.48.0
[21] ggridges_0.5.1 pheatmap_1.0.12 reshape2_1.4.3 matrixStats_0.54.0 dplyr_0.8.1
[26] ggcyto_1.12.0 flowWorkspace_3.32.0 ncdfFlow_2.30.1 ggplot2_3.1.1 BH_1.69.0-1
[31] RcppArmadillo_0.9.400.3.0 flowCore_1.50.0 readxl_1.3.1 FlowSOM_1.16.0 igraph_1.2.4.1
loaded via a namespace (and not attached):
[1] minqa_1.2.4 colorspace_1.4-1 rjson_0.2.20 class_7.3-15 modeltools_0.2-22 mclust_5.4.3 circlize_0.4.6
[8] corpcor_1.6.9 GlobalOptions_0.1.0 clue_0.3-57 rstudioapi_0.10 IDPmisc_1.1.19 flexmix_2.3-15 codetools_0.2-16
[15] splines_3.6.0 R.methodsS3_1.7.1 mnormt_1.5-5 robustbase_0.93-5 knitr_1.23 nloptr_1.2.1 kernlab_0.9-27
[22] png_0.1-7 R.oo_1.22.0 graph_1.62.0 rrcov_1.4-7 compiler_3.6.0 assertthat_0.2.1 lazyeval_0.2.2
[29] tools_3.6.0 gtable_0.3.0 glue_1.3.1 Rcpp_1.0.1 Biobase_2.44.0 cellranger_1.1.0 nlme_3.1-140
[36] xfun_0.7 stringr_1.4.0 gtools_3.8.1 XML_3.98-1.20 DEoptimR_1.0-8 zlibbioc_1.30.0 zoo_1.8-6
[43] scales_1.0.0 parallel_3.6.0 RBGL_1.60.0 sandwich_2.5-1 yaml_2.2.0 gridExtra_2.3 latticeExtra_0.6-28
[50] stringi_1.4.3 pcaPP_1.9-73 flowClust_3.22.0 BiocGenerics_0.30.0 boot_1.3-22 shape_1.4.4 flowViz_1.48.0
[57] prabclus_2.3-1 rlang_0.3.4 pkgconfig_2.0.2 fda_2.4.8 lattice_0.20-38 purrr_0.3.2 ks_1.11.5
[64] labeling_0.3 tidyselect_0.2.5 plyr_1.8.4 magrittr_1.5 R6_2.4.0 pillar_1.4.1 withr_2.1.2
[71] nnet_7.3-12 tibble_2.1.3 tsne_0.1-3 crayon_1.3.4 KernSmooth_2.23-15 ellipse_0.4.1 GetoptLong_0.1.7
[78] Rgraphviz_2.28.0 diptest_0.75-7 digest_0.6.19 dbscan_1.1-3 R.utils_2.8.0 flowStats_3.42.0 RcppParallel_4.4.3
[85] stats4_3.6.0 munsell_0.5.0
See section 8 of the flowCore vignette. http://bioconductor.org/packages/devel/bioc/vignettes/flowCore/inst/doc/HowTo-flowCore.pdf
Your file is not a CSV although you copied it from the output of R. The CSV content should like as below in Excel/LibreOffice before saving it. You will find the right CSV by typing the following command system.file("extdata/gating_template/tcell.csv", package = "openCyto")
. You can copy it in your working folder with the following command file.copy(system.file("extdata/gating_template/tcell.csv", package = "openCyto"), "../basic_gating.csv")
.
The vignette you are using is OK, but you have to understand which are the parts need to be adapted to your test. For example the location and content of the CSV file. You will ease your learning curve if you can find someone with programming skills in R or any language. Check your CSV file with Excel or so, and double check it by opening it in RStudio as text file.
Best.
alias | pop | parent | dims | gating_method | gating_args | collapseDataForGating | groupBy | preprocessing_method | preprocessing_args |
---|---|---|---|---|---|---|---|---|---|
nonDebris | + | root | FSC-A | mindensity | |||||
singlets | + | nonDebris | FSC-A,FSC-H | singletGate |
I don't see how gfinak.
First I am unable to load my csv file with the gating strategy:
gtFile <- system.file("../basic_gating.csv", package = "openCyto")
dtTemplate <- fread(gtFile, autostart = 1L)
This is probably due to system.file, where is it looking? Then, autostart seems deprecated and it won't work.
I could follow the strategy in flowCore and create some manual gating, but this is not the aim. The aim would be to estimate the optimal gating with mindensity for each flowFrame and apply it.
Your file is not a CSV although you copied it from the output of R. The CSV content should like as below in Excel/LibreOffice before saving it. You will find the right CSV by typing the following command
system.file("extdata/gating_template/tcell.csv", package = "openCyto")
. You can copy it in your working folder with the following commandfile.copy(system.file("extdata/gating_template/tcell.csv", package = "openCyto"), "../basic_gating.csv")
. The vignette you are using is OK, but you have to understand which are the parts need to be adapted to your test. For example the location and content of the CSV file. You will ease your learning curve if you can find someone with programming skills in R or any language. Check your CSV file with Excel or so, and double check it by opening it in RStudio as text file. Best. alias pop parent dims gating_method gating_args collapseDataForGating groupBy preprocessing_method preprocessing_args nonDebris + root FSC-A mindensity
singlets + nonDebris FSC-A,FSC-H singletGate
Indeed. To copy the file from the browser and use it as template was a mistake. I fixed it. Now the csv file is correctly recognized. Running some tests I also found that with my current script there is no need of "system.file". The script would be something like this:
dtTemplate <- fread("../basic_gating.csv") gt_cell=gatingTemplate("../basic_gating.csv") gs=GatingSet(fset) gating(gt_cell, gs) fs_nonDebris <-getData(gs, "NonDebris")
Unfortunately, I have nobody to ask, otherwise I would have done so instead of writing here.
Alternatively, you can use add_pop
to apply the two gates incrementally without writing a csv.
add_pop(gs, "nonDebris", "+", "root", "FSC-A", "mindensity")
add_pop(gs, "singlet", "+", "nonDebris", "FSC-A,FSC-H", "singletGate")
library(ggcyto)
autoplot(gs[[1]])
add_pop
also returns a single-row data.table, which you can assign/rbind to a variable and write to a csv for reuse.
Thank you all for the help.
Sorry, one last comment for future reference in case people have a similar problem. The content of the csv file would be like this: alias,pop,parent,dims,gating_method,gating_args,collapseDataForGating,groupBy,preprocessing_method,preprocessing_args nonDebris,+,root,FSC_A,mindensity,"gate_range=c(0,2e5),adjust=1.5",,,, singlets,+,nonDebris,"FSC_A,FSC_H",singletGate,"maxit=50, wider_gate=TRUE",,,, live_death1,+,singlets,"Live_Death",mindensity,"gate_range(2, 4)",,,,
Hello,
I am trying to follow the manual http://bioconductor.org/packages/release/bioc/vignettes/openCyto/inst/doc/openCytoVignette.html but at the moment I don't have much success. I fail to understand the basics here. I have a flow set, I would like to apply an automatic gating on the debris and the doublets. I started by writing a csv file according to the guide, but much smaller since I need just 2 gates. The file contain the following lines (there are also some "#" at the beginning of the line but they make they change the visualization of the lines here): alias pop parent dims gating_method 1: nonDebris + root FSC_A mindensity 2: singlets + nonDebris FSC_A,FSC_H singletGate gating_args collapseDataForGating groupBy 1: NA NA 2: gate_range=c(0,2e5),adjust=1.5 NA NA preprocessing_method preprocessing_args 1: NA 2: NA
(the names of the channel are correct, I replaced the "-" with "_") I tried to load it with: library(data.table) gtFile <- system.file("../basic_gating.csv", package = "openCyto") dtTemplate <- fread(gtFile) but I get an error (i checked carefully the location of the file, it is there): Error in fread(gtFile) : Input is empty or only contains BOM or terminal control characters
What is unclear for me is also the following: how do I obtain the gated flowFrames? With flowCore there is something like this: if p_g is a matrix that defines a polygonal gate on 2 specific channels then you can gate your data with: smaller=Subset(flow_set, p_g)
Is it possible to do the same here?