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

SRR1782620.72657690chr20 29803915051M0 0AATGAAATGGAA ...CCCFFFFFHHHH ...Rsamtools package to interact with BAM files.Rsamtools provides functions for indexing, reading, filtering and writing of BAM files.Use readGAlignments to import mapped reads.
library(GenomicAlignments)
reads <- readGAlignments(bam_file)
Returns GAlignments object.
BamViews to define regions of interest.library(GenomicRanges)
library(Rsamtools)
ranges <- GRanges(...)
views <- BamViews(bam_file, bamRanges=ranges)
reads <- readGAlignments(views)
The BamViews function supports multiple BAM files.
Use import.bed to load peak calls from a BED file.
library(rtracklayer)
peaks <- import.bed(peak_bed, genome="hg19")
Use peaks to define views into the BAM files.
bams <- BamViews(bam_file, bamRanges=peaks)
reads <- readGAlignments(bams)
ChIP-seq with Bioconductor in R