Flow Cytometry Data Analyzer

Flowkit

by K-Dense-AI · MIT license · ★ 45,977 on GitHub · updated Sep 21

Flowkit cover

Analyzes flow cytometry data with FlowKit, including spillover compensation, logicle and biexponential transforms, hierarchical gating, GatingML strategies, and supported FlowJo 10 workspaces. Use for reproducible gate counts,…

---
name: flowkit
description: Analyzes flow cytometry data with FlowKit, including spillover compensation, logicle and biexponential transforms, hierarchical gating, GatingML strategies, and supported FlowJo 10 workspaces. Use for reproducible gate counts, population percentages, gated fluorescence summaries, or reproducing a FlowJo analysis in Python. For FCS metadata inspection or file-format repair alone, use FlowIO.
license: MIT
compatibility: Requires Python 3.13 with flowkit==1.3.2 for the tested environment. Dependencies include FlowIO, FlowUtils, NumPy, pandas, SciPy, lxml, and Bokeh. Installation needs network access; analysis uses local FCS/XML/WSP files without credentials. FlowUtils needs a C compiler if a compatible wheel is unavailable.
metadata:
  version: "1.1"
  skill-author: K-Dense Inc.
  last-reviewed: "2026-09-30"
---

# FlowKit

## When to use

Use FlowKit to apply or build cytometry gating strategies, analyze batches of
FCS samples, or reproduce supported FlowJo workspace analyses. It supports
GatingML 2.0 and a **subset of FlowJo 10 features**. Import success alone does

Overview

Use FlowKit to apply or build cytometry gating strategies, analyze batches of FCS samples, or reproduce supported FlowJo workspace analyses. It supports GatingML 2.0 and a subset of FlowJo 10 features. Import success alone does not establish agreement with FlowJo.

Manual install (npx, ZIP)
Claude Codenpx skills add K-Dense-AI/scientific-agent-skills --skill flowkit -g -a claude-code
Claude Code (degit)npx degit K-Dense-AI/scientific-agent-skills/skills/flowkit#main ~/.claude/skills/flowkit
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md8.5 KB
Read SKILL.md here
K-Dense-AI/main1 file shown
SKILL.md
Show the full text181 lines

FlowKit

When to use

Use FlowKit to apply or build cytometry gating strategies, analyze batches of FCS samples, or reproduce supported FlowJo workspace analyses. It supports GatingML 2.0 and a subset of FlowJo 10 features. Import success alone does not establish agreement with FlowJo.

The examples and bundled helper target FlowKit 1.3.2 on Python 3.13. Upstream supports additional Python versions; those were not exercised here. The helper and examples were tested on synthetic FCS data, including a public FlowJo 10.7.1 synthetic workspace fixture. They are not biological validation.

Install

Use a separate environment; FlowKit 1.3.2 requires NumPy >2 and pandas <3:

uv venv --python 3.13 .venv-flowkit
uv pip install --python .venv-flowkit/bin/python "flowkit==1.3.2"
.venv-flowkit/bin/python -c "import flowkit; print(flowkit.__version__)"

The scientific package is BSD-3-Clause licensed; this skill is MIT licensed.

Workflow

  1. Identify the analysis definition. Use Session for a programmatic or GatingML strategy; use Workspace for FlowJo sample-specific gates, compensation, and transforms. Request the actual strategy or controls when biological thresholds have not been supplied.
  2. Inspect samples and channel identities. Match detector/PnN labels to compensation matrices and gate dimensions; PnS marker names may be empty or repeated. Verify sample IDs: the default is FCS $FIL, which can differ from the current filename. Reject ID collisions before loading a batch.
  3. Establish the coordinate system. Determine whether the supplied events are already compensated. Apply compensation before nonlinear transforms; match gate thresholds to the same transformed or untransformed coordinates. See compensation and gating.
  4. Check the hierarchy. Preserve parent gates and full gate paths, including root. For a study, review acquisition/time stability, debris exclusion, singlets, viability, and phenotype gates as appropriate to its panel. Use single-stain controls for compensation and suitable negative/FMO controls for positivity; demonstration thresholds are not transferable biology.
  5. Analyze and inspect. Run on all events, then check gate overlays and sample-level QC. A plot's subsample is not the population denominator. Review warnings and compare representative imported results to FlowJo.
  6. Export counts with denominators and provenance. Keep gate paths, sample IDs, total event counts, input hashes, package versions, and the analysis definition. Keep biological replicates identifiable; events from one specimen are not independent experimental replicates.

