R: Counting nucleotides in 'bamAlign' and 'bamRange'

countNucs {rbamtools} | R Documentation

## Counting nucleotides in `bamAlign` and `bamRange`

### Description

The function counts occurrence of the Nucleotides A,C,G,T in `bamAlign` and `bamRange` objects. Any other values will be combined counted in the last value (N). The function returns an integer vector of length 5. The names indicate which position contains the count value each nucleotide.

### Usage

    countNucs(object)

### Arguments

`object` | `bamAlign` or `bamRange` object.

### Value

Integer (of length 4).

### Author(s)

Wolfgang Kaisers

### Examples

    # A) For bamAlign
    align<-bamAlign("HWUSI-0001","ACCGGGTTTT","Qual/Strng","4M10N6M",refid=0,position=100)
    countNucs(align)

    # B) For bamRange
    bam<-system.file("extdata","accepted_hits.bam",package="rbamtools")
    reader<-bamReader(bam,idx=TRUE)
    coords<-c(0,0,14730)
    range<-bamRange(reader,coords)
    countNucs(range)

[Package rbamtools version 2.16.17 Index]