Claude-skill-registry functional-enrichment
Perform GO and KEGG functional enrichment using HOMER from genomic regions (BED/narrowPeak/broadPeak) or gene lists, and produce R-based barplot/dotplot visualizations. Use this skill when you want to perform GO and KEGG functional enrichment using HOMER from genomic regions or just want to link genomic region to genes.
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/11-toolbased-functional-enrichment" ~/.claude/skills/majiayu000-claude-skill-registry-functional-enrichment && rm -rf "$T"
skills/data/11-toolbased-functional-enrichment/SKILL.mdFunctional Enrichment (HOMER + R)
Overview
- Validate input: Accept BED/peak files with genomic coordinates or gene lists; check format and genome assembly.
- Map regions to genes: Convert regions to a unique gene set using HOMER
.annotatePeaks.pl - Run GO enrichment: Use HOMER
(orfindGO.pl
) for BP/MF/CC.annotatePeaks.pl -go - Run KEGG enrichment: Use HOMER
(orfindGO.pl -kegg
).annotatePeaks.pl -kegg - Collect outputs: Save tidy tables for downstream plotting and a compact summary of top terms.
- Visualize in R: Create barplots and dotplots (GO/KEGG) with
from standardized outputs.ggplot2 - QC & troubleshooting: Provide checks for genome mismatch, chromosome naming, and low-signal inputs.
Inputs & Outputs
Inputs (choose one):
Option 1: Input is a genomic region file (BED/narrowPeak/broadPeak)
Genomic region formats supported:
- BED files: Standard genomic interval format
- narrowPeak: narrow peak format
- broadPeak: broad peak format
Option 2: Input is a gene list (txt)
with one official gene symbol per line (no header). And an optionalgene_list.txt
with one official gene symbol per line (no header).gene_list_background.txt
Outputs (directory layout):
${sample}_functional_enrichment/ results/ ${sample}.anno_genomic_features.txt ${sample}.anno_genomic_features_stats.txt biological_process.txt cellular_component.txt molecular_function.txt kegg.txt biocyc.txt chromosome.txt cosmic.txt interactions.txt interpro.txt gene3d.txt pathwayInteractionDB.txt pfam.txt prints.txt prosite.txt reactome.txt smpdb.txt wikipathways.txt gwas.txt lipidmaps.txt msigdb.txt smart.txt tables/ ${sample}.gene_list.txt go_bp.tsv go_mf.tsv go_cc.tsv kegg.tsv logs/ ${sample}.anno_genomic_features.log # if genome region file is provided findGO.log
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}_functional_enrichment - Genome assembly (
): e.g.genome
,hg38
,mm10
.danRer11- Never guess or auto-detect.
Step 1: Initialize Project
- Make director for this project:
Call:
mcp__project-init-tools__project_init
with:
: the user-provided sample namesample
: de_novo_motif_discoverytask
The tool will:
- Create
directory.${sample}_functional_enrichment - Get the full path of the
directory, which will be used as${sample}_functional_enrichment
.${proj_dir}
Step 2: Prepare genome file for homer
Call:
mcp__homer-tools__check_genome_installation
With:
: the user-provided genome assembly, e.g.genome
,hg38
,mm10danRer11
The tool will:
- Check if the genome is installed in HOMER.
- If not, install the genome.
Step 3 (Optional): Standardize chromosome names for BED files
This step is optional. Only perform this step if the input file is a BED file. If the input file is a gene list, skip this step.
From
1 format to chr1 format
From MT format to chrM format
Call:
mcp__file-format-tools__standardize_bed_chrom_names
with:
: the user-provided BED fileinput_bed
: the path to save the standardized BED fileoutput_bed
The tool will:
- Standardize the chromosome names in the BED file.
- Return the path of the standardized BED file.
Step 4 (Optional): Convert gene ID to gene symbol
This step is optional. Only perform this step if the input file is a gene list file. If the input file is a BED file, skip this step.
Call:
mcp__mygene-tools__convert_gene_ids_mygene
With:
: the user-provided gene list file. May end withinput_ids_file
..txt
: the source ID type for mygene (e.g., 'ensembl.gene', 'symbol', 'entrezgene', 'uniprot', or a comma-separated list).scopes
: the comma-separated target fields to retrieve from mygene (e.g., 'symbol,ensembl.gene,uniprot,entrezgene').fields
: the species for mygene (e.g., 'human', 'mouse', 'zebrafish', or NCBI taxon ID like '9606').species
: the path to save the converted gene list file. In this skill, it is the full path of theout_file
directory returned by${sample}_functional_enrichmentmcp__project-init-tools__project_init
: the batch size for mygene.querymany (default 1000).batch_size
The tool will:
- Convert the gene ID to gene symbol.
- Return the path of the converted gene list file.
Step 5: GO enrichment analysis
Option 1: from genomic regions file
Only if the input file is a BED file. If the input file is a gene list, call tools in Option 2.
- annotate the genomic regions using Homer's
withannotatePeaks.pl
option. If user also provides a background genome region file, like a control peak file, also call this tool for the background genome region file. Use a different-go
as the sample name for the background sample.${sample}
Call:
mcp__homer-tools__annotate_genomic_features
With:
: the user-provided sample namesample
: directory to save the genomic feature annotation results. In this skill, it is the full path of theproj_dir
directory returned by${sample}_functional_enrichmentmcp__project-init-tools__project_init
: the user-provided regions file in BED format. May end withregions_bed
,.bed
,.narrowPeak
, etc..broadPeak
: the user-provided genome assembly, e.g.genome
,hg38
,mm10danRer11
: "custom homer annotation file (created by assignGenomeAnnotation.pl), (default: None).ann
: keep original region sizes (default: True)size_given
: include CpG information (default: False)cpg
:go
to perform GO enrichment analysis.True
The tool will:
- Annotate the genomic regions using Homer's
.annotatePeaks.pl - Return the path of the annotated regions file under
directory, and the path to the log file under${proj_dir}/results/
directory.${proj_dir}/logs/${proj_dir}/results/${sample}.anno_genomic_features.txt${proj_dir}/results/${sample}.anno_genomic_features_stats.txt${proj_dir}/logs/${sample}.anno_genomic_features.log
- (optional) extract the genes from the annotated regions file if neccessary for future analysis or the target gene list is requested by user. If not requested, skip this step.
Call:
mcp__file-format-tools__extract_gene_list
With:
: the user-provided sample namesample
: directory to save the genomic feature annotation results. In this skill, it is the full path of theproj_dir
directory returned by${sample}_functional_enrichmentmcp__project-init-tools__project_init
The tool will:
- Extract the genes from the annotated regions file.
- Return the path of the gene list file under
directory.${proj_dir}/tables/${proj_dir}/tables/${sample}.gene_list.txt
Option 2: from gene list file
Only if the input file is a gene list file. If the input file is a BED file, call tools in Option 1.
Call:
mcp__homer-tools__gene_function_enrichment
With:
: the user-provided sample namesample
: directory to save the GO & KEGG enrichment results. In this skill, it is the full path of theproj_dir
directory returned by${sample}_functional_enrichmentmcp__project-init-tools__project_init
: the user-provided gene list file. May end withgene_list_file
..txt
: the user-provided organism name, e.g.organism
,human
,mouse
, etc.zebrafish
: the user-provided background gene list file. May end withbackground_gene_list_file
. If not provided, set this parameter to.txt
.None
The tool will:
- Find the GO enrichment for the gene list.
- Return the path of the GO & KEGG enrichment results under
directory.${proj_dir}/results/${proj_dir}/results/biological_process.txt${proj_dir}/results/kegg.txt- ... other GO and KEGG enrichment results files.
- Return the path of the log file under
directory.${proj_dir}/logs/${proj_dir}/logs/${sample}.find_go_and_kegg_enrichment.log
Alternative direct from BED
annotatePeaks.pl peaks.bed hg38 -go results/{run}/tables/go_dir -genomeOntology
annotatePeaks.pl peaks.bed hg38 -kegg results/{run}/tables/kegg_dir
Notes & Best Practices
- Genome & naming: Ensure the HOMER genome key matches the species; chromosome naming must be consistent (
vschr1
).1 - BED format: Tab-delimited, ≥3 columns, 0-based coordinates, no header.
- Multiple testing: Prefer FDR (BH) if provided; otherwise fallback to P-value.
- Background set:
helps reduce bias; choose a reasonable universe (e.g., all expressed or all accessible regions → genes).-bg - Direct-from-BED:
is convenient; the gene-list route yields uniform TSVs for plotting.annotatePeaks.pl -go/-kegg
Troubleshooting
- Many NAs after annotation: Check genome version, chromosome naming, BED formatting, and headers.
- Empty/weak enrichment: Ensure sufficient genes (suggest ≥50), verify species of symbols, tune thresholds or background.
- Column name drift: HOMER versions may differ; adjust R column mappings if needed.