claude/skills/heatmap-dimensions/SKILL.md
This skill creates publication-quality heatmaps with automatically calculated dimensions for Nature journal specifications. Use when user asks to "create a heatmap", "make a DE gene heatmap", "plot expression heatmap", "heatmap with proper dimensions", "clustered heatmap", "gene expression heatmap", "correlation heatmap", "heatmap for DESeq2 results", "ComplexHeatmap", "pheatmap with correct size", or any mention of heatmap visualization. Automatically calculates optimal height based on number of genes (rows) and determines whether to show row labels. Fixed width of 180mm for publication quality. Supports DESeq2, correlation matrices, and clustering analysis.
npx skillsauth add sahuno/llm_configs heatmap-dimensionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create publication-quality heatmaps with automatically calculated dimensions based on the number of genes and samples. Uses ComplexHeatmap for advanced features.
| Parameter | Value | Rationale | |-----------|-------|-----------| | Width | 180mm | Double column, space for dendrograms/labels/legend | | base_size | 20 | Readable fonts at print size | | Max Height | 170mm | Nature journal constraint |
Note: 90mm width is NOT supported for heatmaps - insufficient space.
source("/data1/greenbab/users/ahunos/apps/llm_configs/claude/skills/heatmap-dimensions/calc_heatmap_dimensions.R")
dims <- calc_heatmap_dimensions(n_genes = 30, n_samples = 8)
# Returns: height_mm = 165, show_row_labels = TRUE
# Create heatmap with ComplexHeatmap
ht <- create_publication_heatmap(expression_matrix,
column_annotation = sample_info)
save_heatmap(ht, "my_heatmap", dims)
Gather from user before creating the heatmap:
Data:
Dimensions (auto-calculated):
Optional parameters:
n_annotation_tracks: Number of column annotation bars (default: 1)cluster_rows: Cluster genes? (default: TRUE)cluster_cols: Cluster samples? (default: TRUE)scale: Scale by row? (default: "row" for z-score)| n_genes | Show Labels | Cell Height | Formula | Result | |---------|-------------|-------------|---------|--------| | ≤31 | Yes | 4mm | n×4 + 45 | Variable | | 32-62 | No | 2mm | n×2 + 45 | Variable | | >62 | No | 2mm | Capped | 170mm |
n_genes ≤ 31? → Show labels, height = n_genes × 4 + 45
n_genes 32-62? → Hide labels, height = n_genes × 2 + 45
n_genes > 62? → Hide labels, height = 170mm (capped)
source("/data1/greenbab/users/ahunos/apps/llm_configs/claude/skills/heatmap-dimensions/calc_heatmap_dimensions.R")
# From data
dims <- calc_heatmap_dimensions(
n_genes = nrow(expr_matrix),
n_samples = ncol(expr_matrix),
n_annotation_tracks = 1
)
# Scale by row (z-score)
expr_scaled <- t(scale(t(expr_matrix)))
# Create column annotation
col_anno <- HeatmapAnnotation(
Group = sample_metadata$group,
col = list(Group = c("Control" = "#0072B2", "Treatment" = "#D55E00"))
)
library(ComplexHeatmap)
library(viridis)
ht <- Heatmap(
expr_scaled,
name = "Z-score",
col = viridis(100),
# Dimensions
show_row_names = dims$show_row_labels,
show_column_names = dims$show_col_labels,
# Clustering
cluster_rows = TRUE,
cluster_columns = TRUE,
# Fonts (base_size = 20)
row_names_gp = gpar(fontsize = 8),
column_names_gp = gpar(fontsize = 10),
# Annotations
top_annotation = col_anno,
# Dendrograms
row_dend_width = unit(15, "mm"),
column_dend_height = unit(15, "mm")
)
save_heatmap(ht, "expression_heatmap", dims)
# Creates: pdf/expression_heatmap.pdf, png/..., svg/...
| Function | Purpose |
|----------|---------|
| calc_heatmap_dimensions(n_genes, n_samples) | Calculate height and label visibility |
| calc_heatmap_height(n_genes) | Calculate height from gene count |
| create_publication_heatmap(matrix, ...) | Convenience function for complete heatmap |
| save_heatmap(ht, filename, dims) | Save to pdf/png/svg |
| get_colorblind_palette(type) | Get colorblind-safe colors |
viridis(100) # Default, colorblind-safe
inferno(100) # Yellow-red-black
plasma(100) # Yellow-purple
RColorBrewer::brewer.pal(11, "RdBu") # Diverging
# Okabe-Ito palette (colorblind-safe)
c("#E69F00", "#56B4E9", "#009E73", "#F0E442",
"#0072B2", "#D55E00", "#CC79A7", "#999999")
| Problem | Solution |
|---------|----------|
| Labels cut off | Use dims$show_row_labels to auto-hide |
| Height exceeds 170mm | Reduce n_genes or accept capped height |
| Too many genes (>100) | Consider showing top N or clustering summary |
| PDF won't open | Use cairo_pdf device (handled by save_heatmap) |
| Fonts missing | Use default sans-serif, don't specify family |
references/dimension-tables.mdreferences/color-palettes.mdexamples/deseq2_heatmap.Rexamples/correlation_heatmap.Rdevelopment
Decide whether and how to scatter genomics workloads across chromosomes or region tiles, then gather the per-shard outputs back together correctly. Use proactively whenever the user mentions parallelizing per-chromosome, sharding by chrom, tiling the genome, splitting a BAM/VCF/BED by region, merging per-chrom outputs, or has a workflow with obvious per-chromosome parallelism (variant calling, methylation pileup/DMR, coverage, liftover, peak calling, SV calling). Also triggers on /scatter-gather, "scatter X across chromosomes", "shard this", "chunked variant calling", "merge per-chrom VCFs", "gather these bedmethyl files", "concat these bigwigs", or any per-region parallelism question. **Trigger even when the user is also using Snakemake or Nextflow** — those skills handle DAG plumbing while this one defines *what* to scatter, *whether* it's even safe to scatter (some computations like DSS DMLtest pool globally and break under naive sharding), and *how* to gather each output format without silent corruption. Especially trigger on questions about merging per-chromosome BAM / VCF / BED / bedMethyl / bigwig outputs, or whether a scatter-gather is equivalent to running on the whole genome.
tools
Build self-contained, offline HTML genomic-region reports with igv-reports (create_report). Each HTML bundles igv.js viewers per region with embedded BAM/VCF data slices and default tracks (CpG islands, gencode, RepeatMasker); a reviewer clicks the variant table to inspect read-level evidence with no internet, no server, no IGV install. USE this skill whenever the user wants an HTML, clickable, or browseable viewer of genomic data — phrases like "HTML IGV report", "offline IGV", "self-contained HTML", "clickable viewer", "create_report", "igv-reports", "email this viewer", or any browseable HTML of reads at variants, fusion breakpoints, SV junctions, viral integrations, ChIP peaks, or ROIs. Trigger even when the user doesn't say "igv-reports" — giveaway is HTML/clickable/offline plus genomic regions. Also fire on /igv-reports. DO NOT use for static PNG/PDF/SVG IGV screenshots — use the igv-screenshots skill. Supports hg38, mm10, mm39, T2T. Defaults: --flanking 300, --standalone, genome-tagged output.
development
Verify that structural-variant / breakpoint calls are actually real by checking the chimeric reads that support them. Use whenever the user has caller output (Severus, Manta, Sniffles2, Delly, GRIDSS, MELT, Arriba, SvABA) and wants to validate / audit / QC / double-check their calls — viral integrations (HTLV-1, HBV, HPV, EBV), gene fusions (BCR-ABL, IGH translocations), mobile element insertions (L1, Alu, SVA), translocations. Trigger on phrasings like "is this integration real?", "should I trust this fusion call?", "are these false positives?", "are these PASS calls actually supported by reads?", "QC my SV calls", or any per-call chimeric-read / contamination / bimodality / T-vs-N read overlap question. Also fires on BAM @PG -Y / SA-tag questions on chimeric BAMs, and on /chimeric-read-validation. Output is a per-call TSV with pass / needs_review / fail verdicts. Do not use for calling SVs (use the caller), IGV screenshots (use igv-reports), or RNA-level fusion FDR (use Arriba).
tools
Run a stage-gated runtime/resource optimization study for any bioinformatics tool or command-line program on a SLURM HPC cluster. Walks through preflight, OFAT factor scan, 2^k confirmation factorial, build-mode + alternative-implementation comparison, input-size scan, out-of-sample validation, and produces a fitted predictive resource model (wall_s and peak_rss as functions of input size), a machine-readable model.yaml with caveats, a full REPORT.md, and a one-page exec summary PDF. Trigger PROACTIVELY whenever the user asks to "benchmark", "optimize", "tune", "characterize runtime/memory", "find best config", "build a resource model", "how does X scale", or "what should I put in my Snakemake resources directive for tool Y" — for any compute-bound bioinformatics step (sort, dedup, alignment, variant calling, methylation calling, basecalling, indexing, pileup, liftover). Also triggers on /runtime-resource-study or /benchmark-tool. Skip only for one-off quick timing where a single number suffices and no model is needed.