Apply an existing strategy

Set FLOWKIT_SKILL_DIR to this skill's installed directory. From the repository root it is skills/flowkit. Paths below represent the user's local inputs.

FLOWKIT_SKILL_DIR="skills/flowkit"
uv run --no-project --python 3.13 --with "flowkit==1.3.2" \
  python "$FLOWKIT_SKILL_DIR/scripts/analyze_gates.py" \
  --gatingml gates.xml --fcs sample.fcs --output-dir results-gatingml

For a FlowJo workspace, supply every FCS file in the selected group:

uv run --no-project --python 3.13 --with "flowkit==1.3.2" \
  python "$FLOWKIT_SKILL_DIR/scripts/analyze_gates.py" \
  --workspace study.wsp --group "Study" \
  --fcs sample-a.fcs sample-b.fcs --output-dir results-workspace

The helper writes gate_report.csv and provenance.json to a new directory. Each row includes sample_event_count, parent_event_count, and a full population_path; empty-parent percentages are blank and flagged with relative_percent_defined=False. It rejects duplicate sample IDs, missing/extra workspace-group samples, zero-event samples, and strategies without gates. It uses explicit input files, does not follow paths embedded in the workspace, and runs without multiprocessing or transformed-event caching. It still loads each sample into memory; use manageable batches via the Python API for large studies.

--filename-as-id deliberately switches from $FIL to file basenames. Use it only when those names match the analysis definition. See workspace analysis for partial-group analysis, result interpretation, and fluorescence summaries.

Build a strategy in Python

This runnable example uses sample.fcs with FSC-A, FL1-A, and FL2-A. The matrix, thresholds, and transform parameters are synthetic teaching values. Replace them with the study's validated settings.

import flowkit as fk
import numpy as np

sample = fk.Sample("sample.fcs")
strategy = fk.GatingStrategy()
strategy.add_comp_matrix(
    "spill", fk.Matrix(
        np.array([[1.0, 0.1], [0.2, 1.0]]), ["FL1-A", "FL2-A"],
        fluorochromes=["FITC", "PE"],
    )
)
logicle = fk.transforms.LogicleTransform(
    param_t=262144, param_w=0.5, param_m=4.5, param_a=0
)
strategy.add_transform("logicle", logicle)
strategy.add_gate(
    fk.gates.RectangleGate("Cells", [
        fk.Dimension("FSC-A", range_min=50, range_max=300)
    ]),
    gate_path=("root",),
)
thresholds = logicle.apply(np.array([50.0, 600.0]))
strategy.add_gate(
    fk.gates.RectangleGate("Positive", [
        fk.Dimension(
            "FL1-A", compensation_ref="spill", transformation_ref="logicle",
            range_min=float(thresholds[0]), range_max=float(thresholds[1]),
        )
    ]),
    gate_path=("root", "Cells"),
)
session = fk.Session(gating_strategy=strategy, fcs_samples=[sample])
session.analyze_samples(use_mp=False)
report = session.get_analysis_report()
print(report[["sample_id", "gate_path", "gate_name", "count",
              "absolute_percent", "relative_percent"]])
with open("gates.xml", "xb") as handle:
    session.export_gml(handle)

GatingML exports a template by default. When custom per-sample gates exist, use session.export_gml(handle, sample_id=sample.id) for that sample's strategy. A single template export does not preserve every sample-specific override.

