sciagent-skill-creator
Scaffold a new SciAgent-Skills entry. Picks pipeline/toolkit/database/guide template, creates skills/{category}/{name}/SKILL.md…
Harmony batch correction for scRNA-seq and other omics. Removes batch effects from PCA embeddings while preserving biology. Run after PCA, before UMAP. Scales to millions of cells. Python (harmonypy, scanpy) and R (Seurat).
Claude Code
$ npx -y skills add jaechang-hits/SciAgent-Skills --skill harmony-batch-correction --agent claude-code
Codex
$ npx skills add jaechang-hits/SciAgent-Skills --skill harmony-batch-correction -a codex -y
Cursor
$ npx skills add jaechang-hits/SciAgent-Skills --skill harmony-batch-correction -a cursor -y
Gemini CLI
$ npx skills add jaechang-hits/SciAgent-Skills --skill harmony-batch-correction -a gemini-cli -y
GitHub Copilot
$ npx skills add jaechang-hits/SciAgent-Skills --skill harmony-batch-correction -a github-copilot -y
OpenCode
$ npx skills add jaechang-hits/SciAgent-Skills --skill harmony-batch-correction -a opencode -y
Windsurf
$ npx skills add jaechang-hits/SciAgent-Skills --skill harmony-batch-correction -a windsurf -y
name: "harmony-batch-correction" description: "Harmony batch correction for scRNA-seq and other omics. Removes batch effects from PCA embeddings while preserving biology. Run after PCA, before UMAP. Scales to millions of cells. Python (harmonypy, scanpy) and R (Seurat)." license: "MIT"
Harmony is a fast, scalable algorithm for batch integration in single-cell data. It takes a PCA embedding (cells × PCs) as input and returns a corrected embedding from which batch effects have been regressed out via iterative soft-clustering and per-cluster linear regression. The corrected embedding is then used to compute neighbors, UMAP, and downstream clustering — the raw count matrix is never modified. Harmony works for single-cell RNA-seq, ATAC-seq, and other omics modalities where a PCA-like embedding is available.
pip install harmonypy "scanpy[leiden]" anndata pandas matplotlib
# R installation (for Step 7 / Seurat integration)
install.packages("harmony")
# If using Seurat:
install.packages("Seurat")Settle these with the user before writing any analysis code.
decisions:
- id: D1
param: batchKey
kind: required
source: data
ask: "Which variable separates samples that were processed apart - donor, run, chemistry, or a combination?"
default: null
- id: D2
param: inputEmbedding
kind: derived
source: upstream
ask: "Which reduced space should be corrected?"
default: "the PCA embedding computed upstream"
- id: D3
param: diversityPenalty
kind: required
source: user
depends_on: [D1]
ask: "How hard should batches be pushed together? Too hard erases real differences between samples."
default: "2.0; raise toward 4-6 when batch sizes are very uneven"
- id: D4
param: numClusters
kind: optional_conditional
source: data
ask: "Does the dataset contain rare populations that need more soft clusters to survive correction?"
default: "automatic, min(100, cells/30)"
- id: D5
param: maxIterations
kind: optional_conditional
source: data
ask: "Did the correction converge, or does it need more iterations?"
default: 10
- id: D6
param: smallClusterProtection
kind: optional_conditional
source: user
ask: "Are small populations being over-split during correction?"
default: "off"
- id: D7
param: kernelBandwidth
kind: optional
source: user
ask: "Should Harmony use its standard soft-clustering bandwidth, or be tuned for unusually heterogeneous batches?"
default: 0.1D3 is where batch correction goes wrong in the direction nobody checks. Under-correction is visible - batches stay separated in the embedding. Over-correction is not: samples mix beautifully because a real treatment effect was removed along with the batch effect. Ask what the batch variable is confounded with before raising it.
Minimal pipeline — load preprocessed data, run Harmony via scanpy, produce UMAP:
import scanpy as sc
# Load preprocessed AnnData (counts normalized, HVGs selected, PCA run)
adata = sc.read_h5ad("preprocessed.h5ad") # must have adata.obs["batch"]
# Run Harmony batch correction (corrects adata.obsm["X_pca"] → "X_pca_harmony")
sc.external.pp.harmony_integrate(adata, key="batch")
# Build neighborhood graph on corrected embedding, then UMAP
sc.pp.neighbors(adata, use_rep="X_pca_harmony")
sc.tl.umap(adata)
sc.tl.leiden(adata, resolution=0.5)
# Visualize
sc.pl.umap(adata, color=["batch", "leiden"], ncols=2)
print(f"Clusters: {adata.obs['leiden'].nunique()} | Cells: {adata.n_obs}")Filter, normalize, select highly variable genes (HVGs), and run PCA. Harmony is applied to the PCA embedding produced here.
import scanpy as sc
import numpy as np
sc.settings.set_figure_params(dpi=80, facecolor="white")
# Load multi-batch data — adata.obs must contain a batch column
adata = sc.read_h5ad("multi_batch_counts.h5ad")
# Alternatively, concateTurn your AI coding agent into a life sciences expert — 199 bioinformatics skills for Claude Code covering RNA-seq, single-cell analysis, genomics, proteomics, drug discovery, and more. Boosted BixBench from 65% to 92%. Open source.
Scaffold a new SciAgent-Skills entry. Picks pipeline/toolkit/database/guide template, creates skills/{category}/{name}/SKILL.md…
Bayesian modeling with PyMC 5: priors, likelihood, NUTS/ADVI sampling, diagnostics (R-hat, ESS), LOO/WAIC comparison, prediction.…
Time-to-event modeling with scikit-survival: Cox PH (elastic net), Random Survival Forests, Boosting, SVMs for censored data.…
Guided statistical analysis: test choice, assumption checks, effect sizes, power, APA reporting. Pick tests, verify assumptions,…
Python statistical modeling: regression (OLS, WLS, GLM), discrete (Logit, Poisson, NegBin), time series (ARIMA, SARIMAX, VAR),…
DL cell/nucleus segmentation for fluorescence and brightfield microscopy. Pre-trained models (cyto3, nuclei, tissuenet) and a…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.