write.FCS() produces files which cannot be opened by CytExpert software
0
0
Entering edit mode
@05c4848e
Last seen 21 months ago
Austria

I've been trying to transfer custom parameters from one .FCS file to another but the resulting file cannot be opened in CytExpert software.

target_files <- choose.files()
metadata_sources <- choose.files()

for (i in 1:min(length(target_files),length(metadata_sources))) {
    target_fcs <- flowCore::read.FCS(target_files[i], transformation = FALSE, truncate_max_range = FALSE)
    metadata_source <- flowCore::read.FCS(metadata_sources[i], transformation = FALSE, truncate_max_range = FALSE)

    for (j in 1:metadata_source@description$CPTOT) {
        target_fcs@description[paste("CP", j, "N", sep = "", collapse = NULL)] <- metadata_source@description[paste("CP", j, "N", sep = "", collapse = NULL)]
        target_fcs@description[paste("CP", j, "V", sep = "", collapse = NULL)] <- metadata_source@description[paste("CP", j, "V", sep = "", collapse = NULL)]
    }
    target_fcs@description$CPTOT <- metadata_source@description$CPTOT

    print(paste("Saving file: ", target_files[i]))
    flowCore::write.FCS(target_fcs, target_files[i], delimiter = "\u000c") #Form Fill delimiter used by CytExpert
    rm(list = c("target_fcs", "metadata_source", "i", "j"))
}

The file is OK and opens in some programs but CytExpert is the one we're expected to use and for some reason it doesn't accept the output. The custom parameters had UTF-8 characters (which the package didn't handle correctly at all) but I made them all ASCII and the problem persists.

I don't think there's a way to batch transfer just the custom parameters without affecting other parts of the file in flowCore. Apparently something the package does during write.FCS() generates data clashing with CytExpert's FCS parser. It imports the text part of the file but cannot import the data.

flowCore • 700 views
ADD COMMENT

Login before adding your answer.

Traffic: 1073 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6