Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Create clustered heatmaps with row/column annotations using ComplexHeatmap, pheatmap, and seaborn for gene expression and omics data visualization. Use when visualizing expression patterns across samples or identifying co-expressed gene clusters.
.claude/skills/bio-data-visualization-heatmaps-clustering/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-07 | ✗→✓ | ▲ Improved | 260% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 135% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 75% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 330% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 119% | 0% |
<!--
#
#
-->
rlibrary(pheatmap) library(RColorBrewer) # Basic heatmap with clustering pheatmap(mat, scale = 'row', cluster_rows = TRUE, cluster_cols = TRUE) # With annotations annotation_col <- data.frame( Condition = metadata$condition, Batch = metadata$batch, row.names = colnames(mat) ) annotation_row <- data.frame( Pathway = gene_info$pathway, row.names = rownames(mat) ) pheatmap(mat, scale = 'row', annotation_col = annotation_col, annotation_row = annotation_row, color = colorRampPalette(rev(brewer.pal(9, 'RdBu')))(100), show_rownames = FALSE, fontsize = 8)
r# Custom annotation colors ann_colors <- list( Condition = c(Control = '#4DBBD5', Treatment = '#E64B35'), Batch = c(A = '#00A087', B = '#3C5488', C = '#F39B7F'), Pathway = c(Metabolism = '#8491B4', Signaling = '#91D1C2') ) pheatmap(mat, scale = 'row', annotation_col = annotation_col, annotation_colors = ann_colors, clustering_distance_rows = 'correlation', clustering_distance_cols = 'euclidean', clustering_method = 'ward.D2', cutree_rows = 4, cutree_cols = 2, gaps_col = c(5, 10), border_color = NA, main = 'Gene Expression Heatmap')
rlibrary(ComplexHeatmap) library(circlize) # Color function col_fun <- colorRamp2(c(-2, 0, 2), c('blue', 'white', 'red')) # Basic heatmap Heatmap(mat, name = 'Z-score', col = col_fun, cluster_rows = TRUE, cluster_columns = TRUE, show_row_names = FALSE, show_column_names = TRUE)
r# Column annotation ha_col <- HeatmapAnnotation( Condition = metadata$condition, Batch = metadata$batch, Age = anno_barplot(metadata$age), col = list( Condition = c(Control = '#4DBBD5', Treatment = '#E64B35'), Batch = c(A = '#00A087', B = '#3C5488') ) ) # Row annotation ha_row <- rowAnnotation( Pathway = gene_info$pathway, LogFC = anno_barplot(gene_info$log2FC, baseline = 0, gp = gpar(fill = ifelse(gene_info$log2FC > 0, 'red', 'blue'))), col = list(Pathway = c(Metabolism = '#8491B4', Signaling = '#91D1C2')) ) Heatmap(mat, name = 'Z-score', col = col_fun, top_annotation = ha_col, left_annotation = ha_row, row_split = gene_info$pathway, column_split = metadata$condition)
r# Combine heatmaps horizontally ht1 <- Heatmap(mat1, name = 'Expression', col = col_fun) ht2 <- Heatmap(mat2, name = 'Methylation', col = colorRamp2(c(0, 0.5, 1), c('blue', 'white', 'red'))) ht_list <- ht1 + ht2 draw(ht_list, row_title = 'Genes', column_title = 'Samples')
pythonimport seaborn as sns import matplotlib.pyplot as plt import pandas as pd # Basic clustermap g = sns.clustermap(df, cmap='RdBu_r', center=0, figsize=(10, 12), row_cluster=True, col_cluster=True, standard_scale=0) # 0 = rows, 1 = columns plt.savefig('heatmap.png', dpi=150, bbox_inches='tight')
python# Create color mappings condition_colors = {'Control': '#4DBBD5', 'Treatment': '#E64B35'} batch_colors = {'A': '#00A087', 'B': '#3C5488', 'C': '#F39B7F'} col_colors = pd.DataFrame({ 'Condition': metadata['condition'].map(condition_colors), 'Batch': metadata['batch'].map(batch_colors) }) row_colors = gene_info['pathway'].map({'Metabolism': '#8491B4', 'Signaling': '#91D1C2'}) g = sns.clustermap(df, cmap='RdBu_r', center=0, row_colors=row_colors, col_colors=col_colors, figsize=(12, 14), dendrogram_ratio=0.15, cbar_pos=(0.02, 0.8, 0.03, 0.15)) g.ax_heatmap.set_xlabel('Samples') g.ax_heatmap.set_ylabel('Genes')
r# Distance metrics # 'euclidean', 'correlation', 'manhattan', 'maximum', 'canberra', 'binary' # Linkage methods # 'complete', 'single', 'average', 'ward.D', 'ward.D2', 'mcquitty', 'median', 'centroid' pheatmap(mat, clustering_distance_rows = 'correlation', clustering_distance_cols = 'euclidean', clustering_method = 'ward.D2')
r# pheatmap p <- pheatmap(mat, scale = 'row', cutree_rows = 4, silent = TRUE) row_clusters <- cutree(p$tree_row, k = 4) # ComplexHeatmap ht <- Heatmap(mat, row_split = 4) ht <- draw(ht) row_order <- row_order(ht)
python# seaborn g = sns.clustermap(df, cmap='RdBu_r') row_linkage = g.dendrogram_row.linkage from scipy.cluster.hierarchy import fcluster clusters = fcluster(row_linkage, t=4, criterion='maxclust')
r# pheatmap to file pheatmap(mat, filename = 'heatmap.pdf', width = 8, height = 10) # ComplexHeatmap to file pdf('heatmap.pdf', width = 8, height = 10) draw(ht) dev.off()
<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-04 | pass→pass | 7,588 | 3,982 | -48% | 1 | 1 | 0% | 1,511 | 2,650 | +75% | 0 | 0 | — |
case-05 | pass→pass | 4,813 | 3,990 | -17% | 1 | 1 | 0% | 595 | 2,557 | +330% | 0 | 0 | — |
case-06 | pass→pass | 7,424 | 7,375 | -1% | 1 | 1 | 0% | 1,485 | 3,248 | +119% | 0 | 0 | — |
case-07 | fail→pass | 3,885 | 3,308 | -15% | 1 | 1 | 0% | 682 | 2,456 | +260% | 0 | 0 | — |
case-08 | pass→pass | 7,347 | 2,896 | -61% | 1 | 1 | 0% | 1,553 | 2,450 | +58% | 0 | 0 | — |
case-09 | pass→pass | 3,506 | 1,949 | -44% | 1 | 1 | 0% | 640 | 2,214 | +246% | 0 | 0 | — |
case-10 | pass→pass | 3,136 | 2,515 | -20% | 1 | 1 | 0% | 568 | 2,347 | +313% | 0 | 0 | — |
case-11 | pass→pass | 8,727 | 6,488 | -26% | 1 | 1 | 0% | 1,784 | 3,107 | +74% | 0 | 0 | — |
case-12 | pass→pass | 7,672 | 4,598 | -40% | 1 | 1 | 0% | 1,559 | 2,711 | +74% | 0 | 0 | — |
case-13 | fail→fail | 2,728 | 2,937 | +8% | 1 | 1 | 0% | 461 | 2,463 | +434% | 0 | 0 | — |
case-14 | pass→pass | 5,687 | 3,340 | -41% | 1 | 1 | 0% | 1,027 | 2,487 | +142% | 0 | 0 | — |
case-15 | pass→pass | 8,597 | 6,144 | -29% | 1 | 1 | 0% | 1,573 | 2,905 | +85% | 0 | 0 | — |
case-16 | fail→pass | 5,661 | 6,022 | +6% | 1 | 1 | 0% | 1,067 | 2,509 | +135% | 0 | 0 | — |
case-17 | pass→pass | 11,962 | 6,574 | -45% | 1 | 1 | 0% | 2,615 | 3,213 | +23% | 0 | 0 | — |
case-18 | pass→pass | 8,220 | 7,357 | -10% | 1 | 1 | 0% | 1,828 | 3,385 | +85% | 0 | 0 | — |
case-19 | pass→pass | 4,928 | 2,683 | -46% | 1 | 1 | 0% | 936 | 2,437 | +160% | 0 | 0 | — |
case-20 | pass→pass | 10,950 | 10,090 | -8% | 1 | 1 | 0% | 2,395 | 4,110 | +72% | 0 | 0 | — |
case-21 | pass→pass | 9,388 | 9,122 | -3% | 1 | 1 | 0% | 1,923 | 3,781 | +97% | 0 | 0 | — |
case-22 | pass→pass | 14,107 | 9,455 | -33% | 1 | 1 | 0% | 2,720 | 3,834 | +41% | 0 | 0 | — |
case-01 | pass→pass | 6,225 | 4,294 | -31% | 1 | 1 | 0% | 1,121 | 2,629 | +135% | 0 | 0 | — |
case-02 | fail→fail | 8,564 | 7,422 | -13% | 1 | 1 | 0% | 1,711 | 3,280 | +92% | 0 | 0 | — |
case-03 | pass→pass | 9,602 | 4,748 | -51% | 1 | 1 | 0% | 1,705 | 2,775 | +63% | 0 | 0 | — |
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. 22 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 7/26/2026 | +5% |
Other measured skills in the registry, with their headline benchmark lift.