Install any skill in seconds. Free to start, no credit card required.
Get Started Free →End-to-end Hi-C analysis workflow from contact pairs to compartments, TADs, and loops. Covers cooler matrices, cooltools analysis, and visualization. Use when processing Hi-C data to compartments and TADs.
.claude/skills/bio-workflows-hic-pipeline/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 42% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 59% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 68% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 65% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 84% | 0% |
<!--
#
#
-->
Complete workflow for Hi-C chromosome conformation capture analysis.
Hi-C FASTQ files
|
v
[1. Alignment & Pairs] --> bwa-mem2 + pairtools
|
v
[2. Matrix Generation] --> cooler
|
v
[3. Normalization] -----> ICE balancing
|
v
[4. Compartments] ------> Eigenvector analysis
|
v
[5. TADs] --------------> Insulation score
|
v
[6. Loops] -------------> Dot calling
|
v
Hi-C featuresbash# Align Hi-C reads (each end separately, then combine) bwa-mem2 mem -SP5M -t 16 reference.fa reads_R1.fastq.gz | \ pairtools parse --min-mapq 40 --walks-policy 5unique \ --max-inter-align-gap 30 --nproc-in 8 --nproc-out 8 \ --chroms-path reference.genome | \ pairtools sort --nproc 16 --tmpdir ./tmp | \ pairtools dedup --nproc-in 8 --nproc-out 8 \ --mark-dups --output-stats stats.txt | \ pairtools split --nproc-in 8 --output-pairs sample.pairs.gz # Alternative: align both ends bwa-mem2 mem -SP5M -t 16 reference.fa \ reads_R1.fastq.gz reads_R2.fastq.gz | \ pairtools parse --min-mapq 40 --walks-policy 5unique \ --max-inter-align-gap 30 --chroms-path reference.genome | \ pairtools sort | \ pairtools dedup --mark-dups --output-stats stats.txt | \ pairtools split --output-pairs sample.pairs.gz
QC Checkpoint: Check pair statistics
bash# Create cooler file at multiple resolutions cooler cload pairs \ -c1 2 -p1 3 -c2 4 -p2 5 \ reference.genome:1000 \ sample.pairs.gz \ sample.1000.cool # Multi-resolution (mcool) cooler zoomify sample.1000.cool \ -r 1000,2000,5000,10000,25000,50000,100000,250000,500000,1000000 \ -o sample.mcool
pythonimport cooler import cooltools # Load matrix clr = cooler.Cooler('sample.mcool::resolutions/10000') # Balance (ICE normalization) cooltools.balance_cooler(clr, store=True, mad_max=5) # Or via command line # cooler balance sample.mcool::resolutions/10000
pythonimport cooler import cooltools import numpy as np # Load balanced matrix clr = cooler.Cooler('sample.mcool::resolutions/100000') # Calculate expected (for O/E) expected = cooltools.expected_cis(clr, view_df=None, nproc=4) # Compute eigenvector (compartments) eig = cooltools.eigs_cis( clr, phasing_track='gc_content.bw', # Optional: orient by GC n_eigs=3, nproc=4 ) # A/B compartments eig_values, eig_vectors = eig compartments = eig_vectors[['E1']].copy() compartments['compartment'] = np.where(compartments['E1'] > 0, 'A', 'B') compartments.to_csv('compartments.tsv', sep='\t')
pythonimport cooltools # Load matrix at TAD resolution clr = cooler.Cooler('sample.mcool::resolutions/10000') # Calculate insulation score insulation = cooltools.insulation(clr, window_bp=[100000, 200000, 500000]) # Call boundaries boundaries = cooltools.find_boundaries(insulation) boundaries.to_csv('tad_boundaries.tsv', sep='\t') # Alternative: use HiCExplorer # hicFindTADs -m sample.h5 --outPrefix tads --correctForMultipleTesting fdr
pythonimport cooltools # Load high-resolution matrix clr = cooler.Cooler('sample.mcool::resolutions/10000') # Call loops using expected expected = cooltools.expected_cis(clr) loops = cooltools.dots( clr, expected, max_loci_separation=2000000, nproc=4 ) loops.to_csv('loops.tsv', sep='\t') # Alternative: use chromosight # chromosight detect --pattern loops sample.mcool::resolutions/10000 loops
pythonimport matplotlib.pyplot as plt import cooltools.lib.plotting # Plot contact matrix region fig, ax = plt.subplots(figsize=(10, 10)) cooltools.lib.plotting.pcolormesh_45deg( ax, clr.matrix(balance=True).fetch('chr1:50000000-60000000'), start=50000000, resolution=clr.binsize ) ax.set_aspect('equal') plt.savefig('hic_matrix.pdf') # Plot with TADs from matplotlib.patches import Polygon # Add TAD boundaries as triangles
bash#!/bin/bash set -e THREADS=16 REF="reference.fa" GENOME="reference.genome" R1="sample_R1.fastq.gz" R2="sample_R2.fastq.gz" OUTDIR="hic_results" mkdir -p ${OUTDIR}/{pairs,cool,analysis} # Step 1: Alignment and pairs echo "=== Alignment ===" bwa-mem2 mem -SP5M -t ${THREADS} ${REF} ${R1} ${R2} | \ pairtools parse --min-mapq 40 --walks-policy 5unique \ --chroms-path ${GENOME} | \ pairtools sort --nproc ${THREADS} --tmpdir ./tmp | \ pairtools dedup --mark-dups --output-stats ${OUTDIR}/pairs/stats.txt | \ pairtools split --output-pairs ${OUTDIR}/pairs/sample.pairs.gz # Step 2: Generate matrix echo "=== Matrix Generation ===" cooler cload pairs -c1 2 -p1 3 -c2 4 -p2 5 \ ${GENOME}:1000 ${OUTDIR}/pairs/sample.pairs.gz ${OUTDIR}/cool/sample.1000.cool cooler zoomify ${OUTDIR}/cool/sample.1000.cool \ -r 1000,5000,10000,25000,50000,100000,500000 \ -o ${OUTDIR}/cool/sample.mcool # Step 3: Balance echo "=== Balancing ===" for res in 10000 25000 100000; do cooler balance ${OUTDIR}/cool/sample.mcool::resolutions/${res} done echo "=== Pipeline Complete ===" echo "Run Python script for compartments, TADs, and loops"
pythonimport cooler import cooltools import pandas as pd import os outdir = 'hic_results/analysis' os.makedirs(outdir, exist_ok=True) # Compartments (100kb) print('Compartments...') clr = cooler.Cooler('hic_results/cool/sample.mcool::resolutions/100000') eig_values, eig_vectors = cooltools.eigs_cis(clr, n_eigs=3) eig_vectors.to_csv(f'{outdir}/compartments.tsv', sep='\t') # TADs (10kb) print('TADs...') clr = cooler.Cooler('hic_results/cool/sample.mcool::resolutions/10000') insulation = cooltools.insulation(clr, window_bp=[100000, 200000]) insulation.to_csv(f'{outdir}/insulation.tsv', sep='\t') # Loops (10kb) print('Loops...') expected = cooltools.expected_cis(clr) loops = cooltools.dots(clr, expected, nproc=4) loops.to_csv(f'{outdir}/loops.tsv', sep='\t') print(f'Results saved to {outdir}/')
<!-- 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-01 | fail→pass | 33,602 | 13,271 | -61% | 1 | 1 | 0% | 3,749 | 5,342 | +42% | 0 | 0 | — |
case-02 | fail→pass | 12,759 | 7,415 | -42% | 1 | 1 | 0% | 2,494 | 3,961 | +59% | 0 | 0 | — |
case-03 | fail→fail | 18,516 | 14,403 | -22% | 1 | 1 | 0% | 3,203 | 5,323 | +66% | 0 | 0 | — |
case-04 | fail→fail | 18,297 | 16,900 | -8% | 1 | 1 | 0% | 3,222 | 5,854 | +82% | 0 | 0 | — |
case-05 | fail→fail | 16,385 | 17,610 | +7% | 1 | 1 | 0% | 3,043 | 5,153 | +69% | 0 | 0 | — |
case-06 | fail→pass | 12,807 | 7,727 | -40% | 1 | 1 | 0% | 2,300 | 3,860 | +68% | 0 | 0 | — |
case-16 | fail→pass | 13,634 | 7,727 | -43% | 1 | 1 | 0% | 2,404 | 3,968 | +65% | 0 | 0 | — |
case-07 | pass→pass | 6,643 | 4,350 | -35% | 1 | 1 | 0% | 1,416 | 3,374 | +138% | 0 | 0 | — |
case-08 | pass→pass | 9,722 | 5,379 | -45% | 1 | 1 | 0% | 1,891 | 3,458 | +83% | 0 | 0 | — |
case-09 | fail→pass | 9,124 | 3,730 | -59% | 1 | 1 | 0% | 1,698 | 3,127 | +84% | 0 | 0 | — |
case-10 | fail→pass | 17,341 | 3,241 | -81% | 1 | 1 | 0% | 1,203 | 3,171 | +164% | 0 | 0 | — |
case-11 | pass→pass | 14,109 | 10,545 | -25% | 1 | 1 | 0% | 2,563 | 4,453 | +74% | 0 | 0 | — |
case-12 | pass→pass | 16,745 | 10,744 | -36% | 1 | 1 | 0% | 3,153 | 4,476 | +42% | 0 | 0 | — |
case-13 | fail→fail | 12,281 | 10,551 | -14% | 1 | 1 | 0% | 2,346 | 4,507 | +92% | 0 | 0 | — |
case-14 | pass→pass | 13,090 | 7,204 | -45% | 1 | 1 | 0% | 2,430 | 3,931 | +62% | 0 | 0 | — |
case-15 | fail→fail | 10,012 | 2,271 | -77% | 1 | 1 | 0% | 1,867 | 2,921 | +56% | 0 | 0 | — |
case-17 | fail→pass | 16,363 | 3,818 | -77% | 1 | 1 | 0% | 3,061 | 3,174 | +4% | 0 | 0 | — |
case-18 | fail→pass | 11,583 | 5,921 | -49% | 1 | 1 | 0% | 1,945 | 3,498 | +80% | 0 | 0 | — |
case-19 | fail→pass | 10,546 | 5,329 | -49% | 1 | 1 | 0% | 1,910 | 3,377 | +77% | 0 | 0 | — |
case-20 | pass→pass | 7,863 | 4,910 | -38% | 1 | 1 | 0% | 1,366 | 3,348 | +145% | 0 | 0 | — |
case-21 | fail→pass | 16,691 | 9,771 | -41% | 1 | 1 | 0% | 3,606 | 4,297 | +19% | 0 | 0 | — |
case-22 | pass→pass | 6,773 | 1,988 | -71% | 1 | 1 | 0% | 1,190 | 2,829 | +138% | 0 | 0 | — |
case-23 | pass→pass | 5,886 | 4,497 | -24% | 1 | 1 | 0% | 1,162 | 2,777 | +139% | 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. 23 cases were attempted, and 22 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +43 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
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/24/2026 | +36% |
Other measured skills in the registry, with their headline benchmark lift.