Claude-skill-registry nested-TAD-detection
This skill detects hierarchical (nested) TAD structures from Hi-C contact maps (in .cool or mcool format) using OnTAD, starting from multi-resolution .mcool files. It extracts a user-specified chromosome and resolution, converts the data to a dense matrix, runs OnTAD, and organizes TAD calls and logs for downstream 3D genome analysis.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/31-toolbased-nested-tad-detection" ~/.claude/skills/majiayu000-claude-skill-registry-nested-tad-detection && rm -rf "$T"
skills/data/31-toolbased-nested-tad-detection/SKILL.mdNested TAD Detection from .mcool Using OnTAD
Overview
This skill performs nested TAD (hierarchical TAD/subTAD) detection from Hi-C data using OnTAD, starting from a .mcool, .cool or .hic file.
Main steps include:
- Refer to the Inputs & Outputs section to verify required files and output structure.
- Inspect the
file to list available resolutions and alway remember to confirm the chromosome name and analysis resolution with the user..mcool - Extract a balanced or raw dense Hi-C matrix for a selected chromosome and resolution from the
file..mcool - Ensure matrix quality (symmetry, no all-zero rows/columns, reasonable contact decay).
- Run OnTAD to call TADs and nested TAD structures.
- Parse and standardize OnTAD output into BED-like tables and hierarchical annotation files.
When to use this skill
Use this skill when you want to identify TADs and nested sub-TADs from high- or mid-resolution Hi-C data, especially when your contact maps are stored as Cooler multi-resolution files (.mcool) and you need chromosome- and resolution-specific OnTAD calls.
Typical biological questions / use-cases:
- Comparing TAD hierarchy between cell types (e.g., GM12878 vs K562) or conditions (control vs treated).
- Investigating whether inner subTADs are enriched for active regulatory elements, specific histone marks, or gene expression.
- Studying boundary usage, boundary sharing, or hierarchical TAD levels around key loci (e.g., HOX clusters, oncogenes).
- Integrating nested TAD structure with ChIP-seq, ATAC-seq, or WGBS to understand spatial regulatory architecture.
Data quality & replication assumptions:
- Hi-C experiments should have sufficient depth for the target resolution (e.g., ≥5–10 kb typically requires deep sequencing).
- Preferably, use biological replicates per condition and call TADs on either:
- individual replicate matrices (and then merge/consensus), or
- replicate-merged matrices (if justified).
- The
should be properly normalized or at least QC’d (ICE/balanced weights available if using.mcool
).--balanced
Inputs & Outputs
Inputs
Required core inputs:
- Hi-C matrix file
- Multi-resolution Cooler file (
), e.g.:.mcoolsample.mcool
- Or one-resolution Cooler file (
), e.g.:.coolsample.cool
- Or Hi-C file (
), e.g.:.hicsample.hic
- Multi-resolution Cooler file (
- User-supplied parameters (must come from user feedback)
- Chromosome name: e.g.,
,chr1
,chr2chrX - Resolution of interest: e.g.,
,10000
,25000
(in bp)40000 - Chromosome length: e.g., 133275309
- Chromosome name: e.g.,
- Software and environment
command-line utilities (or Pythoncooler
module) available incooler
or environment.$PATH
installed and callable (e.g.,OnTAD
orOnTAD
command).OnTAD_linux
(3.x) and basic scientific Python stack if using Python-based extraction.python
Optional entry point:
- Precomputed dense Hi-C matrix (OnTAD-ready)
- Plain text dense square matrix (no header), e.g.
.proj_dir/matrices/chr17_25kb_dense.matrix - If this is already present, you may skip the
→ dense matrix conversion and jump directly to OnTAD..mcool
- Plain text dense square matrix (no header), e.g.
Operational rules for missing inputs:
- If
or.mcool
or.cool
file is missing:.hic
"sample.mcool not available, provide required files or skip and proceed ?" - If chromosome list not specified:
Ask the user explicitly rather than assuming default. - If OnTAD executable is not found:
Ask user to install/locate OnTAD before proceeding.
Outputs
Default output directory structure:
${sample}_nested_TAD_detection/ matrices/ ${chromosome}_${resolution}_dense.txt ${chromosome}_${resolution}_dense.log nested_TADs/ ${chromosome}_${resolution}_OnTAD.tad ${chromosome}_${resolution}_OnTAD.bed ${chromosome}_${resolution}_OnTAD.log
Allowed Tools
When using this skill, you should restrict yourself to the following MCP tools from server
cooler-tools, cooltools-tools, plot-hic-tools, project-init-tools:
mcp__project-init-tools__project_initmcp__cooler-tools__list_mcool_resolutionsmcp__cooler-tools__harmonize_chrom_namesmcp__cooler-tools__dump_chromsmcp__cooler-tools__dump_dense_matrixmcp__OnTAD-tools__run_ontad
Do NOT fall back to:
- raw shell commands (
, etc.)OnTAD - ad-hoc Python snippets (e.g. importing
,cooler
,bioframe
manually in the reply).matplotlib
Decision Tree
Step 0 — Gather Required Information from the User
Before calling any tool, ask the user:
-
Sample name (
): used as prefix and for the output directorysample
.${sample}_nested_TAD_detection -
Genome assembly (
): e.g.genome
,hg38
,mm10
.danRer11- Never guess or auto-detect.
-
Hi-C matrix path/URI (
):mcool_uri
(.mcool file with resolution specified)path/to/sample.mcool::/resolutions/25000- or
file path.cool - or
file path.hic
-
Resolution (
): defaultresolution
(100 kb).25000- If user does not specify, use
as default.25000 - Must be the same as the resolution used for
${mcool_uri}
- If user does not specify, use
Step 1 — Initialize Project
- Make director for this project:
Call:
mcp__project-init-tools__project_init
with:
: the user-provided sample namesample
: hic_matrix_qctask
The tool will:
- Create
directory.${sample}_nested_TAD_detection - Return the full path of the
directory, which will be used as${sample}_nested_TAD_detection
.${proj_dir}
- If the user provides a
file, convert it to.hic
file using.mcool
tool:mcp__HiCExplorer-tools__hic_to_mcool
Call:
mcp__HiCExplorer-tools__hic_to_mcool
with:
: the user-provided path (e.g.input_hic
)input.hic
: the user-provided sample namesample
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${sample}_nested_TAD_detection
.mcp__project-init-tools__project_init
The tool will:
- Convert the
file to.hic
file..mcool - Return the path of the
file..mcool
If the conversion is successful, update
${mcool_uri} to the path of the .mcool file.
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:
: the user-provided path (e.g.mcool_path
) without resolution specified.input.mcool
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:
: the user-provided sample namesample
: directory to save the expected-cis and eigs-cis files. In this skill, it is the full path of theproj_dir
directory returned by${sample}_Compartments_callingmcp__project-init-tools__project_init
: cooler URI with resolution specified, e.g.mcool_uriinput.mcool::/resolutions/${resolution}
:resolution
must be the same as the resolution used for${resolution}
and must be an integer${mcool_uri}
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
directory${proj_dir}/
Step 3: Check chromosome length
Call:
mcp__cooler-tools__dump_chroms
with:
: cooler URI with resolution specified, e.g.mcool_uriinput.mcool::/resolutions/${resolution}
:resolution
must be the same as the resolution used for${resolution}
and must be an integer${mcool_uri}
The tool will:
- Return the chromosome name and length as a table.
Step 4: Extract dense matrix from .mcool
.mcoolCall:
mcp__cooler-tools__dump_dense_matrix
with:
: the user-provided sample namesample
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${sample}_nested_TAD_detection
.mcp__project-init-tools__project_init
: cooler URI with resolution specified, e.g.mcool_uriinput.mcool::/resolutions/${resolution}
:resolution
must be the same as the resolution used for${resolution}
and must be an integer${mcool_uri}
: the user-provided chromosome name (e.g.chrom
)chr17
: whether to use balanced matrix (default: True)balanced
The tool will:
- Extract the dense matrix from the .mcool file.
- Return the path of the dense matrix file.
Step 5: Run OnTAD
Call:
mcp__OnTAD-tools__run_ontad
with:
: the user-provided sample namesample
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${sample}_nested_TAD_detection
.mcp__project-init-tools__project_init
: the path to the dense matrix file (e.g.dense_matrix
)${proj_dir}/matrices/chr17_25kb_dense.matrix
: the user-provided chromosome name (e.g.chrom
)chr17
: the corresponding chromosome length (e.g. 83257441) returned bychrom_length
tool.mcp__cooler-tools__dump_chroms
: the user-provided resolution (e.g. 25000)resolution
: the penalty parameter for OnTAD (e.g. 0.1)penalty
: the maximum TAD size (in bins) (e.g. 200)maxsz
The tool will:
- Run OnTAD to call TADs and nested TAD structures.
- Return the path of the OnTAD output file (.tad, .bed, .log).