flowio
它能做什么
FlowIO 是一个用于读写流式细胞术数据文件(FCS)的工具。它可以帮你查看数据的基本信息,并提取事件(即测量结果)。
适用场景
- ✓当你需要查看 FCS 文件的基本信息时。
- ✓当你需要从细胞测量中提取原始数据时。
- ✓当你需要为其他分析或机器学习准备数据时。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/flowio/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“读取 'example.fcs' 文件,应用时间和增益缩放,然后把事件数据展示给我。”
每周 5 个新技能,1 分钟读完。
工作原理
FlowIO 会读取 FCS 文件,把文件头信息和事件数据分开处理。它可以把事件以数值数组的形式呈现出来,并可选择性地应用文件中定义的变换。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
FlowIO
Purpose
Use FlowIO as a lightweight, low-level reader and writer for Flow Cytometry Standard files. Examples in this skill target FlowIO 1.4.0, the current stable release verified on 2026-09-30. Standalone FlowIO checks used Python 3.13, NumPy 2.5.3, and pandas 3.0.6.
FlowIO is appropriate for:
- Reading FCS 2.0, 3.0, and 3.1 files
- Inspecting HEADER, TEXT, ANALYSIS, and channel metadata
- Retrieving event data as a two-dimensional NumPy array
- Reading legacy files that contain multiple datasets
- Writing list-mode, single-precision FCS 3.1 files
- Preparing data for pandas, machine-learning, or downstream cytometry tools
FlowIO does not perform compensation, logicle/biexponential transforms, gating, clustering, or FlowJo workspace processing. Use FlowKit or another analysis package for those tasks.
Install
Create or activate a Python environment, then install the verified release:
uv pip install "flowio==1.4.0"
Confirm the runtime version:
uv run python -c "import flowio; print(flowio.__version__)"
FlowIO 1.4.0 supports Python 3.9 through 3.13 and depends on NumPy.
Operating Workflow
- Clarify the operation. Distinguish metadata inventory, event extraction, file repair, conversion, and downstream biological analysis.
- Inspect before loading events. Use
only_text=Truefor metadata-only work, especially with large or unfamiliar files. - Choose event semantics explicitly. Use
as_array(preprocess=True)for gain/log/time scaling from FCS metadata, orpreprocess=Falsefor decoded DATA values without those scaling steps. Record the choice. - Keep parsing strict by default. Do not automatically suppress offset errors. Relax checks only for a known vendor-format defect, and review the resulting event data.
- Treat metadata as potentially sensitive. FCS TEXT values can include sample, subject, operator, and instrument identifiers. Export only fields needed for the task.
- Validate writes by reopening them. Check event/channel counts, labels, metadata, and representative values after any FCS export.
Critical Semantics
TEXT keys are normalized
FlowData.text stores keys in lowercase and strips the leading $ from
standard FCS keywords:
from flowio import FlowData
flow = FlowData("sample.fcs", only_text=True)
acquisition_date = flow.text.get("date")
instrument = flow.text.get("cyt")
next_dataset = int(flow.text.get("nextdata", "0"))
Do not look up "$DATE", "$CYT", or other uppercase dollar-prefixed keys.
TEXT values remain strings. FlowIO 1.4.0 also removes every $ character from
the decoded TEXT segment, including $ characters inside values; preserve the
original file when exact metadata fidelity matters.
Events have two representations
flow.eventsis the decoded, flattened one-dimensional event array. Integer parsing already applies PnR range masks; this is not a byte-level copy of the original DATA words.flow.as_array()returns a NumPyfloat64array with one column per channel. For valid input its shape is(event_count, channel_count), but FlowIO infers rows from DATA and does not enforce$TOT; check the shape.flow.as_array(preprocess=True)applies FCS gain, logarithmic, and time scaling. It does not apply compensation or logicle/biexponential display transforms.flow.as_array(preprocess=False)reshapes the decoded event values without those scaling steps. A recognized, non-nullTimechannel (case-insensitive) has its gain forced to 1.0 by FlowIO;timestepstill applies when preprocessing.
as_array() creates another in-memory array. FlowIO does not provide chunked
or memory-mapped event access.
Channel numbering uses two conventions
- NumPy columns and
fluoro_indices,scatter_indices, andtime_indexuse zero-based indices. flow.channelsuses FCS parameter numbers beginning at 1.null_channelscontains the PnN label strings supplied throughnull_channel_list, including supplied labels that were not found.pns_labelsalways matchespnn_labelsin length; missing optional PnS labels appear as empty strings.
Writing is intentionally limited
create_fcs() requires:
- An already-open binary file handle
- Flattened one-dimensional event data in row-major event/channel order
- One PnN name per channel
- Optional PnS names and string-valued metadata via
metadata_dict
…
常见问题
什么是 FCS 文件?
FCS(Flow Cytometry Standard,流式细胞术标准)是一种用于存储流式细胞术数据的标准格式,这些数据就是细胞测量的结果。
FlowIO 不能做什么?
它不能进行补偿、logicle 变换、门控(细胞群筛选)或 FlowJo 文件处理等复杂分析。这些需求需要用其他工具来完成。
我怎么判断该不该用 FlowIO?
如果你需要做底层的读写工作,比如查看元数据或提取原始数据,就用 FlowIO。如果需要更高级的分析,请找其他工具。
详情
作者的原始描述
Reads, inspects, and writes Flow Cytometry Standard (FCS) 2.0, 3.0, and 3.1 files with FlowIO. Use for low-level FCS metadata and channel inspection, NumPy event extraction, multi-dataset files, table export, and FCS 3.1 creation; use FlowKit for compensation, cytometry transforms, gating, or FlowJo workspaces.
热度
- GitHub 星标
- 51k
- 排名
- #3461
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …