Skills

Bio Chipseq Differential Binding

Differential binding analysis using DiffBind.

Install

npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-chipseq-differential-binding -g -a claude-code -y
Category
Engineering
Updated
4mo ago
License
See repository
Context cost
Mediumabout 1,792 tokens
Runs scripts
No, instructions only

What it does

Differential binding analysis using DiffBind. Compare ChIP-seq peaks between conditions with statistical rigor. Requires replicate samples. Outputs differentially bound regions with fold changes and p-values. Use when comparing ChIP-seq binding between conditions.

Version Compatibility

Reference examples tested with: DESeq2 1.42+, edgeR 4.0+

Before using code patterns, verify installed versions match. If versions differ:

  • R: packageVersion('<pkg>') then ?function_name to verify parameters

If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

Differential Binding with DiffBind

"Compare ChIP-seq binding between conditions" → Identify genomic regions with statistically significant differences in transcription factor or histone mark occupancy between experimental groups.

  • R: DiffBind::dba() → dba.count() → dba.contrast() → dba.analyze()

Create Sample Sheet

Goal: Define the experimental design linking BAM files, peak files, and sample metadata for DiffBind.

Approach: Build a data frame (or CSV) with required columns mapping each sample to its files and conditions.

# Create sample sheet as data frame or CSV
samples <- data.frame(
    SampleID = c('ctrl_1', 'ctrl_2', 'treat_1', 'treat_2'),
    Tissue = c('cell', 'cell', 'cell', 'cell'),
    Factor = c('H3K4me3', 'H3K4me3', 'H3K4me3', 'H3K4me3'),
    Condition = c('control', 'control', 'treatment', 'treatment'),
    Replicate = c(1, 2, 1, 2),
    bamReads = c('ctrl1.bam', 'ctrl2.bam', 'treat1.bam', 'treat2.bam'),
    Peaks = c('ctrl1_peaks.narrowPeak', 'ctrl2_peaks.narrowPeak',
              'treat1_peaks.narrowPeak', 'treat2_peaks.narrowPeak'),
    PeakCaller = c('macs', 'macs', 'macs', 'macs')
)

write.csv(samples, 'samples.csv', row.names = FALSE)

Load Data

Goal: Initialize a DiffBind object from the sample sheet containing all samples and peaks.

Approach: Read the sample sheet CSV into a DBA object that identifies overlapping peaks across samples.

library(DiffBind)

# From sample sheet
dba_obj <- dba(sampleSheet = 'samples.csv')

# View summary
dba_obj

Count Reads in Peaks

Read the whole SKILL.md on GitHub

More in Engineering