FlowJo workspace import #78
Replies: 5 comments 6 replies
-
Hi @schienstockd , sorry for the late reply! I have actually been thinking about this quite a bit. I am keen to get something like this working, and I'm sure it can be done, but we are a bit tied up with some other major developments at the moment. Are you using flowWorkspace at the moment? |
Beta Was this translation helpful? Give feedback.
-
Yes, I analyse my samples in R with flowWorkspace, openCyto and ggcyto. Most people in the lab use FlowJo for gating but some would like to use R for further analysis. It would be good to make this transition relatively painless. How can I load data into spectre? Do I need to save the populations as CSV or could I also push a list of data.tables somehow? library(CytoML)
library(ggcyto)
# read FlowJo workspace
wsfile <- "path/to/workspace.wsp"
ws <- open_flowjo_xml(wsfile)
# get second group
gs <- flowjo_to_gatingset(ws, name = 2)
# get a list of data.tables
subsets <- c("T cells", "B cells", "DC")
wsSubsets <- list()
for (subset in subsets) {
# fortify gating set
attr(gs, "subset") <- subset
wsSubsets[[subset]] <- fortify(gs)
}
# How to open that in spectre.. ? |
Beta Was this translation helpful? Give feedback.
-
It should very much be possible to extract a list of I'll try out this approach on Monday, as you've peaked my curiosity, but you might get an answer before that. What exactly does the |
Beta Was this translation helpful? Give feedback.
-
Would you mind helping me understand the advantage of importing the whole workspace versus what is being described here (https://wiki.centenary.org.au/display/SPECTRE/Exporting+data+from+FlowJo+for+analysis+in+Spectre)? I thought exporting gated population of interest from each sample as csv would give me more control how to process these data before downstream analysis? Thank you all! |
Beta Was this translation helpful? Give feedback.
-
Here is a naive start. Then you will have all populations in one library(CytoML)
library(ggcyto)
library(data.table)
# Load FlowJo workspace
load.flowjo.gs <- function(wsp.file, sample.group = 1) {
# read FlowJo workspace
ws <- open_flowjo_xml(wsp.file)
# get sample group
gs <- flowjo_to_gatingset(ws, name = sample.group)
gs
}
# get gated populations from FlowJo workspace
gated.pops.to.data.table <- function(gs, gated.pops) {
# get subsets
subset.list <- lapply(gated.pops, function(x) {
# fortify gating set
attr(gs, "subset") <- x
y <- fortify(gs)
# add population name
y[, ("FlowPop") := x]
y
})
# bind
DT <- rbindlist(subset.list)
# prepare data table
DT[, c(".rownames") := NULL]
setnames(DT, "name", "FileName")
DT[, FileNo := .GRP, by = .(FileName)]
DT
}
# load workspace
flowjo.gs <- load.flowjo.gs("path/to/workspace.wsp", sample.group = 2)
# get population table
gated.pops <- gated.pops.to.data.table(flowjo.gs, c("cDC1", "cDC2", "pDC")) |
Beta Was this translation helpful? Give feedback.
-
Hello,
You have a cool framework - I was just wondering whether I could import a FlowJo Workspace directly into spectre?
I have seen your tutorial:
https://wiki.centenary.org.au/display/SPECTRE/Exporting+data+from+FlowJo+for+analysis+in+Spectre
Could we utilise flowWorkspace somehow?
https://github.com/RGLab/flowWorkspace
Thanks!
Dominik
Beta Was this translation helpful? Give feedback.
All reactions