/bio-flow-cytometry-cytometry-qc
Comprehensive quality control for flow cytometry and CyTOF data. Covers flow rate stability, signal drift, margin events, dead cell exclusion, and batch QC. Use when assessing acquisition quality or identifying problematic samples before analysis.
Claude Code
$ npx -y skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-flow-cytometry-cytometry-qc --agent claude-code
Codex
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-flow-cytometry-cytometry-qc -a codex -y
Cursor
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-flow-cytometry-cytometry-qc -a cursor -y
Gemini CLI
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-flow-cytometry-cytometry-qc -a gemini-cli -y
GitHub Copilot
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-flow-cytometry-cytometry-qc -a github-copilot -y
OpenCode
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-flow-cytometry-cytometry-qc -a opencode -y
Windsurf
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-flow-cytometry-cytometry-qc -a windsurf -y
SKILL.md
bio-flow-cytometry-cytometry-qc.SKILL.mdname: bio-flow-cytometry-cytometry-qc
description: Comprehensive quality control for flow cytometry and CyTOF data. Covers flow rate stability, signal drift, margin events, dead cell exclusion, and batch QC. Use when assessing acquisition quality or identifying problematic samples before analysis.
tool_type: r
primary_tool: flowAI
Version Compatibility
Reference examples tested with: flowCore 2.14+, ggplot2 3.5+
Before using code patterns, verify installed versions match. If versions differ:
- R: `packageVersion('<pkg>')` then `?function_name` to verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Cytometry QC
**"Run quality control on my flow cytometry data"** → Assess acquisition quality by checking flow rate stability, signal drift, margin events, and dead cell frequencies to identify problematic samples.
- R: `flowAI::flow_auto_qc()` for automated anomaly detection
Automated QC with flowAI
library(flowAI)
library(flowCore)
# Load FCS file
ff <- read.FCS('sample.fcs')
# Run automated QC
# Checks: flow rate, signal stability, dynamic range
qc_result <- flow_auto_qc(
ff,
folder_results = 'qc_output/',
fcs_QC = TRUE, # Export QC'd FCS
html_report = TRUE, # Generate HTML report
mini_report = TRUE # Also make summary
)
# Get cleaned data
ff_clean <- qc_result$fcs
# QC metrics
cat('Original events:', nrow(ff), '\n')
cat('After QC:', nrow(ff_clean), '\n')
cat('Removed:', nrow(ff) - nrow(ff_clean), '(',
round((1 - nrow(ff_clean)/nrow(ff)) * 100, 1), '%)\n')Flow Rate Stability
# Check for acquisition issues via flow rate
check_flow_rate <- function(ff, time_channel = 'Time') {
expr <- exprs(ff)
time <- expr[, time_channel]
# Bin by time
n_bins <- 50
bins <- cut(time, breaks = n_bins, labels = FALSE)
# Events per bin (flow rate proxy)
events_per_bin <- table(bins)
flow_rate <- as.numeric(events_per_bin)
# Calculate metrics
cv <- sd(flow_rate) / mean(flow_rate) * 100
# Detect anomalies (>2 SD from mean)
z_scores <- abs(scale(flow_rate))
anomalies <- which(z_scores > 2)
list(
mean_rate = mean(flow_rate),
cv_percent = cv,
anomaly_bins = anomalies,
stable = cv < 20 && length(anomalies) < 3
)
}
flow_qc <- check_flow_rate(ff)
cat('Flow rate CV:', round(flow_qc$cv_percent, 1), '%\n')
cat('Stable:', flow_qc$stable, '\n')Signal Drift Detection
# Detect signal drift over acquisition time
detect_signal_drift <- function(ff, channels, time_channel = 'Time') {
expr <- exprs(ff)
time <- expr[, time_channel]
n_bins <- 20
bins <- cut(time, breaks = n_bins, labels = FALSE)
drift_results <- lapply(channels, function(ch) {
bin_medians <- tapply(expr[, ch], bins, median, na.rm = TRUE)
# Linear trend
trend <- lm(bin_medians ~ seq_along(bin_medians))
slope <- coef(trend)[2]
r_squared <- summary(trend)$r.squared
# Percent change over acquisition
pct_change <- (tail(bin_medians, 1) - head(bin_medians, 1)) / head(bin_medians, 1) * 100
list(
channel = ch,
slope = slope,
r_squared = r_squared,
percent_change = pct_change,
drift_detected = abs(pct_change) > 10 && r_squared > 0.5
)
})
names(drift_results) <- channels
drift_results
}
marker_channels <- c('CD45', 'CD3', 'CD4', 'CD8')
drift <- detect_signal_drift(ff, marker_channels)
for (ch in names(drift)) {
if (drift[[ch]]$drift_detected) {
cat('DRIFT DETECTED:', ch, '(', round(drift[[ch]]$percent_change, 1), '%)\n')
}
}Margin Events Removal
# Remove events at detector saturation limits
remove_margin_events <- function(ff, channels = NULL) {
expr <- exprs(ff)
if (is.null(channels)) {
channels <- colnames(expr)
}
# Get channel ranges from FCS parameters
params <- parameters(ff)
margin_mask <- rep(FALSE, nrow(expr))
for (ch in channels) {
if (ch %in% colnames(expr)) {
# Get max range from parameters
idx <- match(ch, params@data$name)
if (!is.na(idx)) {
max_val <- params@data$range[idx]
# Events at max or min are margin events
margin_mask <- margin_mask | (expr[, ch] >= max_val * 0.99) | (expr[, ch] <= 0)
}
}
}
cat('Margin events:', sum(margin_mask), '(', round(mean(margin_mask) * 100, 2), '%)\n')
ff[!margin_mask, ]
}
ff_no_margin <- remove_margin_events(ff, c('FSC-A', 'SSC-A'))Dead Cell Exclusion
# Exclude dead cells using viability marker
exclude_dead_cells <- function(ff, viability_channel, threshold = NULL) {
expr <- exprs(ff)
viability <- expr[, viability_channel]
if (is.null(threshold)) {
# Auto-threshold using bimodal distribution
# Dead cells have higher viability dye uptake
threshold <- quantile(viability, 0.9)
}
live_mask <- viability < threshold
cat('Total events:', length(live_mask), '\n')
cat('Live cells:', sum(live_mask), '(', round(mean(live_mask) * 100, 1), '%)\n')
cat('Dead cells:', sum(!live_mask), '(', round(mean(!live_mask) * 100, 1), '%)\n')
ff[live_mask, ]
}
# Example with zombie dye
ff_live <- exclude_dead_cells(ff, 'Zombie-Aqua')CyTOF-Specific QC
# CyTOF-specific quality metrics
cytof_qc <- function(ff) {
expr <- exprs(ff)
# Event length check (cell size proxy)
if ('Event_length' %in% colnames(expr)) {
event_length <- expr[, 'Event_length']
# Typical single cells: 15-45
good_length <- event_length >= 15 & event_length <= 45
cat('Event length filter:', sum(good_length), '/', length(good_length),
'(', round(mean(good_length) * 100Read more
name: bio-flow-cytometry-cytometry-qc description: Comprehensive quality control for flow cytometry and CyTOF data. Covers flow rate stability, signal drift, margin events, dead cell exclusion, and batch QC. Use when assessing acquisition quality or identifying problematic samples before analysis. tool_type: r primary_tool: flowAI
Version Compatibility
Reference examples tested with: flowCore 2.14+, ggplot2 3.5+
Before using code patterns, verify installed versions match. If versions differ:
- R: `packageVersion('<pkg>')` then `?function_name` to verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Cytometry QC
**"Run quality control on my flow cytometry data"** → Assess acquisition quality by checking flow rate stability, signal drift, margin events, and dead cell frequencies to identify problematic samples.
- R: `flowAI::flow_auto_qc()` for automated anomaly detection
Automated QC with flowAI
library(flowAI)
library(flowCore)
# Load FCS file
ff <- read.FCS('sample.fcs')
# Run automated QC
# Checks: flow rate, signal stability, dynamic range
qc_result <- flow_auto_qc(
ff,
folder_results = 'qc_output/',
fcs_QC = TRUE, # Export QC'd FCS
html_report = TRUE, # Generate HTML report
mini_report = TRUE # Also make summary
)
# Get cleaned data
ff_clean <- qc_result$fcs
# QC metrics
cat('Original events:', nrow(ff), '\n')
cat('After QC:', nrow(ff_clean), '\n')
cat('Removed:', nrow(ff) - nrow(ff_clean), '(',
round((1 - nrow(ff_clean)/nrow(ff)) * 100, 1), '%)\n')Flow Rate Stability
# Check for acquisition issues via flow rate
check_flow_rate <- function(ff, time_channel = 'Time') {
expr <- exprs(ff)
time <- expr[, time_channel]
# Bin by time
n_bins <- 50
bins <- cut(time, breaks = n_bins, labels = FALSE)
# Events per bin (flow rate proxy)
events_per_bin <- table(bins)
flow_rate <- as.numeric(events_per_bin)
# Calculate metrics
cv <- sd(flow_rate) / mean(flow_rate) * 100
# Detect anomalies (>2 SD from mean)
z_scores <- abs(scale(flow_rate))
anomalies <- which(z_scores > 2)
list(
mean_rate = mean(flow_rate),
cv_percent = cv,
anomaly_bins = anomalies,
stable = cv < 20 && length(anomalies) < 3
)
}
flow_qc <- check_flow_rate(ff)
cat('Flow rate CV:', round(flow_qc$cv_percent, 1), '%\n')
cat('Stable:', flow_qc$stable, '\n')Signal Drift Detection
# Detect signal drift over acquisition time
detect_signal_drift <- function(ff, channels, time_channel = 'Time') {
expr <- exprs(ff)
time <- expr[, time_channel]
n_bins <- 20
bins <- cut(time, breaks = n_bins, labels = FALSE)
drift_results <- lapply(channels, function(ch) {
bin_medians <- tapply(expr[, ch], bins, median, na.rm = TRUE)
# Linear trend
trend <- lm(bin_medians ~ seq_along(bin_medians))
slope <- coef(trend)[2]
r_squared <- summary(trend)$r.squared
# Percent change over acquisition
pct_change <- (tail(bin_medians, 1) - head(bin_medians, 1)) / head(bin_medians, 1) * 100
list(
channel = ch,
slope = slope,
r_squared = r_squared,
percent_change = pct_change,
drift_detected = abs(pct_change) > 10 && r_squared > 0.5
)
})
names(drift_results) <- channels
drift_results
}
marker_channels <- c('CD45', 'CD3', 'CD4', 'CD8')
drift <- detect_signal_drift(ff, marker_channels)
for (ch in names(drift)) {
if (drift[[ch]]$drift_detected) {
cat('DRIFT DETECTED:', ch, '(', round(drift[[ch]]$percent_change, 1), '%)\n')
}
}Margin Events Removal
# Remove events at detector saturation limits
remove_margin_events <- function(ff, channels = NULL) {
expr <- exprs(ff)
if (is.null(channels)) {
channels <- colnames(expr)
}
# Get channel ranges from FCS parameters
params <- parameters(ff)
margin_mask <- rep(FALSE, nrow(expr))
for (ch in channels) {
if (ch %in% colnames(expr)) {
# Get max range from parameters
idx <- match(ch, params@data$name)
if (!is.na(idx)) {
max_val <- params@data$range[idx]
# Events at max or min are margin events
margin_mask <- margin_mask | (expr[, ch] >= max_val * 0.99) | (expr[, ch] <= 0)
}
}
}
cat('Margin events:', sum(margin_mask), '(', round(mean(margin_mask) * 100, 2), '%)\n')
ff[!margin_mask, ]
}
ff_no_margin <- remove_margin_events(ff, c('FSC-A', 'SSC-A'))Dead Cell Exclusion
# Exclude dead cells using viability marker
exclude_dead_cells <- function(ff, viability_channel, threshold = NULL) {
expr <- exprs(ff)
viability <- expr[, viability_channel]
if (is.null(threshold)) {
# Auto-threshold using bimodal distribution
# Dead cells have higher viability dye uptake
threshold <- quantile(viability, 0.9)
}
live_mask <- viability < threshold
cat('Total events:', length(live_mask), '\n')
cat('Live cells:', sum(live_mask), '(', round(mean(live_mask) * 100, 1), '%)\n')
cat('Dead cells:', sum(!live_mask), '(', round(mean(!live_mask) * 100, 1), '%)\n')
ff[live_mask, ]
}
# Example with zombie dye
ff_live <- exclude_dead_cells(ff, 'Zombie-Aqua')CyTOF-Specific QC
# CyTOF-specific quality metrics
cytof_qc <- function(ff) {
expr <- exprs(ff)
# Event length check (cell size proxy)
if ('Event_length' %in% colnames(expr)) {
event_length <- expr[, 'Event_length']
# Typical single cells: 15-45
good_length <- event_length >= 15 & event_length <= 45
cat('Event length filter:', sum(good_length), '/', length(good_length),
'(', round(mean(good_length) * 100Other skills on openclaw-medical-skills.
adaptyv
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental…
adhd-daily-planner
Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time…
aeon
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting,…
agent-browser
Browse the web for any task — research topics, read articles, interact with web apps, fill forms, take screenshots, extract data,…
More skills from other plugins.
paddleocr-doc-parsing
Use this skill to extract structured Markdown/JSON from PDFs and document images—tables with cell-level precision, formulas as…
13c-metabolic-flux
Estimates intracellular metabolic fluxes from steady-state carbon-13 isotope-tracing measurements using validated atom maps,…
Questions about bio-flow-cytometry-cytometry-qc.
- Which coding agents can use bio-flow-cytometry-cytometry-qc?
- bio-flow-cytometry-cytometry-qc installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

