RGLab / flowWorkspace

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

get_singlecell_expression and pop.MFI no longer working #390

Open bilalmoiz93 opened 1 year ago

bilalmoiz93 commented 1 year ago

Hello,

I recently had to reinstall all my R packages. I noticed that with the new Flowcore installation, "get_singlecell_expression" no longer works. In fact, it returns

expression = gs_get_singlecell_expression_by_gate(gs,gateg) # get single cell expression values

.Error: Expected string vector of length 1

likewise gs_pop_get_stats(gs,gateg,type=pop.MFI))

returns Null data.table (0 rows and 0 cols)

DillonHammill commented 1 year ago

@bilalmoiz93 can please provide more context on the structure of gateg for troubleshooting? It should be the path of a node contained within the GatingSet and not a gate object.

bilalmoiz93 commented 1 year ago

Yes. Here is an example of my gateg object:

gateg [1] "/Live/FITC"

It is just the string detailing the node path

mikejiang commented 1 year ago

I can reproduce gs_get_singlecell_expression_by_gate error, gs_pop_get_stats seems to work fine to me though

> library(flowWorkspace)
> dataDir <- system.file("extdata",package="flowWorkspaceData")
> gs_dir <- list.files(dataDir, pattern = "gs_manual",full = TRUE)
> gs <- load_gs(gs_dir)
> gs_pop_get_stats(gs,"CD3+",type=pop.MFI)
                    sample  pop CD4 PcpCy55 CD38 APC CD8 APCH7 CD3 V450 HLA-DR V500  CCR7 PE CD45RA PECy7
1: CytoTrol_CytoTrol_1.fcs CD3+    2956.116 1799.201  1423.677 2621.537    1632.492 2089.478     2178.737
> mat <- gs_get_singlecell_expression_by_gate(gs, "CD3+")
.Error: Expected string vector of length 1
bilalmoiz93 commented 1 year ago

Thank you. I was also able to get the gs_pop_get_stats to work with the example you provided.

I dug into the code a bit more and it looks like my desc column is null whereas this is filled out for the relevant fields in your gating set. I think this might be the issue with my pop.MFI return. I will try it after adding descriptions and report back shortly.

bilalmoiz93 commented 1 year ago

actually i'm not sure how to edit the description. Is there a quick way to do this retroactively after importing the flow set/building gating set?

bilalmoiz93 commented 1 year ago

Ok that appeared to be the issue. I'm not sure why there is no description when reading it in. I tried reading it in

fs <- read.flowSet(path=folder,pattern=".fcs",alter.names=T,description = desc)

but that did not work.

Instead, I used the following code to remove all non-flourescent channels and then manually alter the description parameter. This worked for me and I was able to get MFI values when using gs_pop_get_stats(gs,gateg,pop.MFI)

desc = colnames(fs) desc = replace(desc,grepl('SSC',desc,fixed=TRUE),NA) desc = replace(desc,grepl('FSC',desc,fixed=TRUE),NA) desc = replace(desc,grepl('Time',desc,fixed=TRUE),NA)

for (f in 1:length(fs)){ pData(parameters(fs[[f]]))$desc = desc

}

mikejiang commented 1 year ago

fixed by https://github.com/RGLab/flowWorkspace/pull/391 install latest devel branch and give it a try