Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for FCS 3.2? #156

Open
alefrol638 opened this issue Apr 25, 2024 · 12 comments
Open

Support for FCS 3.2? #156

alefrol638 opened this issue Apr 25, 2024 · 12 comments

Comments

@alefrol638
Copy link

Dear CytoML Team,

I am trying to import gates from a workspace, which works with FCS files from the new BD software FACS CHORUS. The FCS files are FCS 3.2 and the function gives me the error, that the format is wrong:

 gs  <- flowjo_to_gatingset(open_flowjo_xml(wsp, sample_names_from="sampleNode"), name = 1,mc.cores = 7,path = <pathToFile>) #flowWorkspace package

Error: This does not seem to be a valid FCS2.0, FCS3.0 or FCS3.1 file

Is there a way to work with this workspace/FCS files?

Thanks!

@mikejiang
Copy link
Member

We don't have official support for 3.2 yet, did relax the check in flowcore RGLab/flowCore#263 so that it can be load there, I can do a similar change in cytolib to allow your workspace parsing proceed, but no guarantee it will work if your fcs is not fully compatible with 3.1

@alefrol638
Copy link
Author

all right, I would give it a try

@mikejiang
Copy link
Member

RGLab/cytolib#58

@mikejiang
Copy link
Member

I pushed the cytolib change to bioconductor develop branch:
To trigger the rebuild for CytoML, I bumped its version to 2.15.3 as well

@schraivo
Copy link

Hi CytoML Team, I have the same problem as alefrol638. I now use cytolib_2.15.3 and CytoML_2.15.2, should that still throw the same error when loading the FCS3.2 file? Here are the packages I have installed, which should be the latest ones:

cytolib 2.15.3 2024-08-28 [1] Github (RGLab/cytolib@4f42d85)
CytoML * 2.15.2 2024-08-22 [1] Github (b1c491e)
flowCore * 2.15.3 2024-08-20 [1] Github (RGLab/flowCore@761a60f)
flowWorkspace * 4.15.5 2024-06-24 [1] Github (RGLab/flowWorkspace@3951e19)

Thank you!

@mikejiang
Copy link
Member

shouldn't throw error, post your sessioninfo and reproducible script/example file so that we can trouble shoot

@schraivo
Copy link

schraivo commented Aug 30, 2024

Sure, here's an example. You need two files (sorry, didn't have smaller ones available, about 30 MB each):
WSP: https://oc.embl.de/index.php/s/g4Yh2gI3lX1cq46
FCS: https://oc.embl.de/index.php/s/qP8i3zpZp9rq0Ho

library(CytoML)
library(flowCore)
library(flowWorkspace)
library(tidyverse)

#Input files
dir <- "path to parent directory of the two downloaded files"
wsp <- list.files(dir, pattern = ".wsp")
fcs <- list.files(dir, pattern = ".fcs")

fc <- as_tibble(exprs(read.FCS(paste0(dir, fcs), truncate_max_range = FALSE)))

#Warning: The flowCore package does not fully support FCS3.2 yet

gs  <- flowjo_to_gatingset(open_flowjo_xml(paste0(dir, wsp), name = 1, sample_names_from = "sampleNode"), name = 1)

#Error: This does not seem to be a valid FCS2.0, FCS3.0 or FCS3.1 file

And the session info.

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Rocky Linux 8.8 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: FlexiBLAS OPENBLAS;  LAPACK version 3.11.0

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

time zone: Europe/Berlin
tzcode source: system (glibc)

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

other attached packages:
 [1] lubridate_1.9.3      forcats_1.0.0        stringr_1.5.0        dplyr_1.1.4          purrr_1.0.2         
 [6] readr_2.1.5          tidyr_1.3.1          tibble_3.2.1         ggplot2_3.5.1        tidyverse_2.0.0     
[11] flowWorkspace_4.15.5 flowCore_2.15.3      CytoML_2.15.2       

loaded via a namespace (and not attached):
 [1] gtable_0.3.5        xfun_0.41           Biobase_2.62.0      lattice_0.22-6      tzdb_0.4.0         
 [6] vctrs_0.6.5         tools_4.3.2         generics_0.1.3      stats4_4.3.2        curl_5.1.0         
[11] fansi_1.0.6         pkgconfig_2.0.3     data.table_1.15.4   RColorBrewer_1.1-3  S4Vectors_0.40.2   
[16] graph_1.80.0        lifecycle_1.0.4     compiler_4.3.2      munsell_0.5.1       htmltools_0.5.7    
[21] yaml_2.3.8          hexbin_1.28.3       pillar_1.9.0        RProtoBufLib_2.14.1 tidyselect_1.2.1   
[26] digest_0.6.33       stringi_1.7.12      fastmap_1.1.1       grid_4.3.2          colorspace_2.1-0   
[31] cli_3.6.3           magrittr_2.0.3      ncdfFlow_2.48.0     RBGL_1.78.0         XML_3.99-0.16.1    
[36] utf8_1.2.4          withr_3.0.0         scales_1.3.0        timechange_0.3.0    rmarkdown_2.25     
[41] httr_1.4.7          matrixStats_1.3.0   gridExtra_2.3       cytolib_2.15.3      hms_1.1.3          
[46] evaluate_0.23       knitr_1.45          rlang_1.1.4         Rcpp_1.0.12         glue_1.7.0         
[51] Rgraphviz_2.46.0    BiocGenerics_0.48.1 rstudioapi_0.15.0   jsonlite_1.8.8      R6_2.5.1           
[56] plyr_1.8.9          zlibbioc_1.48.2     ggcyto_1.30.2  

Thank you!

@mikejiang
Copy link
Member

The links provided above seem to be identical and point to the same fcs file, where is wsp file?

@mikejiang
Copy link
Member

I think I know the reason,cytolib is statically linked to flowWorkspace/CytoML packages, looks like you have cytolib up to date, try to re-install/compile flowWorkspace/CytoML so that they also contain the latest change from cytolib
I tested and it worked for me

library(flowWorkspace)

file="opensource/D118_2dg.fcs"
load_cytoframe_from_fcs(file)

@schraivo
Copy link

Hi Mike. Please apologize the delayed response. Unfortunately, it didn't work for me. I updated the links in my original post, hoping that you could have another look. Thank you very much!

@mikejiang
Copy link
Member

I was able to reproduce your error with fcs file you provided last time, then i re compiled/build packages in question i mentioned above, and problem went away.
so it's definitely something out of sync in your current installation. i can't further help if it is your installation environment issue, try to switch to another machine or person to verify. alternatively, purge your R and install everything from scratch

@schraivo
Copy link

Sounds good, thank you, Mike!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants