GRbaseCoverage-methods: Based on a GRanges and a BAM file, returns a list of base...

Description Methods Examples

Description

Based on a GRanges and a BAM file, returns a list of base coverage vectors for each range

Methods

To be used in this form:

GRbaseCoverage(Object, bam, Nnorm=FALSE)

where:

The method determines for each base in each region of the GRanges the number of reads in the BAM file. If Nnorm is TRUE the coverage is divided by million of mapped reads contained in the BAM file. The method returns a list of length equal to the length of the Object GRanges. Each list item is a vector of lenth equal to the length of the corresponding range width. The vector reports the (normalized) base coverage. The bam file has to be associated to the corresponding index .bai file. Please refer to the documentation of samtools on how to create it.

Examples

1
2
3
4
5
bampath <- system.file("extdata", "ex1.bam", package="Rsamtools")
gr <- GRanges(seqnames=Rle(c('seq1','seq2')), 
	ranges=IRanges(start=c(1000, 100), end=c(2000, 1000)))
res <- GRbaseCoverage(Object=gr, bam=bampath)
str(res)

compEpiTools documentation built on Nov. 8, 2020, 5:32 p.m.