SKILL.md
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_nameto 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.
