Claude-skill-registry differential-tad-analysis
This skill performs differential topologically associating domain (TAD) analysis using HiCExplorer's hicDifferentialTAD tool. It compares Hi-C contact matrices between two conditions based on existing TAD definitions to identify significantly altered chromatin domains.
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/20-toolbased-differential-tad-analysis" ~/.claude/skills/majiayu000-claude-skill-registry-differential-tad-analysis && rm -rf "$T"
skills/data/20-toolbased-differential-tad-analysis/SKILL.mdDifferential TAD Analysis with HiCExplorer
Overview
This skill identifies differentially interacting TADs between two experimental conditions using HiCExplorer.
It assumes that TADs have already been called for the target condition.
Steps:
- Normalize Hi-C matrices between conditions. Modify the chromosome name in the .mcool file if not started with "chr".
- Prepare TAD domains (BED file) of the target sample. Make sure the consistence of the chromosame names between .mcool files and BED files. Modify the chromosome name in the BED file if not consistent with the .mcool file.
- Perform differential TAD analysis.
- Visualize the Hi-C contact maps for the target and control conditions.
- Visualize and interpret significant TAD changes.
When to Use This Skill
Use this skill when:
- You have already called TADs for one condition.
- You want to detect TADs that show significant interaction changes between two Hi-C matrices.
- You are comparing chromatin architecture between experimental conditions (e.g., treated vs. control, different cell types).
Inputs & Outputs
Inputs
- File format: Two files in .mcool, .cool, or .hic format for the target and control conditions.
- Genome assembly: Prompt the user for genome assembly used.
- Resolution: Provided by user. ~10-50 kb is recommended. Default is 50 kb. 25 kb is the best but memory-consuming.
Outputs
${target}_${control}_differential_tad_analysis/ normalize/ ${target}_norm.cool ${control}_norm.cool TADs/ ${target}_TAD_boundaries.bed # Called TADs in BED format ${target}_TAD_boundaries.gff ${target}_TAD_domains.bed ${target}_TAD_score.bedgraph ${target}_TAD_tad_score.bm diff_TADs/ ${target}_${control}_accepted.diff_tad ${target}_${control}_rejected.diff_tad plots/ ${target}_${control}_contactmap_chrN.png
Allowed Tools
When using this skill, you should restrict yourself to the following MCP tools from server
project-init-tools, genome-locate-tools, HiCExplorer-tools:
mcp__project-init-tools__project_initmcp__HiCExplorer-tools__hic_to_mcoolmcp__HiCExplorer-tools__run_hicFindTADsmcp__HiCExplorer-tools__hic_normalizemcp__HiCExplorer-tools__hic_differential_tadmcp__HiCExplorer-tools__generate_track_inimcp__HiCExplorer-tools__plot_hic_contact_mapsmcp__HiCExplorer-tools__plot_tads_region
Do NOT fall back to:
- raw shell commands (
,hicFindTADs
, etc.)hicPlotTADs - 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:
- Target sample name (
): used as prefix and for the output directorytarget
.${target}_${control}_differential_tad_analysis - Control sample name (
): used as prefix and for the output directorycontrol
.${target}_${control}_differential_tad_analysis - Genome assembly (
): e.g.genome
,hg38
,mm10
.danRer11- Never guess or auto-detect.
- Hi-C matrix path/URI (
,mcool_uri_target
): .mcool_uri_control
,path/to/target.mcool::/resolutions/50000
(.mcool files with resolution specified)path/to/control.mcool::/resolutions/50000- or
file path.cool - or
file path.hic
- Resolution (
): defaultresolution
(50 kb).50000- If user does not specify, use
as default.50000 - Must be the same as the resolution used for
and${mcool_uri_target}${mcool_uri_control}
- If user does not specify, use
Step 1: Initialize Project
- Make director for this project:
Call:
mcp__project-init-tools__project_init
with:
:sample${target}_${control}
: differential_tad_analysistask
The tool will:
- Create
directory.${target}_${control}_differential_tad_analysis - Get the full path of the
directory, which will be used as${target}_${control}_differential_tad_analysis
.${proj_dir}
- If the user provides
files for the target and control conditions, convert it to.hic
file first using.mcool
tool for the target and control conditions separately:mcp__HiCExplorer-tools__hic_to_mcool
Call:
mcp__HiCExplorer-tools__hic_to_mcool
with:
: the user-provided path (e.g.input_hic
)input.hic
:sample${target}
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${target}_${control}_differential_tad_analysis
.mcp__project-init-tools__project_init
: the user-provided resolutions (e.g.resolutions
)[50000]
The tool will:
- Convert the
file to.hic
file for the target condition..mcool - Return the path of the
file for the target condition..mcool
Call:
mcp__HiCExplorer-tools__hic_to_mcool
with:
: the user-provided path (e.g.input_hic
)input.hic
:sample${control}
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${target}_${control}_differential_tad_analysis
.mcp__project-init-tools__project_init
: the user-provided resolutions (e.g.resolutions
)[50000]
The tool will:
- Convert the
file to.hic
file for the control condition..mcool - Return the path of the
file for the control condition..mcool
If the conversion is successful, update
${mcool_uri_target} and ${mcool_uri_control} to the path of the .mcool files.
- Inspect the
files for the target and control conditions respectively to list available resolutions and confirm the analysis resolution with the user..mcool
Call:
mcp__cooler-tools__list_mcool_resolutions
with:
: the path of themcool_path
file for the target condition. If the user provides the path of the.mcool
file, these are the.hic
files returned by.mcool
tool.mcp__HiCExplorer-tools__hic_to_mcool
The tool will:
- List all resolutions in the .mcool file for the target condition.
- Return the resolutions as a list.
Call:
mcp__cooler-tools__list_mcool_resolutions
with:
: the path of themcool_path
file for the control condition. If the user provides the path of the.mcool
file, these are the.hic
files returned by.mcool
tool.mcp__HiCExplorer-tools__hic_to_mcool
The tool will:
- List all resolutions in the .mcool file for the control condition.
- Return the resolutions as a list.
If the
${resolution} for the target condition or the control condition is not found, ask the user to specify the resolution again.
Else, use ${resolution} for the target condition and ${resolution} for the control condition.
Step 2. Normalize Hi-C matrices
To ensure both matrices have comparable sequencing depth and coverage, perform normalization before analysis.
Call:
mcp__HiCExplorer-tools__hic_normalize
with:
:sample_target${target}
:sample_control${control}
: Full path to project directory. In this skill, it is the full path of theproj_dir
directory returned by${target}_${control}_differential_tad_analysis
.mcp__project-init-tools__project_init
:mcool_uri_target
with the resolution${mcool_uri_target}
specified.${resolution}
:mcool_uri_control
with the resolution${mcool_uri_control}
specified.${resolution}
:resolution
, must be the same as the resolution used in previous steps and must be an integer.${resolution}
: Normalization method: smallest, largest, or sum.method
The tool will:
- Normalize the Hi-C matrices for the target and control conditions.
- Return the path of the normalized Hi-C matrices for the target and control conditions, which will be used as
and${cool_target_norm}
.${cool_control_norm}
Step 3. Prepare TAD domains for the target condition
Use
mcp__HiCExplorer-tools__run_hicFindTADs for comprehensive TAD identification for the target condition. Customize parameters to suit the resolution and depth of your Hi-C data:
Before calling the tool, ask the user for the following parameters:
: Minimum window size (e.g. 3x resolution, default 150000, must be at least 3 times larger than the resolution)${min_depth}
: Maximum window size (e.g. 6-10x resolution, default 300000, must be at least 5 times larger than the resolution)${max_depth}
: Step size for sliding window (default 50000, 25000 is the best but memory-consuming)${step}
: Multiple testing correction method (e.g. 'fdr')${multiple_testing}
: FDR threshold for significant TADs (default 0.05)${threshold_comparisons}
: Delta parameter for TAD boundary detection (default 0.01)${delta}
: Chromosomes to call TADs (default${chromosomes}
). It is suggested to call TADs on a certain chromosome because it is memory-consuming to call TADs on all chromosomes and this process would likely be killed by the system.chr22
Call:
mcp__HiCExplorer-tools__run_hicFindTADs
with:
:sample${target}
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${sample}_TAD_calling
.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}
:min_depth
, must be at least 3 times larger than the resolution.${min_depth}
:max_depth
, must be at least 5 times larger than the resolution.${max_depth}
:step${step}
:multiple_testing${multiple_testing}
:threshold_comparisons${threshold_comparisons}
:delta${delta}
: chromosomes to call TADs, e.g.chromosomes
, space-separated list.chr22
The tool will:
- Call
to identify TADs.mcp__HiCExplorer-tools__run_hicFindTADs - Return the path of the TADs file under
directory.${proj_dir}/TADs/
Step 4. Run differential TAD analysis
Detect TADs with statistically different intra- and inter-TAD interactions between the normalized matrices.
Call:
mcp__HiCExplorer-tools__hic_differential_tad
with:
:target${target}
:control${control}
:cool_target_norm
returned by${cool_target_norm}
tool.mcp__HiCExplorer-tools__hic_normalize
:cool_control_norm
returned by${cool_control_norm}
tool.mcp__HiCExplorer-tools__hic_normalize
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${target}_${control}_differential_tad_analysis
.mcp__project-init-tools__project_init
:target_tads
under${target}_TADs_domains.bed
directory returned by${proj_dir}/TADs/
tool.mcp__HiCExplorer-tools__run_hicFindTADs
: Significance cutoff for differential TADs (default 0.05)p_value
: Region types used for testing: 'intra-TAD', 'left-inter-TAD', 'right-inter-TAD', or 'all' (default)region_mode
: Multiple region reject rule: 'one' (default) or 'all' for stricter criteriareject_rule
: Number of threads for chromosome-level parallelization (default 4)threads
The tool will:
- Run differential TAD analysis.
- Return the path of the differential TADs file under
directory.${proj_dir}/diff_TADs/
Step 5. Visualize the Hi-C matrices
Before calling the tool, ask the user for the target region, like
"chr22:1000000-2000000".
- Visualize the Hi-C contact map for the target condition
Call :
mcp__HiCExplorer-tools__plot_hic_contact_maps
with:
:sample${target}
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${target}_${control}_differential_tad_analysis
.mcp__project-init-tools__project_init
:cool_norm
returned by${cool_target_norm}
tool.mcp__HiCExplorer-tools__hic_normalize
: region to plot, e.g.regionchr1:1000000-5000000
: DPI for the plot (default 300)dpi
: Apply log1p transform to contact values (default True)log1p
: Use --perChr option of hicPlotMatrix (default True)per_chr
The tool will:
- Visualize the Hi-C contact map for the target condition.
- Return the path of the Hi-C contact map file under
directory.${proj_dir}/plots/
- Visualize the Hi-C contact map for the control condition
Call:
mcp__HiCExplorer-tools__plot_hic_contact_maps
with:
:sample${control}
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${target}_${control}_differential_tad_analysis
.mcp__project-init-tools__project_init
:cool_norm
returned by${cool_control_norm}
tool.mcp__HiCExplorer-tools__hic_normalize
: region to plot, e.g.regionchr1:1000000-5000000
: DPI for the plot (default 300)dpi
: Apply log1p transform to contact values (default True)log1p
: Use --perChr option of hicPlotMatrix (default True)per_chr
The tool will:
- Visualize the Hi-C contact map for the control condition.
- Return the path of the Hi-C contact map file under
directory.${proj_dir}/plots/
Step 6. Overlay differential TADs
- generate the
file first for visualization<track.ini>
Call:
mcp__HiCExplorer-tools__generate_track_ini
with:
:sample${target}_${control}
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${target}_${control}_differential_tad_analysis
.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}
: depth for the Hi-C matrix view, e.g. 1500000depth
: minimum value for the Hi-C matrix view, e.g. 0.0min_value
: maximum value for the Hi-C matrix view, e.g. 80.0max_value
: Trueif_diff_TADs
:target
, target sample name.${target}
:control
, control sample name.${control}
The tool will:
- Generate the
file under<track.ini>
directory.${proj_dir}/temp/ - Return the path of the
file.<track.ini>
- Contact Maps with TAD Overlays
Before calling the tool, ask the user for the target region, like
."chr22:1000000-2000000"
Call:
mcp__HiCExplorer-tools__plot_tads_region
with:
:sample${target}_${control}
: directory to save the view file. In this skill, it is the full path of theproj_dir
directory returned by${sample}_TAD_calling
.mcp__project-init-tools__project_init
: user-provided target region, likeregion"chr22:1000000-2000000"
: dpi for the contact map, default is 300dpi
The tool will:
- Generate the contact map with TAD boundaries overlayed.
- Return the path of the contact map file under
directory.${proj_dir}/plots/
Best Practices
- Ensure both Hi-C matrices are balanced and have identical resolutions.
- Confirm that the TAD BED file is derived from the target condition at the same resolution.
- Verify consistent normalization methods across all samples.
- Inspect the resulting visualizations to confirm biological plausibility.