Reading BAM files
To get started, you'll read mapped reads from a BAM file into R. These files store information about the alignment between read sequences and the reference genome in a compressed binary format. Loading data from BAM files is a common task when analyzing genomic data.
In this exercise, you'll first load all reads from a bam file. This is straightforward but can require a lot of memory, so in the second part, you'll learn how to load only the reads from a region of interest.
This is a part of the course
“ChIP-seq with Bioconductor in R”
Exercise instructions
- Load reads from chr20_bam file using the
readGAlignments()
function. - Create a
BamViews
object for chr20_bam that covers the region 29805000 - 29820000 on chromosome 20. - Use
readGAlignments()
again to load only the reads in that view. - Inspect the
reads_sub
object usingstr()
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Load reads form chr20_bam file
reads <- ___(chr20_bam)
# Create a `BamViews` object for the range 29805000 - 29820000 on chromosome 20
bam_views <- ___(___, bamRanges=GRanges("chr20", IRanges(start=29805000, end=29820000)))
# Load only the reads in that view
reads_sub <- ___(___)
# Inspect the `reads_sub` object
___(reads_sub)
This exercise is part of the course
ChIP-seq with Bioconductor in R
Learn how to analyse and interpret ChIP-seq data with the help of Bioconductor using a human cancer dataset.
Now the ChIP-seq analysis begins in earnest. This chapter introduces Bioconductor tools to import and clean the data.
Exercise 1: Importing dataExercise 2: Reading BAM filesExercise 3: Reading BED filesExercise 4: Taking a closer look at peaksExercise 5: Plotting a region in detailExercise 6: Adding AnnotationsExercise 7: Cleaning ChIP-seq dataExercise 8: Removing blacklisted regionsExercise 9: Filtering readsExercise 10: Compare filtered data to raw readsExercise 11: Assessing enrichmentExercise 12: Computing coverageExercise 13: Peaks vs backgroundWhat is DataCamp?
Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.