Skip to content
TF-differential-binding logo

TF-differential-binding

The TF-differential-binding pipeline performs differential transcription factor (TF) binding analysis from ChIP-seq datasets (TF peaks) using the DiffBind package in R. It identifies genomic regions where TF binding intensity significantly differs between experimental conditions (e.g., treatment ...

SKILL.md

Full skill instructions

DiffBind TF Differential Binding Analysis

Overview

This skill enables comprehensive differential TF binding analysis using DiffBind in R. DiffBind integrates read counting, normalization, and statistical modeling to identify differentially bound peaks between conditions.

To perform DiffBind differential binding analysis:

  • Initialize the project directory.
  • Refer to the Inputs & Outputs section to check inputs and build the output architecture. All the output file should located in ${proj_dir} in Step 0.
  • Always prompt user if required files are missing.
  • Provide a sample sheet with ChIP-seq peak files and corresponding BAM files for each sample.
  • Construct a DBA object from the sample sheet.
  • Compute read counts over consensus peak regions.
  • Specify experimental conditions (e.g., treatment vs. control or cell_type_A vs. cell_type_B).
  • Run statistical tests to identify differentially bound regions.
  • Generate correlation heatmaps, PCA plots, and volcano plots; extract significant binding events.

When to use this skill

Use the TF-differential-binding pipeline when you need to analyze the different function of the same TF across two or more biological conditions, cell types, or treatments using ChIP-seq data or TF binding peaks. This pipeline is ideal for studying regulatory mechanisms that underlie transcriptional differences or epigenetic responses to perturbations.

Recommended applications include:

  • Comparing treated vs. control or wild-type vs. mutant conditions to identify TF binding changes in response to stimuli, drugs, or mutations.
  • Comparing TF binding profiles between two cell types or experimental conditions to identify differentially bound regions (DBRs).
  • Comparing the different TF function in two conditions.
  • Integrating with RNA-seq to correlate TF binding alterations with gene expression changes.
  • Investigating co-factor dependencies or chromatin remodeling events linked to TF occupancy.

Inputs & Outputs

Inputs (choose one)

  • If starting from BAM files and BED peak files → Generate consensus peaks and count matrix.
  • If starting from existing count matrix → Go directly to DiffBind analysis.
  • If multiple conditions or batches → Include batch/​condition in design

Outputs

${sample}_TF_DB_analysis/
    DBs/
      DB_results.csv # DESeq2 results (log2FC, p-values)
      DB_up.bed
      DB_down.bed  
    plots/ # visualization outputs
      PCA.pdf
      volcano.pdf
      heatmap.pdf
    logs/ # analysis logs 
    temp/ # other temp files

Decision Tree

Step 0: Initialize Project

  1. Make director for this project:

Call:

  • mcp__project-init-tools__project_init

with:

  • sample: sample name (e.g. c1_vs_c2)
  • task: TF_DB

The tool will:

  • Create ${sample}_TF_DB directory.
  • Return the full path of the ${sample}_TF_DB directory, which will be used as ${proj_dir}.

Step 1: Prepare Input Data

Create a CSV sample sheet (samplesheet.csv) with the following columns:

SampleIDTissueFactorConditionbamReadsPeaksPeakCaller
TF_A_1ATFControlControl1.bamControl1_peaks.narrowPeaknarrow
TF_A_2ATFControlControl2.bamControl2_peaks.narrowPeaknarrow
TF_B_1ATFTreatedTreated1.bamTreated1_peaks.narrowPeaknarrow
TF_B_2ATFTreatedTreated2.bamTreated2_peaks.narrowPeaknarrow

Step 2: Load Data and Build the DiffBind Object

library(DiffBind)
samples <- read.csv("samplesheet.csv")
dbObj <- dba(sampleSheet=samples)

Key parameters:

  • sampleSheet: CSV file with BAM and peak information
  • Supports both narrowPeak and broadPeak formats

Step 3: Read Counting and Consensus Peak Generation

Count reads overlapping consensus peaks across samples:

# Generate a consensus peakset
dbObj <- dba.count(dbObj, summits=250)

Notes:

  • summits: re-centers peaks ±250 bp around summits for consistency.
  • The resulting matrix contains normalized counts for all samples.

Step 4: Contrast Definition

Define conditions for comparison:

# Define experimental contrasts (e.g., Treated vs Control)
dbObj <- dba.contrast(dbObj, categories=DBA_CONDITION, minMembers=2)

Alternatives:

  • For multifactor experiments: use DBA_TISSUE, DBA_TREATMENT, or custom metadata.
  • Check contrasts:
    dba.show(dbObj, bContrasts=TRUE)
    

Step 5: Differential Binding Analysis

# Perform analysis
dbObj <- dba.analyze(dbObj, method=DBA_DESEQ2)

Parameters:

  • method: choose DBA_DESEQ2 (default) or DBA_EDGER
  • th: FDR threshold (default 0.05)
  • fold: minimum log2 fold change
  • bUsePval=TRUE: use p-values instead of FDR cutoff

Step 6: Visualization and Quality Control

Correlation Heatmap
dba.plotHeatmap(dbObj, correlations=TRUE, scale="row")
PCA Plot
dba.plotPCA(dbObj, attributes=DBA_CONDITION, label=DBA_ID)
Volcano Plot
# Volcano plot
allResults <- dba.report(dbObj, method=DBA_DESEQ2, th=1)
with(allResults, plot(Fold, -log10(FDR),
     col=ifelse(FDR < 0.05 & abs(Fold) > 1, "red", "grey"),
     pch=16, main="Volcano Plot"))

Output: heatmap.pdf Volcano.pdf PCA.pdf


Step 7: Result Extraction

Export significant differential peaks:

write.csv(as.data.frame(allResults), "DB_results.csv", row.names = FALSE)
library(rtracklayer)
# Extract results with FDR < 0.05 and |log2FC| > 1
sigSites <- dba.report(dbObj, method=DBA_DESEQ2, th=0.05, fold=1)
print("Differential binding results summary:")
print(summary(sigSites))

# get the peaks that up or down in treated condition
diff_up <- sigSites[sigSites$Fold > 0]
diff_down <- sigSites[sigSites$Fold < 0]
export(diff_up, "DB_up_${treated_condition}.bed")
export(diff_down, "DB_down_${treated_condition}.bed")

Output: DB_results.csv DB_up_${treated_condition}.bed DB_down_${treated_condition}.bed


Interpretation and Biological Insights

Significance Criteria

  • FDR < 0.05 → statistically significant
  • |log2FC| > 1 → biologically meaningful difference
  • Consistent replicates → at least two replicates per condition recommended

Typical Biological Interpretations

  • Increased binding in treated condition → potential activation or recruitment of TFs
  • Decreased binding → loss of TF affinity or chromatin closing
  • Combine with RNA-seq to correlate with target gene expression.

Troubleshooting

ProblemPossible CauseSolution
No differential peaks foundInsufficient replicates or low coverageIncrease sequencing depth or lower FDR threshold
Errors in sample sheetColumn names incorrect or missingUse standard DiffBind column format
Inconsistent genome buildMixed genome assembliesEnsure all BAM and peak files use the same genome reference
Over-normalizationStrong batch effectsInclude batch term in design or run dba.contrast(..., block=...)

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View