Compute the ENCODE-compliant ChIP-seq QC battery (FRiP, NSC/RSC, library complexity, fingerprint metrics, replicate concordance) and detect hyper-ChIPable artifacts before committing to downstream analysis. Embeds antibody validation logic and fragment-size diagnostics; both of which are upstream of any numeric metric and determine whether the metrics themselves are interpretable.
# CLI tools
conda install -c bioconda samtools bedtools phantompeakqualtools idr deeptools subread
# Python utilities for custom metrics
pip install pysam pybedtools pandas
# Bioconductor ChIPQC for one-call full report
BiocManager::install('ChIPQC')
Tell the agent what to do: - "Compute the full ENCODE QC battery (FRiP, NSC, RSC, NRF, PBC1, PBC2, fingerprint) for chip.bam vs input.bam" - "Run phantompeakqualtools and interpret NSC/RSC against ENCODE thresholds for an H3K4me3 sample" - "Generate a fragment-size distribution to check for over-sonication" - "Check whether my peaks are concentrated at hyper-ChIPable regions (rRNA, tRNA, mtDNA, histone clusters)" - "Run IDR on rep1 and rep2 narrowPeak files with ENCODE Nself/Nt consistency rule" - "Compute replicate Spearman correlation across 3 H3K27me3 replicates" - "Generate a ChIPQC R report for 6 samples in a sample sheet"
"Run the full ENCODE QC battery: FRiP, NSC/RSC via phantompeakqualtools, NRF/PBC1/PBC2, deepTools plotFingerprint JS distance and AUC, and replicate Spearman correlation. Grade each metric against ENCODE thresholds."
"I have ChIP-seq from WT and KO cells with the same antibody. Compute FRiP and signal at known target loci to verify antibody specificity (KO should drop to background)."
"Extract the fragment-size distribution from properly-paired reads and tell me whether the chromatin was over-sonicated."
"Build a custom cell-type-specific blacklist from the top 1% input signal and intersect my peaks against it to flag suspicious calls at hyper-ChIPable loci."
"Run IDR at threshold 0.05 on true replicates and at threshold 0.10 on pseudoreplicates. Apply the ENCODE Nself/Nt rule (both ratios must be ≤ 2) and tell me whether the library passes."
"Generate a plotFingerprint curve for ChIP vs Input and interpret AUC, JS distance, and synthetic JS against the appropriate threshold for an H3K27me3 broad mark."
"My NSC is 1.02 but FRiP is 8%. What's going on and should I trust these peaks?"
bedtools intersect reads-in-peaks / total mappedRscript run_spp.R (phantompeakqualtools)plotFingerprint --outQualityMetricsmultiBamSummary + plotCorrelationThe agent applies the following operational rules:
| Condition | Action |
|---|---|
| Antibody unvalidated AND no KO/KD control AND no peptide-array data | Flag; request validation before trusting metrics |
| Fragment-size distribution flat or 100-1000 bp continuum | Reject; over-sonication unrecoverable |
| FRiP < 1% (TF) or < 5% (histone) | Reject or re-do ChIP; metric implies antibody / IP failure |
| NSC < 1.05 OR RSC < 0.8 (TF) | Caution; check fragment length consistency; for broad histones may be acceptable with strong FRiP |
| NRF < 0.5 OR PBC1 < 0.5 | Severe PCR bottleneck; re-do library or accept reduced statistical power |
| Replicate Spearman < 0.6 (narrow), < 0.4 (broad) | Reject pair; check sample swap or batch effect |
| Nself/Nt ratio > 2 in either direction | Reject library per ENCODE rule |
| FRiP excellent but signal concentrated at rRNA/mtDNA/HIST clusters | Build custom blacklist; recompute on filtered peaks |
| All metrics pass + replicates concordant | Proceed to peak calling and downstream analysis |
-p 1e-2 calls for consistent FRiP reporting.samtools view -s) for consistent NSC/RSC across replicates of different depth.The single most common ChIP failure mode. Causes in order of frequency: 1. Antibody specificity / lot issue -> re-validate with KO/KD 2. IP efficiency low -> check IP-Western 3. Fragment size wrong -> check sonication, library prep 4. Sequencing depth too shallow -> typically need ≥ 20M unique mapped 5. Hyper-ChIPable artifact dominance -> build custom blacklist and recompute
Increasing sequencing depth on a failed-FRiP sample does not fix the underlying issue.
Cross-correlation reflects strand-shift enrichment. Causes:
1. Weak ChIP signal -> check FRiP
2. Wrong fragment length estimate -> check _cc.pdf plot for clear peak
3. Phantom peak dominates (high signal at read length) -> bad library
4. phantompeakqualtools R compatibility issue -> use kundajelab fork
For broad histone marks (H3K27me3, H3K9me3), NSC marginal at 1.05 with strong FRiP > 15% is acceptable.
Causes: 1. Sample swap -> verify with sequencing index, library prep batch records 2. Batch effect -> check date of IP, library prep, sequencer 3. Biological variability -> expected for some cell states (differentiation time course) 4. One bad replicate -> check per-rep FRiP / NSC; drop and repeat
Do NOT average across replicates to fix poor concordance.
-k8,8nr (p-value descending)