bio-hi-c-analysis-loop-calling
Detect chromatin loops and point interactions from Hi-C data using cooltools, chromosight, and HiCCUPS-like methods. Identify CTCF-mediated loops and enhancer-promoter contacts. Use when detecting chromatin loops from Hi-C data.
Best use case
bio-hi-c-analysis-loop-calling is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Detect chromatin loops and point interactions from Hi-C data using cooltools, chromosight, and HiCCUPS-like methods. Identify CTCF-mediated loops and enhancer-promoter contacts. Use when detecting chromatin loops from Hi-C data.
Teams using bio-hi-c-analysis-loop-calling should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/bio-hi-c-analysis-loop-calling/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How bio-hi-c-analysis-loop-calling Compares
| Feature / Agent | bio-hi-c-analysis-loop-calling | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Detect chromatin loops and point interactions from Hi-C data using cooltools, chromosight, and HiCCUPS-like methods. Identify CTCF-mediated loops and enhancer-promoter contacts. Use when detecting chromatin loops from Hi-C data.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for ChatGPT
Find the best AI skills to adapt into ChatGPT workflows for research, writing, summarization, planning, and repeatable assistant tasks.
AI Agent for Product Research
Browse AI agent skills for product research, competitive analysis, customer discovery, and structured product decision support.
AI Agent for SaaS Idea Validation
Use AI agent skills for SaaS idea validation, market research, customer discovery, competitor analysis, and documenting startup hypotheses.
SKILL.md Source
## Version Compatibility
Reference examples tested with: bedtools 2.31+, cooler 0.9+, cooltools 0.6+, matplotlib 3.8+, numpy 1.26+, pandas 2.2+, pybedtools 0.9+
Before using code patterns, verify installed versions match. If versions differ:
- Python: `pip show <package>` then `help(module.function)` to check signatures
- CLI: `<tool> --version` then `<tool> --help` to confirm flags
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
# Chromatin Loop Calling
**"Call chromatin loops from my Hi-C data"** → Detect point enrichments in contact matrices representing CTCF-mediated loops and enhancer-promoter interactions.
- Python: `cooltools.dots()` or `chromosight detect --pattern=loops`
Detect chromatin loops and point interactions from Hi-C data.
## Required Imports
```python
import cooler
import cooltools
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import bioframe
```
## Call Loops with cooltools (Dot Calling)
```python
clr = cooler.Cooler('matrix.mcool::resolutions/10000')
view_df = bioframe.make_viewframe(clr.chromsizes)
# Compute expected values
expected = cooltools.expected_cis(clr, view_df=view_df, ignore_diags=2)
# Call dots (loops)
dots = cooltools.dots(
clr,
expected=expected,
view_df=view_df,
max_loci_separation=2000000, # Max loop size (2Mb)
max_nans_tolerated=0.5,
)
print(f'Found {len(dots)} loops')
print(dots.head())
```
## Using chromosight (CLI)
```bash
# Call loops with chromosight
chromosight detect \
--pattern loops \
--min-dist 20000 \
--max-dist 2000000 \
matrix.cool \
loops_output
# Output: loops_output.tsv with loop coordinates and scores
```
## Parse chromosight Output
```python
loops = pd.read_csv('loops_output.tsv', sep='\t')
print(f'Found {len(loops)} loops')
print(loops.head())
# Columns: chrom1, start1, end1, chrom2, start2, end2, score, etc.
```
## Using HiCExplorer hicDetectLoops
```bash
# Call loops with HiCExplorer
hicDetectLoops \
-m matrix.cool \
-o loops.bedgraph \
--maxLoopDistance 2000000 \
--windowSize 10 \
--peakWidth 6 \
--pValuePreselection 0.05 \
--pValue 0.05
```
## Loop Statistics
```python
# Calculate loop sizes
loops['size'] = abs(loops['end2'] - loops['start1'])
print('Loop size statistics:')
print(f' Mean: {loops["size"].mean() / 1000:.0f} kb')
print(f' Median: {loops["size"].median() / 1000:.0f} kb')
print(f' Min: {loops["size"].min() / 1000:.0f} kb')
print(f' Max: {loops["size"].max() / 1000:.0f} kb')
# Size distribution
plt.hist(loops['size'] / 1000, bins=50)
plt.xlabel('Loop size (kb)')
plt.ylabel('Count')
plt.savefig('loop_sizes.png', dpi=150)
```
## Filter Loops by Score
```python
# Keep high-confidence loops
score_threshold = loops['score'].quantile(0.75)
high_conf_loops = loops[loops['score'] >= score_threshold]
print(f'High confidence loops: {len(high_conf_loops)}')
```
## Annotate Loops with Features
```python
import pybedtools
# Convert loop anchors to BED
anchor1 = loops[['chrom1', 'start1', 'end1']].copy()
anchor1.columns = ['chrom', 'start', 'end']
anchor2 = loops[['chrom2', 'start2', 'end2']].copy()
anchor2.columns = ['chrom', 'start', 'end']
# Load CTCF peaks
ctcf_peaks = pybedtools.BedTool('ctcf_peaks.bed')
# Intersect anchors with CTCF
anchor1_bed = pybedtools.BedTool.from_dataframe(anchor1)
anchor1_ctcf = anchor1_bed.intersect(ctcf_peaks, wa=True, u=True)
print(f'Anchors with CTCF: {len(anchor1_ctcf)} / {len(anchor1)}')
```
## Compare Loops Between Conditions
```python
# Load loops from two conditions
loops1 = pd.read_csv('condition1_loops.bedpe', sep='\t')
loops2 = pd.read_csv('condition2_loops.bedpe', sep='\t')
# Find overlapping loops
tolerance = 20000 # 20kb
def loops_overlap(l1, l2, tol):
return (l1['chrom1'] == l2['chrom1'] and
l1['chrom2'] == l2['chrom2'] and
abs(l1['start1'] - l2['start1']) <= tol and
abs(l1['start2'] - l2['start2']) <= tol)
shared = []
for _, loop1 in loops1.iterrows():
for _, loop2 in loops2.iterrows():
if loops_overlap(loop1, loop2, tolerance):
shared.append(loop1)
break
print(f'Shared loops: {len(shared)}')
print(f'Condition 1 specific: {len(loops1) - len(shared)}')
print(f'Condition 2 specific: {len(loops2) - len(set(range(len(loops2))) - set([]))}')
```
## Aggregate Peak Analysis (APA)
**Goal:** Assess the overall strength and validity of called loops by stacking contact sub-matrices centered on loop anchors and averaging the signal.
**Approach:** For each loop, extract a fixed-size snippet from the contact matrix centered on the loop anchor pair, then compute the element-wise mean across all snippets to produce an aggregate enrichment map.
```python
# Stack loops and compute average signal
from cooltools.lib import snip
def compute_apa(clr, loops, window=100000, resolution=10000):
'''Compute average peak analysis'''
flank = window // resolution
stacks = []
for _, loop in loops.iterrows():
try:
# Get region around loop
snippet = clr.matrix(balance=True).fetch(
f"{loop['chrom1']}:{loop['start1']-window}-{loop['end1']+window}",
f"{loop['chrom2']}:{loop['start2']-window}-{loop['end2']+window}"
)
if snippet.shape[0] == snippet.shape[1]:
stacks.append(snippet)
except:
continue
if len(stacks) > 0:
apa = np.nanmean(stacks, axis=0)
return apa
return None
apa_matrix = compute_apa(clr, loops.head(100))
if apa_matrix is not None:
plt.imshow(np.log2(apa_matrix), cmap='Reds')
plt.colorbar(label='log2(contact)')
plt.title('Aggregate Peak Analysis')
plt.savefig('apa.png', dpi=150)
```
## Using cooltools pileup for APA
```python
import cooltools
# Compute pileup (APA)
stack = cooltools.pileup(
clr,
features=loops[['chrom1', 'start1', 'end1', 'chrom2', 'start2', 'end2']],
view_df=view_df,
expected=expected,
flank=100000,
)
# Average across all features
apa = np.nanmean(stack, axis=2)
```
## Export Loops
```python
# Save as BEDPE
loops[['chrom1', 'start1', 'end1', 'chrom2', 'start2', 'end2', 'score']].to_csv(
'loops.bedpe', sep='\t', index=False, header=False
)
# Save as Juicer format (for visualization in Juicebox)
loops_juicer = loops.copy()
loops_juicer['color'] = '0,0,255' # Blue
loops_juicer[['chrom1', 'start1', 'end1', 'chrom2', 'start2', 'end2', 'color']].to_csv(
'loops.2dbed', sep='\t', index=False, header=False
)
```
## Loops at Promoter-Enhancer Pairs
```python
# Check if loops connect promoters and enhancers
promoters = pd.read_csv('promoters.bed', sep='\t', names=['chrom', 'start', 'end', 'gene'])
enhancers = pd.read_csv('enhancers.bed', sep='\t', names=['chrom', 'start', 'end'])
# For each loop, check if one anchor is promoter, other is enhancer
pe_loops = []
for _, loop in loops.iterrows():
# Check anchor 1
anchor1_prom = any((promoters['chrom'] == loop['chrom1']) &
(promoters['start'] <= loop['end1']) &
(promoters['end'] >= loop['start1']))
anchor1_enh = any((enhancers['chrom'] == loop['chrom1']) &
(enhancers['start'] <= loop['end1']) &
(enhancers['end'] >= loop['start1']))
# Check anchor 2
anchor2_prom = any((promoters['chrom'] == loop['chrom2']) &
(promoters['start'] <= loop['end2']) &
(promoters['end'] >= loop['start2']))
anchor2_enh = any((enhancers['chrom'] == loop['chrom2']) &
(enhancers['start'] <= loop['end2']) &
(enhancers['end'] >= loop['start2']))
if (anchor1_prom and anchor2_enh) or (anchor1_enh and anchor2_prom):
pe_loops.append(loop)
print(f'Promoter-enhancer loops: {len(pe_loops)}')
```
## Related Skills
- hic-data-io - Load Hi-C matrices
- hic-visualization - Visualize loops
- chip-seq - CTCF ChIP-seq for loop anchor validationRelated Skills
tooluniverse-variant-analysis
Production-ready VCF processing, variant annotation, mutation analysis, and structural variant (SV/CNV) interpretation for bioinformatics questions. Parses VCF files (streaming, large files), classifies mutation types (missense, nonsense, synonymous, frameshift, splice, intronic, intergenic) and structural variants (deletions, duplications, inversions, translocations), applies VAF/depth/quality/consequence filters, annotates with ClinVar/dbSNP/gnomAD/CADD via ToolUniverse, interprets SV/CNV clinical significance using ClinGen dosage sensitivity scores, computes variant statistics, and generates reports. Solves questions like "What fraction of variants with VAF < 0.3 are missense?", "How many non-reference variants remain after filtering intronic/intergenic?", "What is the pathogenicity of this deletion affecting BRCA1?", or "Which dosage-sensitive genes overlap this CNV?". Use when processing VCF files, annotating variants, filtering by VAF/depth/consequence, classifying mutations, interpreting structural variants, assessing CNV pathogenicity, comparing cohorts, or answering variant analysis questions.
tooluniverse-structural-variant-analysis
Comprehensive structural variant (SV) analysis skill for clinical genomics. Classifies SVs (deletions, duplications, inversions, translocations), assesses pathogenicity using ACMG-adapted criteria, evaluates gene disruption and dosage sensitivity, and provides clinical interpretation with evidence grading. Use when analyzing CNVs, large deletions/duplications, chromosomal rearrangements, or any structural variants requiring clinical interpretation.
tooluniverse-spatial-omics-analysis
Computational analysis framework for spatial multi-omics data integration. Given spatially variable genes (SVGs), spatial domain annotations, tissue type, and disease context from spatial transcriptomics/proteomics experiments (10x Visium, MERFISH, DBiTplus, SLIDE-seq, etc.), performs comprehensive biological interpretation including pathway enrichment, cell-cell interaction inference, druggable target identification, immune microenvironment characterization, and multi-modal integration. Produces a detailed markdown report with Spatial Omics Integration Score (0-100), domain-by-domain characterization, and validation recommendations. Uses 70+ ToolUniverse tools across 9 analysis phases. Use when users ask about spatial transcriptomics analysis, spatial omics interpretation, tissue heterogeneity, spatial gene expression patterns, tumor microenvironment mapping, tissue zonation, or cell-cell communication from spatial data.
tooluniverse-proteomics-analysis
Analyze mass spectrometry proteomics data including protein quantification, differential expression, post-translational modifications (PTMs), and protein-protein interactions. Processes MaxQuant, Spectronaut, DIA-NN, and other MS platform outputs. Performs normalization, statistical analysis, pathway enrichment, and integration with transcriptomics. Use when analyzing proteomics data, comparing protein abundance between conditions, identifying PTM changes, studying protein complexes, integrating protein and RNA data, discovering protein biomarkers, or conducting quantitative proteomics experiments.
protein-interaction-network-analysis
Analyze protein-protein interaction networks using STRING, BioGRID, and SASBDB databases. Maps protein identifiers, retrieves interaction networks with confidence scores, performs functional enrichment analysis (GO/KEGG/Reactome), and optionally includes structural data. No API key required for core functionality (STRING). Use when analyzing protein networks, discovering interaction partners, identifying functional modules, or studying protein complexes.
tooluniverse-metabolomics-analysis
Analyze metabolomics data including metabolite identification, quantification, pathway analysis, and metabolic flux. Processes LC-MS, GC-MS, NMR data from targeted and untargeted experiments. Performs normalization, statistical analysis, pathway enrichment, metabolite-enzyme integration, and biomarker discovery. Use when analyzing metabolomics datasets, identifying differential metabolites, studying metabolic pathways, integrating with transcriptomics/proteomics, discovering metabolic biomarkers, performing flux balance analysis, or characterizing metabolic phenotypes in disease, drug response, or physiological conditions.
tooluniverse-immune-repertoire-analysis
Comprehensive immune repertoire analysis for T-cell and B-cell receptor sequencing data. Analyze TCR/BCR repertoires to assess clonality, diversity, V(D)J gene usage, CDR3 characteristics, convergence, and predict epitope specificity. Integrate with single-cell data for clonotype-phenotype associations. Use for adaptive immune response profiling, cancer immunotherapy research, vaccine response assessment, autoimmune disease studies, or repertoire diversity analysis in immunology research.
tooluniverse-image-analysis
Production-ready microscopy image analysis and quantitative imaging data skill for colony morphometry, cell counting, fluorescence quantification, and statistical analysis of imaging-derived measurements. Processes ImageJ/CellProfiler output (area, circularity, intensity, cell counts), performs Dunnett's test, Cohen's d effect size, power analysis, Shapiro-Wilk normality tests, two-way ANOVA, polynomial regression, natural spline regression with confidence intervals, and comparative morphometry. Supports CSV/TSV measurement tables, multi-channel fluorescence data, colony swarming assays, and neuron counting datasets. Use when analyzing microscopy measurement data, colony area/circularity, cell count statistics, swarming assays, co-culture ratio optimization, or answering questions about imaging-derived quantitative data.
tooluniverse-crispr-screen-analysis
Comprehensive CRISPR screen analysis for functional genomics. Analyze pooled or arrayed CRISPR screens (knockout, activation, interference) to identify essential genes, synthetic lethal interactions, and drug targets. Perform sgRNA count processing, gene-level scoring (MAGeCK, BAGEL), quality control, pathway enrichment, and drug target prioritization. Use for CRISPR screen analysis, gene essentiality studies, synthetic lethality detection, functional genomics, drug target validation, or identifying genetic vulnerabilities.
statistical-analysis
Statistical analysis toolkit. Hypothesis tests (t-test, ANOVA, chi-square), regression, correlation, Bayesian stats, power analysis, assumption checks, APA reporting, for academic research.
single-trajectory-analysis
Guide to reproducing OmicVerse trajectory workflows spanning PAGA, Palantir, VIA, velocity coupling, and fate scoring notebooks.
single-cell-downstream-analysis
Checklist-style reference for OmicVerse downstream tutorials covering AUCell scoring, metacell DEG, and related exports.