Interpretation checks

  • count is the number of events passing the gate and its ancestors.
  • absolute_percent is percent of all sample events; relative_percent is percent of the immediate parent. These are percentages, not fractions.
  • Gate names can repeat under different parents. In the helper's output use (sample_id, population_path) as the identifier. Paths are JSON arrays inside CSV cells. FlowKit's native report stores a quadrant's owner separately in quadrant_parent; its gate_path alone omits that owner.
  • A zero-event parent makes a child percentage biologically undefined; FlowKit 1.3.2 reports zero for ordinary children and NaN for quadrants. The helper exports both as blank with an explicit false flag. This differs from a defined 0% for an empty gate whose parent contains events.
  • Compensated negative fluorescence is legitimate. Do not clip it to zero or discard those events merely to permit a logarithmic transform.
  • Define whether “MFI” means mean or median and name the event source. A transformed display value is not an intensity on the original scale.

References

1---
2name: flowkit
3description: Analyzes flow cytometry data with FlowKit, including spillover compensation, logicle and biexponential transforms, hierarchical gating, GatingML strategies, and supported FlowJo 10 workspaces. Use for reproducible gate counts, population percentages, gated fluorescence summaries, or reproducing a FlowJo analysis in Python. For FCS metadata inspection or file-format repair alone, use FlowIO.
4license: MIT
5compatibility: Requires Python 3.13 with flowkit==1.3.2 for the tested environment. Dependencies include FlowIO, FlowUtils, NumPy, pandas, SciPy, lxml, and Bokeh. Installation needs network access; analysis uses local FCS/XML/WSP files without credentials. FlowUtils needs a C compiler if a compatible wheel is unavailable.
6metadata:
7 version: "1.1"
8 skill-author: K-Dense Inc.
9 last-reviewed: "2026-09-30"
10---
11 
12# FlowKit
13 
14## When to use
15 
16Use FlowKit to apply or build cytometry gating strategies, analyze batches of
17FCS samples, or reproduce supported FlowJo workspace analyses. It supports
18GatingML 2.0 and a **subset of FlowJo 10 features**. Import success alone does
19not establish agreement with FlowJo.
20 
21The examples and bundled helper target **FlowKit 1.3.2 on Python 3.13**.
22Upstream supports additional Python versions; those were not exercised here.
23The helper and examples were tested on synthetic FCS data, including a public
24FlowJo 10.7.1 synthetic workspace fixture. They are not biological validation.
25 
26## Install
27 
28Use a separate environment; FlowKit 1.3.2 requires NumPy >2 and pandas <3:
29 
30```bash
31uv venv --python 3.13 .venv-flowkit
32uv pip install --python .venv-flowkit/bin/python "flowkit==1.3.2"
33.venv-flowkit/bin/python -c "import flowkit; print(flowkit.__version__)"
34```
35 
36The scientific package is BSD-3-Clause licensed; this skill is MIT licensed.
37 
38## Workflow
39 
401. **Identify the analysis definition.** Use `Session` for a programmatic or
41 GatingML strategy; use `Workspace` for FlowJo sample-specific gates,
42 compensation, and transforms. Request the actual strategy or controls when
43 biological thresholds have not been supplied.
442. **Inspect samples and channel identities.** Match detector/PnN labels to
45 compensation matrices and gate dimensions; PnS marker names may be empty or
46 repeated. Verify sample IDs: the default is FCS `$FIL`, which can differ
47 from the current filename. Reject ID collisions before loading a batch.
483. **Establish the coordinate system.** Determine whether the supplied events
49 are already compensated. Apply compensation before nonlinear transforms;
50 match gate thresholds to the same transformed or untransformed coordinates.
51 See [compensation and gating](references/compensation-and-gating.md).
524. **Check the hierarchy.** Preserve parent gates and full gate paths, including
53 `root`. For a study, review acquisition/time stability, debris exclusion,
54 singlets, viability, and phenotype gates as appropriate to its panel. Use
55 single-stain controls for compensation and suitable negative/FMO controls
56 for positivity; demonstration thresholds are not transferable biology.
575. **Analyze and inspect.** Run on all events, then check gate overlays and
58 sample-level QC. A plot's subsample is not the population denominator.
59 Review warnings and compare representative imported results to FlowJo.
606. **Export counts with denominators and provenance.** Keep gate paths,
61 sample IDs, total event counts, input hashes, package versions, and the
62 analysis definition. Keep biological replicates identifiable; events from
63 one specimen are not independent experimental replicates.
64 
65## Apply an existing strategy
66 
67Set `FLOWKIT_SKILL_DIR` to this skill's installed directory. From the repository
68root it is `skills/flowkit`. Paths below represent the user's local inputs.
69 
70```bash
71FLOWKIT_SKILL_DIR="skills/flowkit"
72uv run --no-project --python 3.13 --with "flowkit==1.3.2" \
73 python "$FLOWKIT_SKILL_DIR/scripts/analyze_gates.py" \
74 --gatingml gates.xml --fcs sample.fcs --output-dir results-gatingml
75```
76 
77For a FlowJo workspace, supply **every FCS file in the selected group**:
78 
79```bash
80uv run --no-project --python 3.13 --with "flowkit==1.3.2" \
81 python "$FLOWKIT_SKILL_DIR/scripts/analyze_gates.py" \
82 --workspace study.wsp --group "Study" \
83 --fcs sample-a.fcs sample-b.fcs --output-dir results-workspace
84```
85 
86The helper writes `gate_report.csv` and `provenance.json` to a new directory.
87Each row includes `sample_event_count`, `parent_event_count`, and a full
88`population_path`; empty-parent percentages are blank and flagged with
89`relative_percent_defined=False`.
90It rejects duplicate sample IDs, missing/extra workspace-group samples,
91zero-event samples, and strategies without gates. It uses explicit input files,
92does not follow paths embedded in the workspace, and runs without
93multiprocessing or transformed-event caching. It still loads each sample into
94memory; use manageable batches via the Python API for large studies.
95 
96`--filename-as-id` deliberately switches from `$FIL` to file basenames. Use it
97only when those names match the analysis definition. See
98[workspace analysis](references/workspaces-and-results.md) for partial-group
99analysis, result interpretation, and fluorescence summaries.
100 
101## Build a strategy in Python
102 
103This runnable example uses `sample.fcs` with `FSC-A`, `FL1-A`, and `FL2-A`.
104The matrix, thresholds, and transform parameters are **synthetic teaching
105values**. Replace them with the study's validated settings.
106 
107```python
108import flowkit as fk
109import numpy as np
110 
111sample = fk.Sample("sample.fcs")
112strategy = fk.GatingStrategy()
113strategy.add_comp_matrix(
114 "spill", fk.Matrix(
115 np.array([[1.0, 0.1], [0.2, 1.0]]), ["FL1-A", "FL2-A"],
116 fluorochromes=["FITC", "PE"],
117 )
118)
119logicle = fk.transforms.LogicleTransform(
120 param_t=262144, param_w=0.5, param_m=4.5, param_a=0
121)
122strategy.add_transform("logicle", logicle)
123strategy.add_gate(
124 fk.gates.RectangleGate("Cells", [
125 fk.Dimension("FSC-A", range_min=50, range_max=300)
126 ]),
127 gate_path=("root",),
128)
129thresholds = logicle.apply(np.array([50.0, 600.0]))
130strategy.add_gate(
131 fk.gates.RectangleGate("Positive", [
132 fk.Dimension(
133 "FL1-A", compensation_ref="spill", transformation_ref="logicle",
134 range_min=float(thresholds[0]), range_max=float(thresholds[1]),
135 )
136 ]),
137 gate_path=("root", "Cells"),
138)
139session = fk.Session(gating_strategy=strategy, fcs_samples=[sample])
140session.analyze_samples(use_mp=False)
141report = session.get_analysis_report()
142print(report[["sample_id", "gate_path", "gate_name", "count",
143 "absolute_percent", "relative_percent"]])
144with open("gates.xml", "xb") as handle:
145 session.export_gml(handle)
146```
147 
148GatingML exports a template by default. When custom per-sample gates exist,
149use `session.export_gml(handle, sample_id=sample.id)` for that sample's strategy.
150A single template export does not preserve every sample-specific override.
151 
152## Interpretation checks
153 
154- `count` is the number of events passing the gate and its ancestors.
155- `absolute_percent` is percent of all sample events; `relative_percent` is
156 percent of the immediate parent. These are percentages, not fractions.
157- Gate names can repeat under different parents. In the helper's output use
158 `(sample_id, population_path)` as the identifier. Paths are JSON arrays
159 inside CSV cells. FlowKit's native report stores a quadrant's owner
160 separately in `quadrant_parent`; its `gate_path` alone omits that owner.
161- A zero-event parent makes a child percentage biologically undefined;
162 FlowKit 1.3.2 reports zero for ordinary children and NaN for quadrants.
163 The helper exports both as blank with an explicit false flag. This differs
164 from a defined 0% for an empty gate whose parent contains events.
165- Compensated negative fluorescence is legitimate. Do not clip it to zero or
166 discard those events merely to permit a logarithmic transform.
167- Define whether “MFI” means mean or median and name the event source.
168 A transformed display value is not an intensity on the original scale.
169 
170## References
171 
172- [Compensation and gating](references/compensation-and-gating.md): event
173 sources, detector order, transform semantics, gate paths, and plotting.
174- [Workspaces and results](references/workspaces-and-results.md): sample
175 matching, missing FCS files, FlowJo limits, and gated fluorescence summaries.
176- [FlowKit API](https://flowkit.readthedocs.io/en/latest/api.html) and
177 [versioned source](https://github.com/whitews/FlowKit/tree/1.3.2): consult
178 signatures when moving beyond the tested release.
179- [FlowKit publication](https://doi.org/10.3389/fimmu.2021.768541): cite the
180 software and version in scientific methods when used for analysis.
181 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 45,977
Checked
Source
K-Dense-AI/scientific-agent-skills ↗
Creator
K-Dense-AI · 168 listings
View creator

Similar skills

See all →

More from K-Dense-AI

SkillAdaptyv Bio Foundry APIK-Dense-AI/scientific-agent-skills · by K-Dense-AIHow to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.★ 46k GitHub starsSkillTime Series MLK-Dense-AI/scientific-agent-skills · by K-Dense-AIThis skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.★ 46k GitHub starsSkillAnalytical Method ValidatorK-Dense-AI/scientific-agent-skills · by K-Dense-AIPlan, execute, and document validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and ligand binding or cell-based assays whenever the question is whether a procedure is fit for its intended purpose. Triggers include "method validation", "analytical method validation", "AMV", "validation protocol", "acceptance criteria", "linearity", "reportable range", "accuracy and precision", "repeatability", "intermediate precision", "recovery", "LOD", "LOQ", "detection limit", "quantitation limit", "specificity", "robustness", "method transfer", "method comparison", "Deming", "Passing-Bablok", "Bland-Altman", "equivalence testing", "OOS investigation", "ICH Q2", "Q2(R2)", "Q14", "USP 1225", "ICH M10", "incurred sample reanalysis", "ISR", "CLSI EP", and any request to show that an assay works.★ 46k GitHub starsSkillSingle-Cell Data StructureK-Dense-AI/scientific-agent-skills · by K-Dense-AIData structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.★ 46k GitHub starsSkillAutonomous Artifact OptimizerK-Dense-AI/scientific-agent-skills · by K-Dense-AIAutonomously improve a real artifact (code, training recipe, agent harness, data pipeline, prompt) against an objective and an evaluator, using Hypothesis Tree Refinement (HTR) from the Arbor paper. Use this whenever someone wants to iteratively optimize something over many experiments without overfitting — e.g. "get my model's eval score up", "improve this agent/harness", "tune this pipeline", "beat the baseline on this benchmark", "run a search over approaches and keep the best", "do an MLE-bench / Kaggle-style optimization", or any long-horizon "make this artifact better and don't just memorize the dev set" task. Trigger it even when the user doesn't say "Arbor" or "hypothesis tree" but describes repeated experiment-and-evaluate loops, branching exploration of competing ideas, or worries about a dev/test gap. Runs Claude itself as the coordinator with subagent executors in isolated git worktrees; for the standalone `arbor` CLI tool see references/arbor-upstream.md.★ 46k GitHub starsSkillGene Regulatory Network InferrerK-Dense-AI/scientific-agent-skills · by K-Dense-AIInfer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.★ 46k GitHub stars