## Not run:
# # To build peak profiles you need to store information on our experiment
# # in a sample sheet, for example, "Cfp1.csv". You also need bam files,
# # which contain the mapped reads for your experiment. The path to the
# # bam files should be specified in the csv sample sheet. Lastly you need
# # to specify the regions of interest that you want to examine, i.e. the
# # peaks.
#
#
# # Step 1: For this example we provide bam files, peak files and a sample
# # sheet in the data package MMDiffBamSubset. We create a new DBA file
# # according to the sample sheet "Cfp1.csv":
#
# library('MMDiffBamSubset')
# oldwd <- setwd(system.file("extdata", package="MMDiffBamSubset"))
# Cfp1 <- dba(sampleSheet="Cfp1.csv",
# minOverlap = 3)
#
#
# # Step 2: Specify the regions of interest, i.e. the peaks. For this
# # example we have run the peak finder Macs [Zhang et al. Genome Biol
# # (2008)] on each of the bam file. The xls files containing a subset of
# # the peaks are provided and the path to these files is specified in the
# # "Cfp1.csv" sample sheet. By calling the function dba, we have also
# # generated a list of consensus peaks, which occur in at least
# # minOverlap = 3 samples. Let's take the first 1000 consensus peaks:
#
# Peaks <- dba.peakset(Cfp1, bRetrieve=TRUE)
# Peaks <- Peaks[1:1000]
#
#
# # Step 3: Now, we create peak profiles by reading in the reads that map to the
# # regions specified in Peaks
# Cfp1Profiles <- getPeakProfiles(Cfp1, Peaks, save.files=FALSE)
#
#
# # To view individual peak profiles use the function plotPeak, e.g.:
# plotPeak(Cfp1Profiles, Peak.id=20, NormMethod=NULL)
#
#
# # Alternative to step 2 you could also get read profiles for any other
# # set of regions, for example for these 200 consecutive 100bp regions on
# # chromosome 1:
#
# Peaks2 <- GRanges(seqnames = Rle('chr1'),
# ranges = IRanges(start=seq(3200000, 3219900, 100), width=100))
#
# Cfp1Profiles2 <- getPeakProfiles(Cfp1, Peaks2, save.files=FALSE,
# draw.on=FALSE)
#
# setwd(oldwd)
# ## End(Not run)
Run the code above in your browser using DataLab