RGLab / flowWorkspace

flowWorkspace
GNU Affero General Public License v3.0
44 stars 21 forks source link

pass emptyValue argument to load_cytoset_from_fcs #323

Closed Biomiha closed 4 years ago

Biomiha commented 4 years ago

Hi,

I am experiencing an error when passing the emptyValue = FALSE argument to load_cytoset_from_fcs. If I try to read in a flowSet from e.g. FlowRepository_FR-FCM-ZZZ4_files//MVa2011-06-30_fcs31.fcs

load_cytoset_from_fcs(files[[36]], emptyValue = FALSE)

I get the following error: Error in fcs_to_cytoset(sapply(files, normalizePath), list(which.lines = which.lines, : Empty keyword name detected!If it is due to the double delimiters in keyword value, please set emptyValue to FALSE and try again!

Both read.FCS as well as read.flowSet read the same file in without error.

Thanks.

mikejiang commented 4 years ago

It is due to the trailing space in keywords section, which was taken care of by https://github.com/RGLab/flowCore/issues/172 in flowCore. But we forgot to do the same in cytolib codebase, sorry about that. I've just pushed the patch to both boic release and development branch. You will need to reinstall the latest cytolib and flowWorkspace from either github master branch or wait for bioc to build them tomorrow.

Biomiha commented 4 years ago

Thanks Mike. This now works as expected.

jacobpwagner commented 4 years ago

Just documenting this here for later reference:

boost::trim_right uses the locale to determine the set of characters to treat as whitespace to be trimmed. So, to match R's trimws used by flowCore here:

https://github.com/RGLab/flowCore/blob/a81ec1a84f851fc5f0fe4e711d10c68505647aac/R/IO.R#L695

I switched the cytolib code to use boost::trim_right_if and check for the same characters checked by default by trimws.

https://github.com/RGLab/cytolib/commit/28d236d77f676eb62ca624473ab2b579198656d8