RGLab / CytoML

A GatingML Interface for Cross Platform Cytometry Data Sharing
GNU Affero General Public License v3.0
29 stars 14 forks source link

Import FlowJo WSP complains about not having $FIL #83

Closed SamGG closed 4 years ago

SamGG commented 4 years ago

Hi, I am working with normalized files from flowrepository FR-FCM-ZYAJ. Those FCS does not have $FIL keyword, which is optional in FCS 3.0 IIRC. Example http://flowrepository.org/experiments/1363/fcs_files/154228/download I got the error below. No hurry, I will export the few gated sets I need and work with those exported FCS. Interestingly reprex reports the workspace can't be parsed. Best.

> library(CytoML)
Warning messages:
1: package ‘CytoML’ was built under R version 4.0.0 
2: replacing previous import ‘ncdfFlow::filter’ by ‘dplyr::filter’ when loading ‘CytoML’ 
3: multiple methods tables found for ‘plot’ 
> ws <- open_flowjo_xml("FR-FCM-ZYAJ.wsp")
> ws
File location:  FR-FCM-ZYAJ.wsp 

Groups in Workspace
         Name Num.Samples
1 All Samples           8
> fj_ws_get_samples(ws)
Error in get_samples(x@doc) : $FIL keyword not found!
> fj_ws_get_sample_groups(ws)
    groupName groupID sampleID
1 All Samples       0        1
2 All Samples       0        2
3 All Samples       0        3
4 All Samples       0        4
5 All Samples       0        5
6 All Samples       0        6
7 All Samples       0        7
8 All Samples       0        8
> gs <- flowjo_to_gatingset(ws,name = 1)
Error in (function (ws, group_id, subset, execute, path, h5_dir, includeGates,  : 
  $FIL keyword not found!
> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

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

other attached packages:
[1] CytoML_1.13.10

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4            plyr_1.8.6            compiler_3.6.2        pillar_1.4.3          cytolib_1.9.22        RColorBrewer_1.1-2   
 [7] base64enc_0.1-3       tools_3.6.2           zlibbioc_1.32.0       digest_0.6.25         jsonlite_1.6.1        gtable_0.3.0         
[13] lifecycle_0.2.0       tibble_2.1.3          lattice_0.20-38       pkgconfig_2.0.3       png_0.1-7             rlang_0.4.5          
[19] graph_1.64.0          rstudioapi_0.11       Rgraphviz_2.30.0      yaml_2.2.1            parallel_3.6.2        gridExtra_2.3        
[25] stringr_1.4.0         dplyr_0.8.5           stats4_3.6.2          grid_3.6.2            tidyselect_1.0.0      glue_1.3.2           
[31] data.table_1.12.8     Biobase_2.46.0        R6_2.4.1              jpeg_0.1-8.1          XML_3.99-0.3          RBGL_1.62.1          
[37] latticeExtra_0.6-29   ggplot2_3.3.0         RProtoBufLib_1.9.7    purrr_0.3.3           magrittr_1.5          scales_1.1.0         
[43] matrixStats_0.56.0    BiocGenerics_0.32.0   assertthat_0.2.1      colorspace_1.4-1      flowWorkspace_3.35.12 flowCore_1.53.14     
[49] ncdfFlow_2.33.0       stringi_1.4.6         munsell_0.5.0         RcppParallel_5.0.0    crayon_1.3.4          ggcyto_1.15.2        
jacobpwagner commented 4 years ago

Have you tried passing sampleNloc="sampleNode" to the open_flowjo_xml call? We need to document it better, but that arg will determine where the parser ultimately looks for the sample name:

https://github.com/RGLab/CytoML/blob/9a7a3fd18a85cb0f14bb697862b1d6b1be218e47/inst/include/CytoML/flowJoWorkspace.hpp#L855-L891

The workspace parsing is probably failing because $FIL is not present in the keywords in the XML because it was not present in the original FCS files.

SamGG commented 4 years ago

Hi Jacob, Thanks for your quick reply. The sampleNloc argument is a feature of v1.13.13. I only have 1.13.10 which is the current version available as binary on bioc devel. Installing all that stuff on Windows is not direct, so I will wait the next bioc release. Close the issue if you think this argument solves my question, as I won't test it yet. Best.

jacobpwagner commented 4 years ago

Ah, sorry I didn't see the version. There should hopefully be an updated binary available soon. We were ironing out a few issues resulting from changes in R 4.0. I'll leave this open until we can confirm it fixes your issue.

SamGG commented 4 years ago

I fear that. Good luck!

mikejiang commented 4 years ago

It should be sampNloc, and is the argument for open_flowjo_xml, which is not new feature.

mikejiang commented 4 years ago

And yes, the name is odd, which needs to renamed more intuitvely.

jacobpwagner commented 4 years ago

Thanks, Mike. Just a mental autocomplete typo on my part.

SamGG commented 4 years ago

It works. Sorry, I didn't check the help as it's quite late. Thanks a lot.

jacobpwagner commented 4 years ago

Renamed it to sample_names_from in https://github.com/RGLab/CytoML/commit/2fbb356b0292f88046d98bb9f0fcb3ae4ca12cf0

joseph-sch commented 3 years ago

For the record, the correct option syntax is therefore now sample_names_from="sampleNode" (tested on CytoML version 2.1.12)