Learn R Programming

rbamtools (version 2.16.17)

bamCountAll: bamCountAll

Description

The bamCountAll function takes a bamReader object and returns a data.frame. The data.frame contains the counts for all contained reference sequences. Because align numbers are counted for all reference sequences separately, the function needs to load a BAM index file.

Usage

bamCountAll(object,verbose=FALSE)

Arguments

object

An instance of bamReader. Must be opened and contain initialized index.

verbose

Logical. Determines the amount of textual output during runtime.

Details

The method returns a data.frame. Each row contains count data for one reference sequence. Each column contains the counts for one CIGAR-OP type ("M", "I","N","S","H","P","=","X"). Columns with the total number of aligns, the refid (ID) and the length of the reference sequence (LN), as retrieved by 'getRefData' are added.

Examples

Run this code
# NOT RUN {
library(rbamtools)
bam <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
reader<-bamReader(bam,idx=TRUE)
count<-bamCountAll(reader,verbose=TRUE)
count
bamClose(reader)
# }

Run the code above in your browser using DataLab