| name | bio-workflows-cytometry-pipeline |
| description | End-to-end flow cytometry workflow from FCS files to differential analysis. Orchestrates compensation, transformation, gating/clustering, and statistical testing with CATALYST/diffcyt. Use when processing flow or mass cytometry data end-to-end. |
| tool_type | r |
| primary_tool | CATALYST |
| workflow | true |
| depends_on | ["flow-cytometry/fcs-handling","flow-cytometry/compensation-transformation","flow-cytometry/gating-analysis","flow-cytometry/clustering-phenotyping","flow-cytometry/differential-analysis","flow-cytometry/doublet-detection","flow-cytometry/bead-normalization","flow-cytometry/cytometry-qc"] |
Flow Cytometry Pipeline
Pipeline Overview
FCS Files ──> Compensation ──> Transformation ──> Gated/Clustered Data
│
▼
┌─────────────────────────────────────────────────┐
│ cytometry-pipeline │
├─────────────────────────────────────────────────┤
│ 1. Load FCS Files │
│ 2. Compensation & Transformation │
│ 3. QC & Filtering │
│ 4. Clustering (FlowSOM) or Gating │
│ 5. Dimensionality Reduction (UMAP) │
│ 6. Differential Abundance/State Analysis │
│ 7. Visualization │
└─────────────────────────────────────────────────┘
│
▼
Differential Cell Populations + Markers
Complete R Workflow (CATALYST)
library(CATALYST)
library(diffcyt)
library(SingleCellExperiment)
library(flowCore)
library(ggplot2)
panel <- data.frame(
fcs_colname = c('FSC-A', 'SSC-A', 'CD45', 'CD3', 'CD4', 'CD8', 'CD19',
'CD14', 'CD56', 'HLA-DR', 'Ki67', 'IFNg'),
antigen = c('FSC', 'SSC', 'CD45', 'CD3', 'CD4', 'CD8',
marker_class
md data.frame
file_name list.files pattern
sample_id paste0
condition each
patient_id paste0
cat nrowmd
fcs_files file.path mdfile_name
fs read.flowSetfcs_files
fs_comp compensatefs spilloverfs
sce prepDatafs_comp panel md
transform
cofactor
FACS
cat ncolsce
tablescesample_id
plotExprssce color_by
ggsave width height
plotMDSsce color_by
ggsave width height
cat
sce clustersce
features
xdim ydim
maxK
seed
tablecluster_idssce
cat
sce runDRsce dr features
plotDRsce dr color_by
ggsave width height
plotDRsce dr color_by
ggsave width height
plotExprHeatmapsce features k
by scale bars
ggsave width height
cluster_annotations
scecell_type cluster_annotationscluster_idssce
cat
design createDesignMatrixeisce cols_design
contrast createContrast
res_DA testDA_edgeRsce design contrast cluster_id
da_results as.data.framerowDatares_DA
da_results da_resultsorderda_resultsp_adj
cat
printda_results
res_DS testDS_limmasce design contrast
cluster_id
markers_include rownamesscerowDatascemarker_class
ds_results as.data.framerowDatares_DS
cat
sig_ds ds_resultsds_resultsp_adj
printsig_ds
plotDiffHeatmapsce res_DA fdr
ggsave width height
plotAbundancessce k by group_by
ggsave width height
da_resultssignificant da_resultsp_adj
ggplotda_results aesx logFC y log10p_adj color significant
geom_pointsize
geom_hlineyintercept log10 linetype
scale_color_manualvalues
theme_bw
labstitle
ggsave width height
write.csvda_results row.names
write.csvds_results row.names
saveRDSsce
cat
cat da_resultsp_adj
flowCore + Manual Gating Workflow
library(flowCore)
library(flowWorkspace)
library(ggcyto)
fs <- read.flowSet(list.files('data/', pattern = '\\.fcs$', full.names = TRUE))
comp_matrix <- spillover(fs[[1]])[[1]]
fs_comp <- compensate(fs, comp_matrix)
trans <- estimateLogicle(fs_comp[[1]], colnames(comp_matrix))
fs_trans <- transform(fs_comp, trans)
gs <- GatingSet(fs_trans)
gs_add_gating_methodgs alias
pop parent
dims
gating_method
gating_args K target
gs_add_gating_methodgs alias
pop parent
dims
gating_method
autoplotgs
gated_data gs_pop_get_datags
Python Alternative (FlowCytometryTools)
import flowkit as fk
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
sample = fk.Sample('sample.fcs')
data = sample.as_dataframe(source='raw')
comp_matrix = sample.metadata['spill']
data_comp = np.dot(data, np.linalg.inv(comp_matrix))
cofactor = 150
data_trans = np.arcsinh(data_comp / cofactor)
scaler = StandardScaler()
data_scaled = scaler.fit_transform(data_trans)
kmeans = KMeans(n_clusters=10, random_state=42)
clusters = kmeans.fit_predict(data_scaled)
QC Checkpoints
| Stage | Check | Action if Failed |
|---|
| Loading | All FCS files read | Check file integrity |
| Compensation | Spillover values reasonable | Recalculate |
| Transformation | Distributions normalized | Adjust cofactor |
| Events | >10K cells per sample | Check acquisition |
| Clustering | 10-30 populations | Adjust K/resolution |
| DA | >3 replicates per group | Need more samples |
Workflow Variants
CyTOF Data
sce <- prepData(fs, panel, md,
transform = TRUE,
cofactor = 5,
FACS = FALSE)
Paired Design
design <- createDesignMatrix(ei(sce), cols_design = c('condition', 'patient_id'))
formula <- createFormula(ei(sce), cols_fixed = 'condition', cols_random = 'patient_id')
res_DA <- testDA_voom(sce, formula, contrast)
Related Skills
- flow-cytometry/fcs-handling - FCS file operations
- flow-cytometry/compensation-transformation - Data preprocessing
- flow-cytometry/gating-analysis - Manual gating
- flow-cytometry/clustering-phenotyping - Unsupervised clustering
- flow-cytometry/differential-analysis - Statistical testing
- flow-cytometry/doublet-detection - Remove doublet events
- flow-cytometry/bead-normalization - CyTOF EQ bead normalization
- flow-cytometry/cytometry-qc - Comprehensive QC
- single-cell/clustering - Related clustering methods