Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Manual and automated gating for defining cell populations in flow cytometry. Covers rectangular, polygon, and data-driven gates. Use when identifying cell populations through hierarchical gating strategies.
.claude/skills/bio-flow-cytometry-gating-analysis/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-18 | ✗→✓ | ▲ Improved | — | — |
| case-16 | ✗→✓ | ▲ Improved | — | — |
| case-20 | ✗→✓ | ▲ Improved | — | — |
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-09 | ✗→✓ | ▲ Improved | — | — |
Reference examples tested with: flowCore 2.14+
Before using code patterns, verify installed versions match. If versions differ:
packageVersion('<pkg>') then ?function_name to verify parametersIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"Gate my flow cytometry data to identify cell populations" → Define cell populations through manual or automated gating strategies using rectangular, polygon, or data-driven gates in a hierarchical framework.
flowWorkspace::gs_add_gating_method(), openCyto::gating() for automated gatingrlibrary(flowCore) # Create rectangular gate cd4_gate <- rectangleGate(filterId = 'CD4+', 'CD4' = c(500, Inf), 'CD3' = c(200, Inf)) # Apply gate cd4_result <- filter(fcs, cd4_gate) summary(cd4_result) # Get cells in gate cd4_cells <- Subset(fcs, cd4_gate)
r# Define polygon vertices vertices <- matrix(c(100, 100, # x1, y1 1000, 100, # x2, y2 1000, 1000, # x3, y3 100, 1000), # x4, y4 ncol = 2, byrow = TRUE) colnames(vertices) <- c('FSC-A', 'SSC-A') # Create polygon gate poly_gate <- polygonGate(filterId = 'Lymphocytes', .gate = vertices) # Apply lymph <- Subset(fcs, poly_gate)
rlibrary(flowWorkspace) # Create GatingSet from flowSet gs <- GatingSet(fs) # Add gates to hierarchy gs_pop_add(gs, cd4_gate, parent = 'root') # Add child gate cd4_cd8_gate <- rectangleGate(filterId = 'CD8+', 'CD8' = c(500, Inf)) gs_pop_add(gs, cd4_cd8_gate, parent = 'CD4+') # View hierarchy gs_get_pop_paths(gs) # Recompute statistics recompute(gs) # Get population statistics gs_pop_get_stats(gs)
rlibrary(flowDensity) # Data-driven gate based on density cd4_gate <- deGate(fcs, channel = 'CD4', use.upper = TRUE) # Get threshold cd4_threshold <- cd4_gate@min # Apply cd4_pos <- flowDensity(fcs, channels = 'CD4', position = c(TRUE)) cd4_cells <- getflowFrame(cd4_pos)
Goal: Apply a reproducible, template-driven gating strategy that automatically identifies cell populations across all samples.
Approach: Define a CSV gating template specifying parent-child hierarchy, channel combinations, and gating algorithms (flowClust, singletGate, mindensity, quadrantGate), then apply the template to a GatingSet for batch processing.
rlibrary(openCyto) # Define gating template gating_template <- fread(' alias,pop,parent,dims,gating_method,gating_args nonDebris,+,root,FSC-A,flowClust,K=2 singlets,+,nonDebris,"FSC-A,FSC-H",singletGate, lymph,+,singlets,"FSC-A,SSC-A",flowClust,K=3 cd3,+,lymph,CD3,mindensity, cd4,+,cd3,"CD4,CD8",quadrantGate, ') # Apply template gt <- gatingTemplate(gating_template) gs <- GatingSet(fs) gating(gt, gs)
r# Create quadrant gate quad_gate <- quadGate(filterId = 'CD4_CD8_quad', 'CD4' = 500, 'CD8' = 500) # Results in 4 populations: # CD4+CD8-, CD4-CD8+, CD4+CD8+, CD4-CD8-
r# Combine gates with logic cd4_not_cd8 <- cd4_gate & !cd8_gate # Alternative using GatingSet gs_pop_add(gs, booleanFilter(CD4+CD8- = CD4+ & !CD8+), parent = 'lymph')
r# Get data for specific population cd4_data <- gh_pop_get_data(gs[[1]], 'CD4+') # Get indices cd4_indices <- gh_pop_get_indices(gs[[1]], 'CD4+') # Counts gs_pop_get_count_fast(gs)
rlibrary(ggcyto) # Plot with gates autoplot(gs[[1]], 'CD4+') # Multiple populations autoplot(gs[[1]], c('CD4+', 'CD8+')) # Gate overlay autoplot(fcs, 'CD4', 'CD8') + geom_gate(cd4_gate)
r# Save GatingSet save_gs(gs, 'gating_set') # Export to FlowJo workspace library(CytoML) gatingset_to_flowjo(gs, 'analysis.wsp')
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.