RGLab / CytoML

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

flowCore::read.FCS works but CytoML::flowjo_to_gatingset fails; no valid FCS file #152

Closed Close-your-eyes closed 1 year ago

Close-your-eyes commented 1 year ago

Dear community,

I have a few problematic FCS files which have been converted from .mqd files on a MacsQuant machine. Anyhow, not all files are affected. For some of them CytoML::flowjo_to_gatingset throws an error:

Error in (function (ws, group_id, subset, execute, path, cytoset, backend_dir, : This does not seem to be a valid FCS2.0, FCS3.0 or FCS3.1 file

But the files can be read with flowCore::read.FCS (setting emptyValue = F though).

Any idea how to approach the conflicting results and how to find out what's the issue?

Thanks.

Close-your-eyes commented 1 year ago

Here you can find a respective FCS file (https://www.dropbox.com/s/t3qaixahp6vze78/test.fcs?dl=0).

As described, flowCore::read.FCS works. But when the file is within a flowjo workspace and one tries to read the workspace with CytoML::flowjo_to_gatingset the above mentioned error comes up. Any ideas?

Close-your-eyes commented 1 year ago

I am also having a hard time to find out where this is triggered. I think it is somewhere in the C++ routine which I am not familiar with. I wonder what exactly makes the function think this is not a valid FCS file.

gfinak commented 1 year ago

What happens if you pass emptyValue = F to CytoML::flowjo_to_gatingset instead when reading the file?

Close-your-eyes commented 1 year ago

Same error.

SamGG commented 1 year ago

Incidentally, a colleague was facing a similar error using read.flowSet(path = "somedir"). In fact, there was a non FCS hidden file in the dir, which leads to the same error. As read.flowset does not show the file being invalid, it tooks me a few minutes before finding it, as all FCS files were correctly read with read.FCS. Maybe the same problem... Best, Samuel

Close-your-eyes commented 1 year ago

I tried to trace the error. So I isolated a respective FCS file and the related workspace. Hence I would say this is unlikely. Thanks for your input though.

SamGG commented 1 year ago

Your OS is MacOS, Linux or Windows?

Close-your-eyes commented 1 year ago

MacOS

SamGG commented 1 year ago

I cannot test this OS. I don't see why the FCS could be invalid. The raised error depends only checking the first bytes of the file. So very strange. I would apply list.files() to the directory that contains the FCS files. I think this the same directory as the workspace file. It might be surprising. What you could try is to add one of the following arguments to https://rdrr.io/bioc/CytoML/man/flowjo_to_gatingset.html():

Close-your-eyes commented 1 year ago

Thanks for your input I think I figured it out: It may have been a malformatted special character in the $FIL-Keyword. Some system along the way must have turned an Ü into something different. When I changed the $FIL-Keyword without extraordinary characters it worked.

While additional keywords can be added to identify FCS files by flowjo_to_gatingset(), the $FIL keyword appears to be obligatory.

I thought I tried to fix the issue that way earlier but it did not help then. When I tried again it did help.

Sorry for disturbing you.

SamGG commented 1 year ago

That's OK to try helping as long as the helpers get some feedback in the end. It's good to keep a track in order to help if the case occurs again. Your feedback really shows that only basic characters should be used from the very beginning, ie the acquisition. Thanks for your contribution.