Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Call topologically associating domains (TADs) from Hi-C data using insulation score, HiCExplorer, and other methods. Identify domain boundaries and hierarchical domain structure. Use when calling TADs from Hi-C insulation scores.
.claude/skills/bio-hi-c-analysis-tad-detection/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | — | — |
| case-06 | ✗→✓ | ▲ Improved | — | — |
| case-16 | ✗→✓ | ▲ Improved | — | — |
| case-05 | ✗→✓ | ▲ Improved | — | — |
| case-15 | ✗→✓ | ▲ Improved | — | — |
Reference examples tested with: cooler 0.9+, cooltools 0.6+, matplotlib 3.8+, numpy 1.26+, pandas 2.2+
Before using code patterns, verify installed versions match. If versions differ:
pip show <package> then help(module.function) to check signatures<tool> --version then <tool> --help to confirm flagsIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"Call TADs from my Hi-C data" → Identify topologically associating domain boundaries using insulation score minima or other boundary-detection algorithms.
cooltools.insulation(clr, window_bp) then threshold boundary strengthhicFindTADs (HiCExplorer)Call topologically associating domains from Hi-C contact matrices.
pythonimport cooler import cooltools import numpy as np import pandas as pd import matplotlib.pyplot as plt import bioframe
pythonclr = cooler.Cooler('matrix.mcool::resolutions/10000') view_df = bioframe.make_viewframe(clr.chromsizes) # Compute insulation score insulation = cooltools.insulation( clr, window_bp=[100000, 200000, 500000], # Multiple window sizes ignore_diags=2, ) print(insulation.head()) # Columns include: chrom, start, end, log2_insulation_score_100000, etc.
python# Find boundaries (local minima in insulation score) boundaries = cooltools.find_insulation( clr, window_bp=200000, # Single window ignore_diags=2, min_dist_bad_bin=0, ) # Filter significant boundaries boundaries['is_boundary'] = boundaries['boundary_strength'] > 0.1 strong_boundaries = boundaries[boundaries['is_boundary']] print(f'Found {len(strong_boundaries)} TAD boundaries')
Goal: Convert a set of TAD boundary positions into TAD interval coordinates (start-end pairs) for downstream overlap analysis.
Approach: Sort boundaries by position per chromosome, then define each TAD as the interval between consecutive boundary positions.
pythondef boundaries_to_tads(boundaries_df, chrom): '''Convert boundary positions to TAD intervals''' chr_bounds = boundaries_df[ (boundaries_df['chrom'] == chrom) & (boundaries_df['is_boundary']) ].sort_values('start') tads = [] starts = [0] + list(chr_bounds['start']) ends = list(chr_bounds['start']) + [boundaries_df[boundaries_df['chrom'] == chrom]['end'].max()] for start, end in zip(starts, ends): if end > start: tads.append({'chrom': chrom, 'start': start, 'end': end}) return pd.DataFrame(tads) tads_chr1 = boundaries_to_tads(boundaries, 'chr1') print(f'chr1 TADs: {len(tads_chr1)}') print(tads_chr1.head())
bash# Compute TADs with HiCExplorer hicFindTADs \ -m matrix.cool \ --outPrefix tads \ --correctForMultipleTesting fdr \ --minDepth 60000 \ --maxDepth 200000 \ --step 10000 \ --thresholdComparisons 0.05 # Output files: # tads_domains.bed - TAD intervals # tads_boundaries.bed - Boundary positions # tads_score.bedgraph - Insulation score track
python# After running hicFindTADs tads = pd.read_csv('tads_domains.bed', sep='\t', header=None, names=['chrom', 'start', 'end']) boundaries = pd.read_csv('tads_boundaries.bed', sep='\t', header=None, names=['chrom', 'start', 'end', 'score']) print(f'TADs: {len(tads)}') print(f'Boundaries: {len(boundaries)}')
python# Calculate TAD sizes tads['size'] = tads['end'] - tads['start'] print('TAD size statistics:') print(f' Mean: {tads["size"].mean() / 1000:.0f} kb') print(f' Median: {tads["size"].median() / 1000:.0f} kb') print(f' Min: {tads["size"].min() / 1000:.0f} kb') print(f' Max: {tads["size"].max() / 1000:.0f} kb') # Size distribution plt.hist(tads['size'] / 1000, bins=50) plt.xlabel('TAD size (kb)') plt.ylabel('Count') plt.title('TAD size distribution') plt.savefig('tad_sizes.png', dpi=150)
pythonfig, ax = plt.subplots(figsize=(15, 3)) chr_data = insulation[insulation['chrom'] == 'chr1'] ax.plot(chr_data['start'] / 1e6, chr_data['log2_insulation_score_200000']) # Mark boundaries bounds = chr_data[chr_data['is_boundary']] ax.scatter(bounds['start'] / 1e6, bounds['log2_insulation_score_200000'], color='red', s=20, zorder=5) ax.set_xlabel('Position (Mb)') ax.set_ylabel('Insulation score (log2)') ax.set_title('chr1 insulation score (red = boundaries)') plt.tight_layout() plt.savefig('insulation_track.png', dpi=150)
python# Load boundaries from two conditions bounds1 = pd.read_csv('condition1_boundaries.bed', sep='\t', names=['chrom', 'start', 'end']) bounds2 = pd.read_csv('condition2_boundaries.bed', sep='\t', names=['chrom', 'start', 'end']) # Find overlapping boundaries (within tolerance) tolerance = 50000 # 50kb def find_overlaps(df1, df2, tol): overlaps = [] for _, b1 in df1.iterrows(): matches = df2[ (df2['chrom'] == b1['chrom']) & (abs(df2['start'] - b1['start']) <= tol) ] if len(matches) > 0: overlaps.append(b1) return pd.DataFrame(overlaps) shared = find_overlaps(bounds1, bounds2, tolerance) print(f'Shared boundaries: {len(shared)}') print(f'Condition 1 specific: {len(bounds1) - len(shared)}') print(f'Condition 2 specific: {len(bounds2) - len(shared)}')
python# Compute insulation at multiple scales windows = [100000, 200000, 500000, 1000000] insulation_multi = cooltools.insulation(clr, window_bp=windows, ignore_diags=2) # Boundaries at each scale represent different hierarchy levels for w in windows: col = f'is_boundary_{w}' n_bounds = insulation_multi[col].sum() print(f'Window {w/1000:.0f}kb: {n_bounds} boundaries')
python# Save as BED tads[['chrom', 'start', 'end']].to_csv( 'tads.bed', sep='\t', index=False, header=False ) # Save boundaries as BED boundaries[boundaries['is_boundary']][['chrom', 'start', 'end', 'boundary_strength']].to_csv( 'boundaries.bed', sep='\t', index=False, header=False ) # Save insulation as bedGraph insulation[['chrom', 'start', 'end', 'log2_insulation_score_200000']].to_csv( 'insulation.bedgraph', sep='\t', index=False, header=False )
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
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 +23 percentage points is the difference between those two pass rates over the 22 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.