In these exercises we will review how we can handle reads in BAM format using the Rsamtools and GAlignments package.
For these exercises we will be using some of the example data available from the BodyMap consortium.
We have already reviewed this data when looking at IGV in an earlier session.
The example data can be found in the data directory
## SortedHeart.bam
## "SortedHeart.bam.bai"
## SortedLiver.bam
## "SortedLiver.bam.bai"
Plot this again, but add a limit to the alignment of 2.5Kb in the plotting.
## Warning: Removed 6 rows containing missing values (geom_point).
Import the read IDs, sequence and qualities from the Heart BAM file
Find the number of unique read IDs and compare to total reads in file.
## [1] 91316
## [1] 132381
## 'select()' returned 1:1 mapping between keys and columns
## [1] 1313
## [1] 1313
## [1] 7426
## [1] 1313
## [1] 1313
## [1] 1313
## [1] 1312
## [1] 7425
## [1] 1306
## [1] 1306
## [1] 7390
## [1] 7156
## [1] 17750
## [1] 7136
## [1] 7260
## [1] 12610
## [1] 12636
## [1] 4635
## [1] 4616
## [1] 25995
## [1] 25832
## [1] 25943
## [1] 25943
## [1] 25963
## [1] 31095
## [1] 13464
## [1] 26107
## [1] 22094
## [1] 22057
## [1] 20306
## [1] 20304
## [1] 44496
## [1] 44516
## [1] 44536
## [1] 44537
## [1] 44834
## [1] 44907
## [1] 46644
## [1] 46644