Is is possible to extract bi-exp transformation values embedded in a Flowjo worksheet, apply to compesanted fcs data and export the data as a CSV file by using flowWorkspace and/or flow core ? Any help will be appreciated.
library(flowWorkspace)
# load raw fcs
fcsfiles <- list.files(pattern = "CytoTrol", system.file("extdata", package = "flowWorkspaceData"), full = TRUE)[1]
fs <- read.ncdfFlowSet(fcsfiles)
# read spillover from fcs
comp <- spillover(fs[[1]])[[1]]
# compensate the fcs
fs <- compensate(fs, comp)
# read flowJo workspace
ws <- openWorkspace(system.file("extdata/manual.xml", package = "flowWorkspaceData"))
# parse it into GatingSet
#if biexp transformation is the only thing you need, then set execute to FALSE will bypass loading the data thus speed up the process
gs <- parseWorkspace(ws, name = 2, execute = F)
#extract transformation
trans <- getTransformations(gs[[1]])
# construct a transformList
trans <- transformList(from = colnames(comp), trans)
# apply to compensated data
fs <- transform(fs, trans)
#export the data to csv
for(sn in sampleNames(fs))
{
filename <- paste0(sn, ".csv")
write.csv(exprs(fs[[sn]]), file = filename)
}