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

Cannot Run 2D flowClust with current openCyto #91

Closed laderast closed 9 years ago

laderast commented 9 years ago

Hi,

I am trying to run openCyto with the 2D versions of flowClust. When I try to run this line in my template file:

> csvGates[1,]
   alias      pop parent    dims gating_method gating_args collapseDataForGating groupBy
1:  live Pt1+NA1+   root Pt1,NA1  flowClust.2d   K=1,min=1                    NA      NA
   preprocessing_method preprocessing_args plotting  hide
1:      prior_flowClust                K=1  Pt1,NA1 FALSE

I am getting this error when I try to run the gating template:

> gating(testT,gsTest)
Preprocessing for 'NA1+'
Gating for 'NA1+'
Error in (function (fs, pp_res, gFunc, popAlias, channels, gFunc_args)  : 
  failed at NULL
Error in .flowClust.2d(fr = <S4 object of class structure("flowFrame", package = "flowCore")>,  : 
  invalid number of channels for flowClust.2d!

I think I've managed to pinpoint the problem in .preprocess_row() in that the channels argument gets expanded into the 1d rows with a refGate:

csvGates <- data.table::as.data.table(csvGates)
openCyto:::.preprocess_row(csvGates[1,])
   alias      pop parent    dims gating_method         gating_args collapseDataForGating
1:  Pt1+     Pt1+   root     Pt1  flowClust.2d           K=1,min=1                    NA
2:  NA1+     NA1+   root     NA1  flowClust.2d           K=1,min=1                    NA
3:  live Pt1+NA1+   root Pt1,NA1       refGate root/Pt1+:root/NA1+                      
   groupBy preprocessing_method preprocessing_args
1:      NA      prior_flowClust                K=1
2:      NA      prior_flowClust                K=1
3:                                                

Here is my sessionInfo:

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] flowDensity_1.2.0         Rgraphviz_2.12.0          knitr_1.10.5             
 [4] flowClust_3.6.0           clue_0.3-50               corpcor_1.6.7            
 [7] mnormt_1.5-3              ellipse_0.3-8             RBGL_1.44.0              
[10] graph_1.46.0              Biobase_2.28.0            BiocGenerics_0.14.0      
[13] flowUtils_1.32.0          openCyto_1.7.1            flowWorkspace_3.14.4     
[16] gridExtra_0.9.1           ncdfFlow_2.14.0           BH_1.58.0-1              
[19] RcppArmadillo_0.5.200.1.0 flowViz_1.32.0            lattice_0.20-31          
[22] flowCore_1.34.3           XML_3.98-1.2  
mikejiang commented 9 years ago

flowClust.2d is supposed to perform a 2d gating on two dimensions. But your pop column ('Pt1+NA1+') tells the template parser to treat it as two 1d gating on Pt1 and NA1+ and construct the 3rd quadrant (i.e. ++) from them . That is the reason flowClust.2d complained about the dimensions.

So the right thing to do is to change the pop to Pt1NA1+

laderast commented 9 years ago

Thanks, Mike. That was a subtle point that I missed.