/lucid-coder:group-testsfrom lucid-coder
Group-comparison and association tests on sample-level values (cell-type frequencies or CLR values, signature scores, Olink NPX): one Wilcoxon rank-sum, paired Wilcoxon signed-rank, Spearman or Pearson test per feature, BH or Bonferroni across features, an effect size for every test, a table, box or scatter figures for the top features, a report and a reproducibility bundle. Fire on "Wilcoxon per cell type", "compare frequencies between groups", "paired test pre vs post per donor", "Olink NPX healthy vs disease", "correlate scores with age", "Spearman per feature with FDR". Do NOT fire for gene-level differential expression from counts (pseudobulk DE), cell-level tests (marker genes, rank_genes_groups), compositional models (scCODA, crumblr, propeller), regression with covariates, or combining p-values across cohorts.
Ships in lucid-coder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You are the dispatcher for group-tests. The script does the analysis; you collect its arguments, run it, and explain its outputs.
Run scripts/group_tests.py. Never re-implement the tests, change a threshold,
or pick a value the user has not given. If a required argument is unknown, ask
the user (these are grill questions), or run --demo only when the user asks
for a demo.
Then read result.json and relay chat_summary_lines and preferred_artifacts.
If the script prints ERROR: ... and exits 2, tell the user the message and the
argument it names. Do not work around it.
| Input | Format | Required content | Example |
|---|---|---|---|
--input | TSV, long | columns feature, subject, value (numeric) | examples/demo.tsv |
| group column | TSV column | --group-col, holding both --levels | visit with pre, post |
| pair column | TSV column | --pair-col, one sample per pair and level | donor |
| covariate | TSV column | --covariate, numeric | age |
One row per feature and subject. A subject is one sample: in paired data each
donor has two subjects (D01_pre, D01_post) that share a pair id. Labels are
read as text, so 01 stays 01.
Required checks (docs/pipeline-skills.md, adopted 2026-10-27):
duplicate_rows); in a long table that is the uniqueness check.paired-wilcoxon pairs samples by --pair-col. An
unpaired test assumes one subject per donor; ask before running it on repeats.--reference: features are generic (frequencies, scores, NPX), not genes,
so no genome build is recorded. Gene-level input belongs in pseudobulk-de.result.json (n_missing_dropped_by_group; all for correlation tests).Ask these through the analysis contract: ${CLAUDE_PLUGIN_ROOT}/skills/lucid-coder/references/contracts.md.
Each row is a grill question. Ask the user; never fill one in.
| Argument | Grill question | Demo-only value |
|---|---|---|
--context | Species, tissue or cell type, condition and dataset? It opens the report and the chat summary. | synthetic demo: 20 donors, pre vs post, 30 features, no real tissue |
--input | Which TSV holds the values? | examples/demo.tsv |
--test | Two groups (wilcoxon), paired samples (paired-wilcoxon), or a trend with a continuous covariate (spearman rank, pearson linear)? | paired-wilcoxon |
--group-col | Which column holds the groups? (group tests only) | visit |
--levels | Which two levels, reference first (a,b)? | pre,post |
--pair-col | Which column pairs the samples, e.g. donor? (paired only) | donor |
--covariate | Which numeric column do we correlate with? (correlation only) | absent |
--value-unit | What unit or scale is value on (e.g. CLR, NPX, log2, % of CD4 T cells)? It labels the y axis. | a.u. |
--adjust | Correct across features with bh (FDR) or bonferroni (FWER)? | bh |
--alpha | Which adjusted-p cutoff marks a feature significant? | 0.05 |
--n-plot | How many top features get a figure? | 4 |
--seed | Which seed fixes the box-plot jitter? | 0 |
--outdir | Which new directory gets the outputs? It must not exist. | given by the user |
The last column is demo-only, not defaults. --demo alone pins all of them;
beside --demo only --outdir may be given.
--test decides which of --group-col, --levels,
--pair-col, --covariate it needs; an extra one is an error.--levels of
--group-col, or a numeric --covariate. Drop rows with a missing value and
count them per level. Refuse a repeated (feature, subject) or (feature, group, pair).wilcoxon: two-sided Mann-Whitney U of b against a
(scipy.stats.mannwhitneyu, method="auto"); effect = Hodges-Lehmann
shift, the median of all b - a differences.paired-wilcoxon: complete pairs only; signed-rank test of b - a
(scipy.stats.wilcoxon, zero_method="wilcox", method="auto"); effect =
median of the Walsh averages of b - a.spearman / pearson: scipy.stats.spearmanr / pearsonr of value on
the covariate; effect = rho / r.
A feature the test cannot run on (an empty group, no non-zero paired
difference, fewer than 3 points or a constant column) gets an NA p-value.--adjust); NA stays NA.padj < --alpha. Sort by padj, then feature, NA last.--n-plot features with the lowest padj.Levels are a,b: a is the reference, so every shift is b minus a.
python scripts/group_tests.py \
--context "human PBMC, CD4 T cell frequencies, pre vs post vaccination, cohort X" \
--input results/2026-10-27_freqs/clr_long.tsv \
--test paired-wilcoxon --group-col visit --levels pre,post --pair-col donor \
--value-unit CLR --adjust bh --alpha 0.05 --n-plot 6 --seed 0 \
--outdir results/2026-10-27_freq-tests
python scripts/group_tests.py --context "human serum, Olink NPX vs age, cohort X" --input scores.tsv --test spearman --covariate age --value-unit "score, a.u." \
--adjust bh --alpha 0.05 --n-plot 6 --seed 0 --outdir results/score-age
# Demo (only when the user asks for one)
python scripts/group_tests.py --demo --outdir demo_out
tests.tsv has one row per feature, sorted by padj, then feature, NA last.
Its columns depend on --test:
wilcoxon: feature, n_a, n_b, median_a, median_b, hodges_lehmann,
statistic (U of b), pvalue, padj, significant;paired-wilcoxon: feature, n_pairs, median_a, median_b, hodges_lehmann,
statistic (scipy's two-sided signed-rank statistic), pvalue, padj, significant;spearman / pearson: feature, n, rho / r, pvalue, padj, significant.Here a and b are the level names (median_pre, median_post).
Figures are named by padj rank, top01 to top<n-plot>; the demo draws four.
outdir/
├── report.md # params, summary, figures with padj captions
├── result.json # context, test, n_features, n_tested, n_significant, n_rows_dropped, n_missing_dropped_by_group, significant_features, params, seed, chat_summary_lines, preferred_artifacts
├── tables/
│ └── tests.tsv
├── figures/
│ ├── top01.pdf
│ ├── top01.png
│ ├── top01.csv
│ ├── top02.pdf
│ ├── top02.png
│ ├── top02.csv
│ ├── top03.pdf
│ ├── top03.png
│ ├── top03.csv
│ ├── top04.pdf
│ ├── top04.png
│ └── top04.csv
└── reproducibility/
├── commands.sh # argv as run, and the resolved command with every argument
├── environment.txt # Python and package versions
└── checksums.sha256 # tables and figure PDFs; sha256sum -c from outdir
wilcoxon on paired samples because the
paired run "loses" incomplete donors. Do not. Paired samples are not
independent; ask whether the design is paired and pass --pair-col.*, **, ns) to a
figure. Do not. Stars hide the correction family and are often drawn on raw p
in the corpus; padj with its family is in the caption.--alpha or switch --adjust after seeing
few hits. Do not. Both are the user's answers, fixed before the run; report
the count as it is.sumlog)
on adjusted p. Do not. That is a separate meta-analysis question; run one
cohort per call and ask the user.claims.strength). Groups differ in more than
the label.--demo only when the
user asked for a demo.Not arguments: the script sets these, and reproducibility/environment.txt
records the package versions. A change is a maintainer edit, not a user choice.
wilcoxon(zero_method="wilcox", method="auto") on paired
differences (zero differences dropped, as R's wilcox.test);
mannwhitneyu(alternative="two-sided", method="auto"); spearmanr and
pearsonr.Corpus sources, ClawBio mechanisms, tests, citations and the plot spec are in references/maintainer.md. The agent running the script does not need them.
examples/demo.tsv (opens in a new tab)examples/make_demo.py (opens in a new tab)references/maintainer.md (opens in a new tab)scripts/group_tests.py (opens in a new tab)scripts/palettes.py (opens in a new tab)scripts/plots.py (opens in a new tab)scripts/skillkit.py (opens in a new tab)scripts/theme.py (opens in a new tab)tests/test_group_tests.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mdmanurung/lucid-coder --plugin lucid-coder27 skills in this plugin
/alignInstall the lucid-coder house-style configs into this repository, one file at a time, after showing each diff and asking. Use when the user says "align this repo", "install the house style configs", "set up air/ruff/lintr", or "add the palette file"./cccLigand-receptor cell-cell communication between cell types from a log-normalised single-cell h5ad with LIANA+ rank_aggregate (CellPhoneDB, Connectome, log2FC, NATMI, SingleCellSignalR, or a subset), a bundled or exported ligand-receptor resource TSV, a fixed pass rule on magnitude and specificity ranks, a source x target count heatmap, an LR dot plot, a report and a reproducibility bundle. Optional per-sample runs. Fire on "cell-cell communication", "ligand-receptor analysis", "which cell types talk to which", "LIANA", "CellPhoneDB", "rank_aggregate", "CCC between clusters". Do NOT fire for spatial CCC (bivariate, MISTy), for factorising CCC across many samples (Tensor-Cell2cell, MOFAtalk), for DE-driven CCC between conditions, for non-human data without a translated resource, or for raw counts.Other plugins' skills for the same job
/compositionCell-type composition and differential abundance with crumblr: counts cells per sample and label (from a cell-level h5ad or a counts TSV), drops rare labels, runs crumblr's precision-weighted CLR and variancePartition dream (fixed and random effects, e.g. (1|donor)), and writes tables, a stacked composition bar, per-label proportion boxes, an effect forest, a report and a reproducibility bundle. Fire on "cell-type composition", "differential abundance of cell types", "do cell-type proportions change", "crumblr", "CLR of cell frequencies", "which populations expand after stimulation". Do NOT fire for neighbourhood-level DA on a KNN graph (Milo), gene expression DE (pseudobulk or cell-level), scCODA / Bayesian composition models, or a plain Wilcoxon on frequencies (group-tests).