Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Read and manipulate Flow Cytometry Standard (FCS) files. Covers loading data, accessing parameters, and basic data exploration. Use when loading and inspecting flow or mass cytometry data before preprocessing.
.claude/skills/bio-flow-cytometry-fcs-handling/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-12 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✓ | ▲ Improved | — | — |
| case-18 | ✗→✓ | ▲ Improved | — | — |
| case-03 | ✗→✗ | = Same ✗ | — | — |
| case-04 | ✗→✗ | = Same ✗ | — | — |
Reference examples tested with: flowCore 2.14+, scanpy 1.10+
Before using code patterns, verify installed versions match. If versions differ:
packageVersion('<pkg>') then ?function_name to verify parametersIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"Load my FCS files into R or Python" → Read Flow Cytometry Standard (FCS) files, access channel parameters and metadata, and explore event data for downstream analysis.
flowCore::read.FCS() or flowCore::read.flowSet() for multiple filesfcsparser.parse() or FlowCal.io.FCSData()Goal: Read a single FCS file and inspect its parameters and metadata.
Approach: Use flowCore's read.FCS with transformation disabled to load raw data, then examine parameter names and descriptions.
rlibrary(flowCore) # Read single FCS file fcs <- read.FCS('sample.fcs', transformation = FALSE, truncate_max_range = FALSE) # File info print(fcs) # Parameter names colnames(fcs) # Short names pData(parameters(fcs)) # Full metadata including descriptions
Goal: Read a batch of FCS files into a single flowSet container for uniform processing.
Approach: List FCS files from a directory and load them into a flowSet with read.flowSet.
r# Read multiple files into flowSet files <- list.files('data', pattern = '\\.fcs$', full.names = TRUE) fs <- read.flowSet(files, transformation = FALSE, truncate_max_range = FALSE) # Sample names sampleNames(fs) # Access individual samples fcs1 <- fs[[1]]
Goal: Extract the expression matrix from a flowFrame for numeric analysis.
Approach: Call exprs() to get the cells-by-channels matrix, then subset or summarize as needed.
r# Get expression matrix expr <- exprs(fcs) head(expr) # Dimensions dim(expr) # cells x channels # Channel statistics summary(expr) # Get specific channels cd4_expr <- expr[, 'CD4']
Goal: Retrieve channel names, descriptions, and ranges from the FCS parameter table.
Approach: Access the parameters slot via pData(parameters(fcs)) and build a short-name to description mapping.
r# Parameter information params <- pData(parameters(fcs)) print(params) # Parameter columns: # - name: short name (e.g., "FL1-A") # - desc: description (e.g., "CD4") # - range: max value # - minRange: min value # Get channel mapping channel_map <- setNames(params$desc, params$name)
r# Rename using descriptions rename_channels <- function(fcs) { params <- pData(parameters(fcs)) new_names <- ifelse(is.na(params$desc) | params$desc == '', params$name, params$desc) colnames(fcs) <- new_names return(fcs) } fcs_renamed <- rename_channels(fcs)
r# Subset by cells (rows) fcs_subset <- fcs[1:1000, ] # Subset by channels (columns) fcs_markers <- fcs[, c('CD4', 'CD8', 'CD3')] # Subset by expression values high_cd4 <- fcs[exprs(fcs)[, 'CD4'] > 1000, ]
r# Combine multiple flowSets fs_combined <- rbind2(fs1, fs2) # Or concatenate into single flowFrame all_data <- fsApply(fs, exprs) all_data <- do.call(rbind, all_data)
r# Write single file write.FCS(fcs, 'output.fcs') # Write flowSet write.flowSet(fs, outdir = 'output_dir')
r# Add sample annotations pData(fs) <- data.frame( name = sampleNames(fs), condition = c('Control', 'Control', 'Treatment', 'Treatment'), patient = c('P1', 'P2', 'P1', 'P2') ) # Access pData(fs)
rlibrary(ggcyto) # Density plot autoplot(fcs, 'FSC-A') # Bivariate plot autoplot(fcs, 'CD4', 'CD8') # Multiple samples autoplot(fs, 'CD4', 'CD8')
r# Time parameter check if ('Time' %in% colnames(fcs)) { time <- exprs(fcs)[, 'Time'] plot(time, type = 'l', main = 'Acquisition Time') } # Event count per file fsApply(fs, nrow) # Check for saturated events saturation <- apply(exprs(fcs), 2, function(x) mean(x == max(x)) * 100) print(saturation)
r# For use with tidyverse library(tidyverse) df <- as.data.frame(exprs(fcs)) df$sample <- 'sample1' # From flowSet df_all <- fsApply(fs, function(f) { d <- as.data.frame(exprs(f)) d$sample <- identifier(f) d }, simplify = FALSE) df_all <- bind_rows(df_all)
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +13 percentage points is the difference between those two pass rates over the 23 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.