getCoverage {gmoviz} | R Documentation |
Uses RSamtools to import coverage data from .bam file and format it appropriately for plotting with gmoviz.
getCoverage(regions_of_interest, bam_file, window_size = 1, smoothing_window_size = NULL)
regions_of_interest |
either a GRanges of regions OR a character vector of sequences/chromosomes to find the coverage for (please be careful that the names here match the spelling/format of those in the bam file). |
bam_file |
Location of the bam file from which to read coverage data. |
window_size |
The size of the window to for calculating coverage
(default is 1; per base coverage). Use |
smoothing_window_size |
If supplied, then moving average smoothing will
be applied using the |
A GRanges containing the coverage data in the metadata column 'coverage'.
The gmovizInitialise
,
drawLinegraphTrack
, insertionDiagram
and
featureDiagram
functions which can plot the coverage data.
## the example .bam file path <- system.file('extdata', 'ex1.bam', package='Rsamtools') ## example without smoothing or windowing getCoverage(regions_of_interest='seq1', bam_file=path) ## using windowing getCoverage(regions_of_interest='seq1', bam_file=path, window_size=5) ## using smoothing getCoverage(regions_of_interest='seq1', bam_file=path, smoothing_window_size=3) ## specifying only a particular region to read in using GRanges small_range <- GRanges('seq1', IRanges(0, 500)) getCoverage(regions_of_interest=small_range, bam_file=path) ## please be very careful that the sequence names are spelled exactly like ## in the bam file or you'll get an error! The following WON'T WORK. ## Not run: getCoverage(regions_of_interest='chr1', bam_file=path) ## End(Not run)