RGLab / openCyto

A package that provides data analysis pipeline for flow cytometry.
GNU Affero General Public License v3.0
77 stars 29 forks source link

Example of flowClust #105

Closed SamGG closed 7 years ago

SamGG commented 8 years ago

Hi, I would like the flowClust (either 1d or 2d) in order to make flowClust find a few clusters (2 to 8). I don't understand how the gates are return. Currently I only succeeded in getting one gate in return. It would be nice if you could give me an example. Best.

mikejiang commented 8 years ago

https://github.com/RGLab/openCyto/issues/73 described how to handle multiple gates generated by clustering-based gating algorithm. The gating function must return a multipleFilterResult object, which will be parsed and added to GatingHierarchy as multiple logical gate (or bool gate).

mikejiang commented 8 years ago

If you are more interested in getting multiple geometrical gates, you can write your wrapper function that parses the gating results from flowClust into a list of ellipseGate and coerce them to a single filters object as return value. Here I am talking about flowClust package in stead of flowClust.2d wrapper function.

Regarding to how to parse flowClust result into ellipseGate, you can look at flowClust.2d.

quadGate.tmix shows you how to return a filters as results.

SamGG commented 8 years ago

Thanks for all. I am just starting rather simply with flowClust.2d Here's my CSV, but I don't know what to set in alias and pop fields.

alias   pop parent  dims    gating_method   gating_args collapseDataForGating   groupBy preprocessing_method    preprocessing_args
*   TRUE    root    CD56,CD16   flowClust.2d    K=3             

Here's the script and output

> gt <- gatingTemplate("gs1_5_flowclust.csv")
Adding population:*
> plot(gt)
Warning message:
In brewer.pal(nMethods, name = "Dark2") :
  minimal value for n is 3, returning requested palette with 3 different levels

> gs <- GatingSet(fs4)
.done!
> gg <- gating(gt, gs)
Gating for '*'
The prior specification has no effect when usePrior=no
Using the parallel (multicore) version of flowClust with 1 cores
done.
finished.
> plot(gs, bool = TRUE)
> stats <- getPopStats(gs)
> stats
         name           Population Parent Count ParentCount
1: Cell_A.fcs defaultEllipsoidGate   root 46309      101597
>

I don't understand how to get stats for K = 3 populations.

mikejiang commented 8 years ago

K argument is passed to flowClust to generate k clusters. But flowClust.2d function always returns single gate that corresponds to one of these clusters. Please take time reading ?flowClust.2d and ?gatingTemplate as well as http://opencyto.org/ to check if your questions can be answered by these docs.

SamGG commented 8 years ago

Thanks, I will.

SamGG commented 8 years ago

The flowClust.2d indicates the following, that I think is a typo, K should replace by 2 because flowClust is working in 2D.

target  
a numeric vector of length K containing the location of the cluster of interest. See details.