Learn R Programming

rbamtools (version 2.16.17)

getQualDf: Read and display Phred qualities from bamRange

Description

getQualDf takes a bamRange and returns a data.frame (128 rows, number of columns=length of the longest sequence in range). getQualDf counts occurrences for every sequence position (column) and every phred value (row). getQualQuantiles takes a bamReader and a vector of quantiles (must be between 0 and 1) and returns a data.frame. The data.frame contains one row for each quantile and also as many columns as the maximum sequence length. plotQualQuant plots the values for quanties 0.1,0.25,0.5,0.75 and 0.9.

Usage

getQualDf(object,prob=FALSE,...)

Arguments

object

bamRange.

prob

logical. When TRUE each column is divided by its sum. The column sums are added as names attribute col.sum

...

(currently unused)

Value

data.frame

Details

Phred values are truncated by 127 (the maximum which can be represented by ASCII values). The function runs down each colum (sequence position) and returns the row index where the quantile exceeds the cumlated column values.

Examples

Run this code
# NOT RUN {
# A) Read bamRange
bam<-system.file("extdata","accepted_hits.bam",package="rbamtools")
reader<-bamReader(bam,idx=TRUE)
coords<-as.integer(c(0,0,249250621))
range<-bamRange(reader,coords)
bamClose(reader)
# B) getQualDf
qdf<-getQualDf(range)
qdf[32:38,1:15]
qdr<-getQualDf(range,prob=TRUE)
# C) getQualQuantiles
quantiles<-c(0.1,0.25,0.5,0.75,0.9)
qt<-getQualQuantiles(range,quantiles)
# D) Plot
plotQualQuant(range)
# }

Run the code above in your browser using DataLab