HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
67 stars 30 forks source link

prepData cannot read in fcs file is an empty value in header #273

Closed jillbo1000 closed 2 years ago

jillbo1000 commented 2 years ago

We are writing a package for downstream analysis of CyTOF data. We love CATALYST and would like to use it as the method for our users to read in their initial data. The CyTOF core from which we get a substantial part of our data has updated their CyTOF machines and by default it leave one of the header values empty. This throws an error when we try to import data using prepData. We can manually fill the value or ask the core to put a value there when they return our files, but I am certain that we are not the only ones who will have this issue with their data source. We can write a wrapper that will take care of the problem for our package, but we think it would be ideal if we could use the prepData function directly from CATALYST. Are you planning to add an option to prepData such as the "emptyValue" argument in the read.FCS function from flowCore or provide a way for fcs files with empty headers to be imported with prepData?

SamGG commented 2 years ago

Hi, I am not of the dev team, but could you share a FCS that has this behavior? It would easier to understand. Best.

jillbo1000 commented 2 years ago

I don't believe I am at liberty to share the actual fcs file, but the error I get is:

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!

The problem is that the OP keyword is empty with a value of " ". read.FCS can read in the file when the emptyValues = TRUE option is specified, but prepData does not have this option so it throws an error when the fcs file is passed to it. I have several files from this core where this keyword is empty so it seems to be their default and the information is not needed. I have a way to code a workaround, but I suspect this is a problem that will become more prevalent as more labs upgrade their machine and it may affect CATALYST.

SamGG commented 2 years ago

prepData is calling read.flowSet that calls read.FCS. The default value of emptyValue is TRUE. So I guess that you mean setting emptyValue to FALSE. I have not seen this problem recently. IMHO prepData should offer emptyValue as an extra argument if emptyValue has to be set to FALSE for these FCS files. Unless you are using a very secret panel, try this function to print an hexadecimal view of the file header. https://github.com/RGLab/flowCore/issues/130 Best.

HelenaLC commented 2 years ago

Hey all, sorry for the delay - along with some recent fixes/updates, prepData() now exposes a dots ... argument to be passed to flowCore::read.FCS(), including emptyValue. Hoping that this resolves the above - feel free to re-open if it doesn't or you have further comments/issues/suggestions in this context.