Hi-C Loop Calling
Overview
This skill provides a minimal and efficient workflow for detecting chromatin loops from Hi-C data stored in .mcool format and preparing results for visualization in IGV. The key steps involved include:
- Refer to the Inputs & Outputs section to verify required files and output structure.
- Always prompt user for genome assembly used.
- Always prompt user for resolution used to call loops. ~2-50 kb is recommended. 5 kb is default.
- Locate the genome FASTA file from homer genome fasta file based on user input.
- Rename chromosomes in the .mcool or .cool file to satisfy the chromosome format with "chr".
- Generate chromosome-arm view files for compartment calling after changing the chromosome name.
- Extract contact matrices from .mcool files at the desired resolution.
- Detect chromatin loops.
When to Use This Skill
Use this skill when:
- You need to identify (in other words, call, or detect) chromatin loops from Hi-C data in .mcool format.
Inputs & Outputs
Inputs
- File format: .mcool, .cool, or .hic (Hi-C data file).
- Genome assembly: Prompt the user for genome assembly used.
- Resolution: Choose the desired resolution for loop calling (e.g., 5 kb, 10 kb, etc.).
Outputs
${sample}_loop_calling/
loops/
${sample}_loops_${resolution}.bedpe # Detected chromatin loops in BEDPE format.
temp/
view_${genome}.tsv
expected_cis.${resolution}.tsv
Allowed Tools
When using this skill, you should restrict yourself to the following MCP tools from server cooler-tools, cooltools-tools, project-init-tools, genome-locate-tools:
mcp__project-init-tools__project_init
mcp__genome-locate-tools__genome_locate_fasta
mcp__HiCExplorer-tools__hic_to_mcool
mcp__cooler-tools__list_mcool_resolutions
mcp__cooler-tools__harmonize_chrom_names
mcp__cooler-tools__make_view_chromarms
mcp__cooltools-tools__run_expected_cis
mcp__cooltools-tools__run_dots
Do NOT fall back to:
- raw shell commands (
cooltools expected-cis, cooltools dots, etc.)
- ad-hoc Python snippets (e.g. importing
cooler, bioframe, matplotlib manually in the reply).
Decision Tree
Step 0 — Gather Required Information from the User
Before calling any tool, ask the user:
Sample name (sample): used as prefix and for the output directory ${sample}_loop_calling.
Genome assembly (genome): e.g. hg38, mm10, danRer11.
- Never guess or auto-detect.
Hi-C matrix path/URI (mcool_uri):
path/to/sample.mcool::/resolutions/5000 (.mcool file with resolution specified)
- or
.cool file path
- or
.hic file path
Resolution (resolution): default 5000 (5 kb).
- If user does not specify, use
5000 as default.
- Must be the same as the resolution used for
${mcool_uri}
Step 1 — Initialize Project & Locate Genome FASTA
- Make director for this project:
Call:
mcp__project-init-tools__project_init
with:
sample: the user-provided sample name
task: loop_calling
The tool will:
- Create
${sample}_loop_calling directory.
- Return the full path of the
${sample}_loop_calling directory, which will be used as ${proj_dir}.
- If the user provides a
.hic file, convert it to .mcool file using mcp__HiCExplorer-tools__hic_to_mcool tool:
Call:
mcp__HiCExplorer-tools__hic_to_mcool
with:
input_hic: the user-provided path (e.g. input.hic)
sample: the user-provided sample name
proj_dir: directory to save the view file. In this skill, it is the full path of the ${sample}_loop_calling directory returned by mcp__project-init-tools__project_init.
The tool will:
- Convert the
.hic file to .mcool file.
- Return the path of the
.mcool file.
If the conversion is successful, update ${mcool_uri} to the path of the .mcool file.
- Locate genome fasta file:
Call:
mcp__genome-locate-tools__genome_locate_fasta
with:
genome: the user-provided genome assembly
The tool will:
- Locate genome FASTA.
- Verify the FASTA exists.
Step 2: List Available Resolutions in the .mcool file & Modify the Chromosome Names if Necessary
- Check the resolutions in
mcool_uri:
Call:
mcp__cooler-tools__list_mcool_resolutions
with:
mcool_path: the user-provided path (e.g. input.mcool) without resolution specified.
The tool will:
- List all resolutions in the .mcool file.
- Return the resolutions as a list.
If the user defined or default ${resolution} is not found in the list, ask the user to specify the resolution again.
Else, use ${resolution} for the following steps.
- Check if the chromosome names in the .mcool file are started with "chr", and if not, modify them to start with "chr":
Call:
mcp__cooler-tools__harmonize_chrom_names
with:
sample: the user-provided sample name
proj_dir: directory to save the expected-cis and eigs-cis files. In this skill, it is the full path of the ${sample}_Compartments_calling directory returned by mcp__project-init-tools__project_init
mcool_uri: cooler URI with resolution specified, e.g. input.mcool::/resolutions/${resolution}
resolution: ${resolution} must be the same as the resolution used for ${mcool_uri} and must be an integer
The tool will:
- Check if the chromosome names in the .mcool file.
- If not, harmonize the chromosome names in the .mcool file.
- If the chromosome names are modified, return the path of the modified .mcool file under
${proj_dir}/ directory
Step 3 — Create Chromosome-Arm View File
Use bioframe to define chromosome arms based on centromeres:
Call:
mcp__cooler-tools__make_view_chromarms
with:
genome: genome assembly
mcool_uri: cooler URI with resolution specified, e.g. input.mcool::/resolutions/${resolution}
resolution: ${resolution} must be the same as the resolution used for ${mcool_uri} and must be an integer
proj_dir: directory to save the view file. In this skill, it is the full path of the ${sample}_loop_calling directory returned by mcp__project-init-tools__project_init.
The tool will:
- Fetch chromsizes and centromeres via
bioframe.
- Generate chromosomal arms and filter them to those present in the cooler.
- Return the path of the view file under
${proj_dir}/temp/ directory.
Step 4: Detect Chromatin Loops
- Calculate expected cis:
Call:
mcp__cooltools-tools__run_expected_cis
with:
sample: the user-provided sample name
proj_dir: directory to save the view file. In this skill, it is the full path of the ${sample}_loop_calling directory returned by mcp__project-init-tools__project_init.
mcool_uri: cooler URI with resolution specified, e.g. input.mcool::/resolutions/${resolution}
resolution: ${resolution} must be the same as the resolution used for ${mcool_uri} and must be an integer
view_path: the path to the view file (e.g. ${proj_dir}/temp/view_${genome}.tsv)
clr_weight_name: the name of the weight column (default: weight)
ignore_diags: the number of diagonals to ignore based on resolution
The tool will:
- Generate expected cis file.
- Return the path of the expected cis file under
${proj_dir}/temp/ directory.
- Call loops:
Call:
mcp__cooltools-tools__run_dots
with:
sample: the user-provided sample name
proj_dir: directory to save the view file. In this skill, it is the full path of the ${sample}_loop_calling directory returned by mcp__project-init-tools__project_init.
mcool_uri: cooler URI with resolution specified, e.g. input.mcool::/resolutions/${resolution}
resolution: ${resolution} must be the same as the resolution used for ${mcool_uri} and must be an integer
view_path: the path to the view file (e.g. ${proj_dir}/temp/view_${genome}.tsv)
nproc: the number of processes for cooltools (default 6)
The tool will:
- Generate loops bedpe.
- Return the path of the loops bedpe file under
${proj_dir}/loops/ directory.
1---2name: hic-loop-calling3description: This skill performs chromatin loop detection from Hi-C .mcool files using cooltools.4---56# Hi-C Loop Calling78## Overview910This skill provides a minimal and efficient workflow for detecting chromatin loops from Hi-C data stored in .mcool format and preparing results for visualization in IGV. The key steps involved include:11- Refer to the **Inputs & Outputs** section to verify required files and output structure.12- **Always prompt user** for genome assembly used.13- **Always prompt user** for resolution used to call loops. ~2-50 kb is recommended. 5 kb is default.14- **Locate the genome FASTA file** from homer genome fasta file based on user input.15- **Rename chromosomes** in the .mcool or .cool file to satisfy the chromosome format with "chr".16- **Generate chromosome-arm view files** for compartment calling after changing the chromosome name.17- **Extract contact matrices** from .mcool files at the desired resolution.18- **Detect chromatin loops**.1920---2122## When to Use This Skill2324Use this skill when:2526- You need to identify (in other words, call, or detect) chromatin loops from Hi-C data in .mcool format.2728---2930## Inputs & Outputs3132### Inputs3334- **File format:** .mcool, .cool, or .hic (Hi-C data file).35- **Genome assembly:** Prompt the user for genome assembly used.36- **Resolution:** Choose the desired resolution for loop calling (e.g., 5 kb, 10 kb, etc.).3738### Outputs3940```bash41${sample}_loop_calling/42 loops/43 ${sample}_loops_${resolution}.bedpe # Detected chromatin loops in BEDPE format.44 temp/45 view_${genome}.tsv46 expected_cis.${resolution}.tsv 47```48---4950## Allowed Tools5152When using this skill, you should restrict yourself to the following MCP tools from server `cooler-tools`, `cooltools-tools`, `project-init-tools`, `genome-locate-tools`:53- `mcp__project-init-tools__project_init`54- `mcp__genome-locate-tools__genome_locate_fasta`55- `mcp__HiCExplorer-tools__hic_to_mcool`56- `mcp__cooler-tools__list_mcool_resolutions`57- `mcp__cooler-tools__harmonize_chrom_names`58- `mcp__cooler-tools__make_view_chromarms`59- `mcp__cooltools-tools__run_expected_cis`60- `mcp__cooltools-tools__run_dots`6162Do NOT fall back to:6364- raw shell commands (`cooltools expected-cis`, `cooltools dots`, etc.)65- ad-hoc Python snippets (e.g. importing `cooler`, `bioframe`, `matplotlib` manually in the reply).6667---686970## Decision Tree7172### Step 0 — Gather Required Information from the User7374Before calling any tool, ask the user:75761. Sample name (`sample`): used as prefix and for the output directory `${sample}_loop_calling`.77782. Genome assembly (`genome`): e.g. `hg38`, `mm10`, `danRer11`. 79 - **Never** guess or auto-detect.80813. Hi-C matrix path/URI (`mcool_uri`):82 - `path/to/sample.mcool::/resolutions/5000` (.mcool file with resolution specified)83 - or `.cool` file path84 - or `.hic` file path85864. Resolution (`resolution`): default `5000` (5 kb). 87 - If user does not specify, use `5000` as default.88 - Must be the same as the resolution used for `${mcool_uri}`8990---919293### Step 1 — Initialize Project & Locate Genome FASTA94951. Make director for this project:9697Call:9899- `mcp__project-init-tools__project_init`100101with:102103- `sample`: the user-provided sample name104- `task`: loop_calling105106The tool will:107108- Create `${sample}_loop_calling` directory.109- Return the full path of the `${sample}_loop_calling` directory, which will be used as `${proj_dir}`.110111---1121132. If the user provides a `.hic` file, convert it to `.mcool` file using `mcp__HiCExplorer-tools__hic_to_mcool` tool:114115Call:116- `mcp__HiCExplorer-tools__hic_to_mcool`117118with:119- `input_hic`: the user-provided path (e.g. `input.hic`)120- `sample`: the user-provided sample name121- `proj_dir`: directory to save the view file. In this skill, it is the full path of the `${sample}_loop_calling` directory returned by `mcp__project-init-tools__project_init`.122123The tool will:124- Convert the `.hic` file to `.mcool` file.125- Return the path of the `.mcool` file.126127If the conversion is successful, update `${mcool_uri}` to the path of the `.mcool` file.128129---1301313. Locate genome fasta file:132133Call:134135- `mcp__genome-locate-tools__genome_locate_fasta`136137with:138139- `genome`: the user-provided genome assembly140141The tool will:142143- Locate genome FASTA. 144- Verify the FASTA exists.145146---147148149### Step 2: List Available Resolutions in the .mcool file & Modify the Chromosome Names if Necessary1501511. Check the resolutions in `mcool_uri`:152153Call:154155- `mcp__cooler-tools__list_mcool_resolutions`156157with:158159- `mcool_path`: the user-provided path (e.g. `input.mcool`) without resolution specified.160161The tool will:162163- List all resolutions in the .mcool file.164- Return the resolutions as a list.165166If the user defined or default `${resolution}` is not found in the list, ask the user to specify the resolution again.167Else, use `${resolution}` for the following steps.168169---1701712. Check if the chromosome names in the .mcool file are started with "chr", and if not, modify them to start with "chr":172173Call:174175- `mcp__cooler-tools__harmonize_chrom_names`176177with:178- `sample`: the user-provided sample name179- `proj_dir`: directory to save the expected-cis and eigs-cis files. In this skill, it is the full path of the `${sample}_Compartments_calling` directory returned by `mcp__project-init-tools__project_init`180- `mcool_uri`: cooler URI with resolution specified, e.g. `input.mcool::/resolutions/${resolution}`181- `resolution`: `${resolution}` must be the same as the resolution used for `${mcool_uri}` and must be an integer182183The tool will:184- Check if the chromosome names in the .mcool file.185- If not, harmonize the chromosome names in the .mcool file.186- If the chromosome names are modified, return the path of the modified .mcool file under `${proj_dir}/` directory187188---189190191### Step 3 — Create Chromosome-Arm View File192193Use `bioframe` to define chromosome arms based on centromeres:194195Call:196197- `mcp__cooler-tools__make_view_chromarms`198199with:200201- `genome`: genome assembly202- `mcool_uri`: cooler URI with resolution specified, e.g. `input.mcool::/resolutions/${resolution}`203- `resolution`: `${resolution}` must be the same as the resolution used for `${mcool_uri}` and must be an integer204- `proj_dir`: directory to save the view file. In this skill, it is the full path of the `${sample}_loop_calling` directory returned by `mcp__project-init-tools__project_init`.205206The tool will:207208- Fetch chromsizes and centromeres via `bioframe`.209- Generate chromosomal arms and filter them to those present in the cooler.210- Return the path of the view file under `${proj_dir}/temp/` directory.211212---213214215### Step 4: Detect Chromatin Loops2162171. Calculate expected cis:218219Call:220- `mcp__cooltools-tools__run_expected_cis`221222with:223- `sample`: the user-provided sample name224- `proj_dir`: directory to save the view file. In this skill, it is the full path of the `${sample}_loop_calling` directory returned by `mcp__project-init-tools__project_init`.225- `mcool_uri`: cooler URI with resolution specified, e.g. `input.mcool::/resolutions/${resolution}`226- `resolution`: `${resolution}` must be the same as the resolution used for `${mcool_uri}` and must be an integer227- `view_path`: the path to the view file (e.g. `${proj_dir}/temp/view_${genome}.tsv`)228- `clr_weight_name`: the name of the weight column (default: `weight`)229- `ignore_diags`: the number of diagonals to ignore based on resolution230231The tool will:232- Generate expected cis file.233- Return the path of the expected cis file under `${proj_dir}/temp/` directory.234235---2362372. Call loops:238239Call:240241- `mcp__cooltools-tools__run_dots`242243with:244245- `sample`: the user-provided sample name246- `proj_dir`: directory to save the view file. In this skill, it is the full path of the `${sample}_loop_calling` directory returned by `mcp__project-init-tools__project_init`.247- `mcool_uri`: cooler URI with resolution specified, e.g. `input.mcool::/resolutions/${resolution}`248- `resolution`: `${resolution}` must be the same as the resolution used for `${mcool_uri}` and must be an integer249- `view_path`: the path to the view file (e.g. `${proj_dir}/temp/view_${genome}.tsv`)250- `nproc`: the number of processes for cooltools (default 6)251252The tool will:253254- Generate loops bedpe.255- Return the path of the loops bedpe file under `${proj_dir}/loops/` directory.256257---258