/bio-experimental-design-batch-design
<!--
$ npx -y skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-experimental-design-batch-design --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/bio-experimental-design-batch-design
Context preview
The summary Claude sees to decide when to auto-load this skill.
<!--
SKILL.md
bio-experimental-design-batch-design.SKILL.md<!--
COPYRIGHT NOTICE
This file is part of the "Universal Biomedical Skills" project.
Copyright (c) 2026 MD BABU MIA, PhD <md.babu.mia@mssm.edu>
All Rights Reserved.
#
This code is proprietary and confidential.
Unauthorized copying of this file, via any medium is strictly prohibited.
#
Provenance: Authenticated by MD BABU MIA
-->
--- name: bio-experimental-design-batch-design description: Designs experiments to minimize and account for batch effects using balanced layouts and blocking strategies. Use when planning multi-batch experiments, assigning samples to sequencing lanes, or designing studies where technical variation could confound biological signals. tool_type: r primary_tool: sva measurable_outcome: Execute skill workflow successfully with valid output within 15 minutes. allowed-tools:
- read_file
- run_shell_command
---
Batch Design and Mitigation
Core Principle
Batch effects are unavoidable. Good design makes them correctable.
Design Rules
1. **Never confound batch with condition** - Each batch must contain all conditions 2. **Balance samples across batches** - Equal numbers per condition per batch 3. **Randomize within constraints** - Avoid systematic patterns 4. **Include controls** - Same samples across batches if possible
Balanced Design Example
# BAD: Confounded design
# Batch 1: All treated samples
# Batch 2: All control samples
# -> Cannot separate batch from treatment
# GOOD: Balanced design
# Batch 1: 3 treated, 3 control
# Batch 2: 3 treated, 3 control
# -> Batch effect can be estimated and removed
Sample Assignment
library(designit)
# Create balanced assignment
samples <- data.frame(
sample_id = paste0('S', 1:24),
condition = rep(c('ctrl', 'treat'), each = 12),
sex = rep(c('M', 'F'), 12)
)
# Optimize batch assignment
batch_design <- osat(samples, batch_size = 8,
balance_cols = c('condition', 'sex'))Detecting Batch Effects
library(sva)
# From count matrix
mod <- model.matrix(~condition, colData)
mod0 <- model.matrix(~1, colData)
# Estimate number of surrogate variables (hidden batches)
n_sv <- num.sv(counts_normalized, mod)
# Estimate surrogate variables
svobj <- sva(counts_normalized, mod, mod0, n.sv = n_sv)
Correction Methods
| Method | When to Use | |--------|-------------| | ComBat | Known batches, moderate effects | | SVA | Unknown batches, exploratory | | RUVseq | Using control genes | | limma::removeBatchEffect | Visualization only |
Documenting Design
Always record:
- Date of sample processing
- Reagent lot numbers
- Operator
- Equipment/lane assignments
- Any deviations from protocol
Related Skills
- experimental-design/power-analysis - Account for batch in power calculations
- differential-expression/batch-correction - Correcting batch effects in analysis
- single-cell/batch-integration - scRNA-seq batch correction
<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->
Read more
<!--
COPYRIGHT NOTICE
This file is part of the "Universal Biomedical Skills" project.
Copyright (c) 2026 MD BABU MIA, PhD <md.babu.mia@mssm.edu>
All Rights Reserved.
#
This code is proprietary and confidential.
Unauthorized copying of this file, via any medium is strictly prohibited.
#
Provenance: Authenticated by MD BABU MIA
-->
--- name: bio-experimental-design-batch-design description: Designs experiments to minimize and account for batch effects using balanced layouts and blocking strategies. Use when planning multi-batch experiments, assigning samples to sequencing lanes, or designing studies where technical variation could confound biological signals. tool_type: r primary_tool: sva measurable_outcome: Execute skill workflow successfully with valid output within 15 minutes. allowed-tools:
- read_file
- run_shell_command
---
Batch Design and Mitigation
Core Principle
Batch effects are unavoidable. Good design makes them correctable.
Design Rules
1. **Never confound batch with condition** - Each batch must contain all conditions 2. **Balance samples across batches** - Equal numbers per condition per batch 3. **Randomize within constraints** - Avoid systematic patterns 4. **Include controls** - Same samples across batches if possible
Balanced Design Example
# BAD: Confounded design # Batch 1: All treated samples # Batch 2: All control samples # -> Cannot separate batch from treatment # GOOD: Balanced design # Batch 1: 3 treated, 3 control # Batch 2: 3 treated, 3 control # -> Batch effect can be estimated and removed
Sample Assignment
library(designit)
# Create balanced assignment
samples <- data.frame(
sample_id = paste0('S', 1:24),
condition = rep(c('ctrl', 'treat'), each = 12),
sex = rep(c('M', 'F'), 12)
)
# Optimize batch assignment
batch_design <- osat(samples, batch_size = 8,
balance_cols = c('condition', 'sex'))Detecting Batch Effects
library(sva) # From count matrix mod <- model.matrix(~condition, colData) mod0 <- model.matrix(~1, colData) # Estimate number of surrogate variables (hidden batches) n_sv <- num.sv(counts_normalized, mod) # Estimate surrogate variables svobj <- sva(counts_normalized, mod, mod0, n.sv = n_sv)
Correction Methods
| Method | When to Use | |--------|-------------| | ComBat | Known batches, moderate effects | | SVA | Unknown batches, exploratory | | RUVseq | Using control genes | | limma::removeBatchEffect | Visualization only |
Documenting Design
Always record:
- Date of sample processing
- Reagent lot numbers
- Operator
- Equipment/lane assignments
- Any deviations from protocol
Related Skills
- experimental-design/power-analysis - Account for batch in power calculations
- differential-expression/batch-correction - Correcting batch effects in analysis
- single-cell/batch-integration - scRNA-seq batch correction
<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->
The largest open-source medical AI skill library for OpenClaw.
Other skills on openclaw-medical-skills.
- /aav-vector-design-agent
<!--
Open skill - /adaptyv
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use
Open skill - /adhd-daily-planner
Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time estimation, dopamine-aware task design, and building systems that
Open skill - /aeon
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations
Open skill - /agent-browser
Browse the web for any task — research topics, read articles, interact with web apps, fill forms, take screenshots, extract data, and test web pages. Use whenever a browser would be useful, not just when the user explicitly asks.
Open skill - /agentd-drug-discovery
<!--
Open skill

