bio-flow-cytometry-compensation-transformation
Spillover compensation and data transformation for flow cytometry. Covers compensation matrix calculation, application, and biexponential/arcsinh transforms. Use when correcting spectral overlap between fluorophores or transforming data for analysis.
Best use case
bio-flow-cytometry-compensation-transformation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Spillover compensation and data transformation for flow cytometry. Covers compensation matrix calculation, application, and biexponential/arcsinh transforms. Use when correcting spectral overlap between fluorophores or transforming data for analysis.
Teams using bio-flow-cytometry-compensation-transformation should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/bio-flow-cytometry-compensation-transformation/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How bio-flow-cytometry-compensation-transformation Compares
| Feature / Agent | bio-flow-cytometry-compensation-transformation | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Spillover compensation and data transformation for flow cytometry. Covers compensation matrix calculation, application, and biexponential/arcsinh transforms. Use when correcting spectral overlap between fluorophores or transforming data for analysis.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
## Version Compatibility
Reference examples tested with: flowCore 2.14+, scanpy 1.10+
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.
# Compensation and Transformation
**"Compensate and transform my flow cytometry data"** → Correct spectral overlap between fluorophores using a compensation matrix and apply biexponential/arcsinh transforms for visualization and analysis.
- R: `flowCore::compensate()` then `flowCore::transform()` with `estimateLogicle()`
## Load Compensation Matrix
```r
library(flowCore)
# From FCS file keywords
fcs <- read.FCS('sample.fcs', transformation = FALSE)
comp_matrix <- keyword(fcs)$`$SPILLOVER`
# Or from CSV file
comp_matrix <- as.matrix(read.csv('compensation.csv', row.names = 1))
```
## Apply Compensation
```r
# Create compensation object
comp <- compensation(comp_matrix)
# Apply to flowFrame
fcs_comp <- compensate(fcs, comp)
# Apply to flowSet
fs_comp <- compensate(fs, comp)
```
## Calculate Compensation from Controls
```r
library(flowStats)
# Single-stained controls
controls <- read.flowSet(list.files('controls', pattern = '\\.fcs$', full.names = TRUE))
# Calculate spillover matrix
spillover <- spillover(controls,
unstained = 'Unstained.fcs',
fsc = 'FSC-A', ssc = 'SSC-A',
patt = '-A$', # Channel pattern
stain_match = 'regexpr')
# The result is a list; extract matrix
comp_matrix <- spillover$comp
```
## Transformation: Biexponential (Logicle)
```r
# Logicle transformation (standard for flow)
library(flowWorkspace)
# Auto-estimate parameters
lgcl <- estimateLogicle(fcs, colnames(fcs)[3:10])
# Apply
fcs_trans <- transform(fcs, lgcl)
# Manual logicle parameters
lgcl_manual <- logicleTransform(
w = 0.5, # Linearization width
t = 262144, # Top of scale
m = 4.5, # Decades of data
a = 0 # Additional negative range
)
```
## Transformation: Arcsinh (CyTOF)
```r
# Arcsinh transformation for CyTOF
arcsinh_transform <- function(x, cofactor = 5) {
asinh(x / cofactor)
}
# Apply to expression matrix
expr <- exprs(fcs)
expr_trans <- apply(expr[, marker_channels], 2, arcsinh_transform, cofactor = 5)
# Or using transformList
asinhTrans <- arcsinhTransform(transformationId = 'arcsinh', a = 0, b = 1/5)
trans_list <- transformList(marker_channels, asinhTrans)
fcs_trans <- transform(fcs, trans_list)
```
## Transformation: Log
```r
# Simple log transformation
logTrans <- logTransform(transformationId = 'log10', logbase = 10, r = 1, d = 1)
trans_list <- transformList(marker_channels, logTrans)
fcs_trans <- transform(fcs, trans_list)
```
## View Before/After Compensation
```r
library(ggcyto)
# Before compensation
p1 <- autoplot(fcs, 'FITC-A', 'PE-A') + ggtitle('Before Compensation')
# After compensation
p2 <- autoplot(fcs_comp, 'FITC-A', 'PE-A') + ggtitle('After Compensation')
library(patchwork)
p1 + p2
```
## Complete Preprocessing Pipeline
**Goal:** Apply a standard compensation-then-transformation workflow to all samples in a flowSet.
**Approach:** Define a reusable preprocessing function that first applies the spillover compensation matrix, then auto-estimates and applies logicle transformation on marker channels, and map it across all samples with fsApply.
```r
preprocess_flow <- function(fcs, comp_matrix, marker_channels) {
# 1. Compensation
comp <- compensation(comp_matrix)
fcs <- compensate(fcs, comp)
# 2. Transformation (logicle for flow, arcsinh for CyTOF)
lgcl <- estimateLogicle(fcs, marker_channels)
fcs <- transform(fcs, lgcl)
return(fcs)
}
# Apply to flowSet
fs_processed <- fsApply(fs, function(f) {
preprocess_flow(f, comp_matrix, marker_channels)
})
```
## CATALYST Preprocessing (CyTOF)
```r
library(CATALYST)
library(SingleCellExperiment)
# Create SingleCellExperiment from flowSet
sce <- prepData(fs,
panel = panel, # data.frame with columns: fcs_colname, antigen, marker_class
md = sample_info, # sample metadata
transform = TRUE, # Apply arcsinh
cofactor = 5,
FACS = FALSE) # TRUE for flow, FALSE for CyTOF
```
## Panel File Format (CATALYST)
```r
# panel.csv
panel <- data.frame(
fcs_colname = c('Yb176Di', 'Er168Di', 'Nd142Di'),
antigen = c('CD45', 'CD3', 'CD4'),
marker_class = c('type', 'type', 'type') # 'type' for phenotyping, 'state' for functional
)
```
## Save Preprocessed Data
```r
# Write transformed FCS
write.FCS(fcs_trans, 'sample_preprocessed.fcs')
# Save transformation for reproducibility
saveRDS(list(comp = comp_matrix, transform = lgcl), 'preprocessing_params.rds')
```
## Related Skills
- fcs-handling - Load FCS files first
- gating-analysis - Gate after preprocessing
- clustering-phenotyping - Cluster transformed dataRelated Skills
protein-design-workflow
End-to-end guidance for protein design pipelines. Use this skill when: (1) Starting a new protein design project, (2) Need step-by-step workflow guidance, (3) Understanding the full design pipeline, (4) Planning compute resources and timelines, (5) Integrating multiple design tools. For tool selection, use binder-design. For QC thresholds, use protein-qc.
nextflow-development
Run nf-core bioinformatics pipelines (rnaseq, sarek, atacseq) on sequencing data. Use when analyzing RNA-seq, WGS/WES, or ATAC-seq data—either local FASTQs or public datasets from GEO/SRA. Triggers on nf-core, Nextflow, FASTQ analysis, variant calling, gene expression, differential expression, GEO reanalysis, GSE/GSM/SRR accessions, or samplesheet creation.
flowio
Parse FCS (Flow Cytometry Standard) files v2.0-3.1. Extract events as NumPy arrays, read metadata/channels, convert to CSV/DataFrame, for flow cytometry data preprocessing.
bio-read-qc-fastp-workflow
All-in-one read preprocessing with fastp including adapter trimming, quality filtering, deduplication, base correction, and HTML report generation. Use when preprocessing Illumina data and wanting a single fast tool instead of separate Cutadapt, Trimmomatic, and FastQC steps.
bio-microbiome-qiime2-workflow
QIIME2 command-line workflow for 16S/ITS amplicon analysis. Alternative to DADA2/phyloseq R workflow with built-in provenance tracking. Use when preferring CLI over R, needing reproducible provenance, or working within QIIME2 ecosystem.
bio-imaging-mass-cytometry-spatial-analysis
Spatial analysis of cell neighborhoods and interactions in IMC data. Covers neighbor graphs, spatial statistics, and interaction testing. Use when analyzing spatial relationships between cell types, testing for neighborhood enrichment, or identifying cell-cell interaction patterns in imaging mass cytometry data.
bio-imaging-mass-cytometry-quality-metrics
Quality metrics for IMC data including signal-to-noise, channel correlation, tissue integrity, and acquisition QC. Use when assessing data quality before analysis or troubleshooting problematic acquisitions.
bio-imaging-mass-cytometry-phenotyping
Cell type assignment from marker expression in IMC data. Covers manual gating, clustering, and automated classification approaches. Use when assigning cell types to segmented IMC cells based on protein marker expression or when phenotyping cells in multiplexed imaging data.
bio-imaging-mass-cytometry-interactive-annotation
Interactive cell type annotation for IMC data. Covers napari-based annotation, marker-guided labeling, training data generation, and annotation validation. Use when manually annotating cell types for training classifiers or validating automated phenotyping results.
bio-imaging-mass-cytometry-data-preprocessing
Load and preprocess imaging mass cytometry (IMC) and MIBI data. Covers MCD/TIFF handling, hot pixel removal, and image normalization. Use when starting IMC analysis from raw MCD files or preparing images for segmentation.
bio-imaging-mass-cytometry-cell-segmentation
Cell segmentation from multiplexed tissue images. Covers deep learning (Cellpose, Mesmer) and classical approaches for nuclear and whole-cell segmentation. Use when extracting single-cell data from IMC or MIBI images after preprocessing.
bio-flow-cytometry-gating-analysis
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.