Open rohitfarmer opened 1 year ago
@rohitfarmer are you looking for population statistics? You can try gs_pop_get_count_fast
, which produces a matrix, which could then just be piped into a dataframe:
# Load FlowJo workspace (xml) file
wsFile <- file.path(file.path("covidflu", "WSP-without-id",
"20210727_COVID_FLU(act T cells).wsp"))
ws <- CytoML::open_flowjo_xml(file.path("covidflu", "WSP-without-id", "20210727_COVID_FLU(act T cells).wsp"))
# Parse
gs <- flowjo_to_gatingset(ws,
name = 2,
path = file.path("covidflu", "all-fcs-files"),
execute = TRUE)
# Using pop_get_count_fast
getdat <- gs_pop_get_count_fast(gs,
statistic = "freq",
format = "wide",
xml = TRUE)
# coerce to dataframe since the function produces a matrix
getdat_df <- get_dat |>
as.data.frame()
@miosisoniii no, I am interested in exporting individual cells with their marker values and time stamp. I can export them now; however, during the export, the values are being transformed that I cannot reverse. Therefore, values are not the same if I match them with the same population exported from FlowJo.
first of all, to fetch expression data matrix, you do not need to convert it to flowframe, exprs(getdat[[1]])
should do
secondly, /PBMC/Single Cells/Live/CD45+/Lymphocytes
gives you zero count, simply means there is no cell in that gate.
Finally, expression data matrix is stored as transformed scale after parsed from flowjo workspace into gatingset, in order to get raw scale, you switch inverse.transform
flag
for example
> dataDir <- system.file("extdata",package="flowWorkspaceData")
> gs_dir <- list.files(dataDir, pattern = "gs_manual",full = TRUE)
> gs <<- load_gs(gs_dir)
> head(flowCore::exprs(gs_pop_get_data(gs, "CD4")[[1]])[,5:7])
<B710-A> <R660-A> <R780-A>
[1,] 3106.004 3302.719 2073.3540
[2,] 3128.845 1834.073 1607.8027
[3,] 2902.931 2458.440 482.8756
[4,] 2928.725 1382.240 1510.5111
[5,] 2832.599 1277.941 714.8516
[6,] 2727.793 1704.678 678.8153
> head(flowCore::exprs(gs_pop_get_data(gs, "CD4", inverse.transform = T)[[1]])[,5:7])
<B710-A> <R660-A> <R780-A>
[1,] 21521.121 35399.8320 2342.2910
[2,] 22785.982 1105.2427 958.1031
[3,] 12979.613 4470.3438 -667.2806
[4,] 13837.313 431.4819 779.5670
[5,] 10906.154 341.7943 -326.7503
[6,] 8425.668 843.9904 -376.3401
Which Bioconductor version is the code from? It's not working for me. I had a similar problem before when I pointed out that the cell count from the gate was zero. I had to lower the Bioconductor version to make it work.
latest release. please provide your sessioninfo and reproducible sample in order for us to help you.
Hi there, I am working to export gated cell populations from a FlowJo workspace to an R data frame. My code fetches cells for the first few gates, and then I get a blank matrix; there are no errors. Any suggestions would be helpful. Thanks!
Below is the code for which I can fetch cells.
And below is the same code with the next gate beyond which I am getting nothing.
Here is my sessionInfo()