nolanlab / spade

SPADE: Spanning Tree Progression of Density Normalized Events
Other
46 stars 23 forks source link

fcsTextParse problem #134

Open nderian opened 7 years ago

nderian commented 7 years ago

Hello, I have an issue with fcsTextParse function. Is it a problem with my FCS files or a parameter I did not set well? Thanks in advance for your help.

SPADE.driver(files="./", file_pattern="*.fcs", out_dir="./results", cluster_cols=NULL, panels=NULL, comp=TRUE, arcsinh_cofactor=NULL, transforms=flowCore::arcsinhTransform(a=0, b=0.2), downsampling_target_number=25000, downsampling_target_pctile=NULL, downsampling_target_percent=NULL, downsampling_exclude_pctile=0.01, k=200, clustering_samples=25000, layout=igraph:::layout.kamada.kawai, pctile_color=c(0.02,0.98), fcs_channel_mappings_json=NULL) Downsampling file: ./example.fcs Estimated downsampling-I progress: 0% ... Estimated downsampling-I progress: 22% ... Estimated downsampling-I progress: 59% ... Estimated downsampling-I progress: 100% ... Error in fcsTextParse(txt, emptyValue = emptyValue) : Empty keyword name detected! If it is due to the double delimiters in keyword value, please set emptyValue to FALSE and try again! In addition: Warning message: In write.FCS(out_frame, outfilename) : 'write.FCS' is not fully tested and should be considered as experimental.

sessionInfo() R version 3.3.2 (2016-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 14393)

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

other attached packages: [1] spade_1.10.4 Rclusterpp_0.2.4 Rcpp_0.12.8 igraph_1.0.1 BiocInstaller_1.24.0 devtools_1.12.0

loaded via a namespace (and not attached): [1] graph_1.52.0 cluster_2.0.5 magrittr_1.5 BiocGenerics_0.20.0 flowCore_1.40.3 lattice_0.20-34
[7] R6_2.2.0 rrcov_1.4-3 pcaPP_1.9-61 httr_1.2.1 tools_3.3.2 parallel_3.3.2
[13] grid_3.3.2 Biobase_2.34.0 corpcor_1.6.8 git2r_0.16.0 withr_1.0.2 matrixStats_0.51.0 [19] digest_0.6.10 curl_2.3 memoise_1.0.0 robustbase_0.92-7 DEoptimR_1.0-8 stats4_3.3.2
[25] mvtnorm_1.0-5

zbjornson commented 7 years ago

That message means that your FCS file header is corrupt because of an empty keyword or incorrectly escaped delimiter. Is your file straight off of a cytometer or was it preprocessed?

FCS files can be manually repaired, carefully. If this is a one-time thing that's a viable option, but otherwise I'd try to fix the problem upstream.

SamGG commented 7 years ago

I already faced the same problem using the write.FCS function. In fact, the default delimiter used by write.FCS is anti-slash. This delimiter is OK for Mac and Linux, but not fine for Windows because it is Windows path delimiter. In fact, your original FCS files are fine, but the FCS files created during SPADE process appear corrupted because the write.FCS() and read.FCS() are not reversible when using an (absolute?) path file name. As a workaround, Mike Jiang added an option emptyValue and the reported error encourages you to set emptyValue to FALSE. I am not sure you can pass this parameter to the SPADE driver. Zach could tell you more about that. As an alternative, you could try redefine/overload the write.FCS function either setting emptyValue = FALSE either setting delimiter = "\f". The latter option sets formfeed as delimiter and sounds better IMHO. Best.

# First load all your libraries and others
library(flowCore)
library(spade)
# Then before calling SPADE.driver, try to redefine write.FCS
write.FCS = function(...) flowCore::write.FCS(delimiter = "\f", ...)  # untested
nderian commented 7 years ago

Thank you both for your help, I will try your options and keep you in touch. Best