ChIP-seq with Bioconductor in R
Peter Humburg
Statistician, Macquarie University


โหลดข้อมูล:
reads <- readGAlignments(bam)
reads_gr <- granges(reads[[1]])
หาความยาวเฉลี่ยของ fragment:
frag_length <- fragmentlength(qc_report)["GSM1598218"]
ขยาย reads และคำนวณ coverage:
reads_ext <- resize(reads_gr, width=frag_length)
cover_ext <- coverage(reads_ext)

สร้าง bins ขนาด 200 bp ตลอดจีโนม
bins <- tileGenome(seqinfo(reads), tilewidth=200,
cut.last.tile.in.chrom=TRUE)
หา bins ทั้งหมดที่ซ้อนทับกับ peaks
peak_bins_overlap <- findOverlaps(bins, peaks)
peak_bins <- bins[from(peak_bins_overlap), ]
นับจำนวน reads ที่ซ้อนทับกับแต่ละ peak bin
peak_bins$score <- countOverlaps(peak_bins, reads)
count_bins <- function(reads, target, bins){
# Find all bins overlapping peaks
overlap <- from(findOverlaps(bins, target))
target_bins <- bins[overlap, ]
# Count the number of reads overlapping each peak bin
target_bins$score <- countOverlaps(target_bins, reads)
target_bins
}
peak_bins <- count_bins(reads_ext, peaks, bins)
bl_bins <- count_bins(reads_ext, blacklist.hg19, bins)
ลบ bins ที่นับแล้วออกทั้งหมด
bkg_bins <- subset(bins, !bins %in% peak_bins & !bins %in% bl_bins)
นับจำนวน reads ที่ซ้อนทับกับแต่ละ bin ที่เหลือ
bkg_bins$score <- countOverlaps(bkg_bins, reads_ext)



ChIP-seq with Bioconductor in R