countByGeneName {spliceSites} | R Documentation

## Reads align number for selected gene from multiple BAM-files.

### Description

Opens multiple BAM-files and reads aligns for selected gene for each file. The function counts the tag-selected value which either is a BAM-cigar operation (like "N" or "M") or the total number of aligns.

### Usage

    countByGeneName(object,infiles,idxInfiles=paste(infiles,".bai",sep=""),gene,tag="N")

### Arguments

`object` | Object of class "refGenome"
`infiles` | Vector of BAM-files
`idxInfiles` | (Optional) Vector of BAM-index files.
`gene` | Gene name
`tag` | Character. Passed to (rbamtools) 'bamCountAll' function. Default value is "N". Other accepted values include "nAligns","M","I","D".

### Details

`countByGeneName` first uses the `extractByGeneName` and `getGenePositions` from 'refGenome' in order to calculate coordinates from the given gene name. Then for each given BAM-file name, the functions calls the `bamCount` function and returns a vector with a count value for each given file. Internally `countByGeneName` also checks for existing BAM-index file and tries to create index files which do not exist.

### Value

Numeric vector. Length equals number of BAM-input files.

### Author(s)

Wolfgang Kaisers

### Examples

    # A) Read filenames
    ucf<-system.file("extdata","uc_small.RData",package="spliceSites")
    uc<-loadGenome(ucf)
    bam<-character(2)
    bam[1]<-system.file("extdata","rna_fem.bam",package="spliceSites")
    bam[2]<-system.file("extdata","rna_mal.bam",package="spliceSites")
    # B) count
    countByGeneName(uc,bam,gene="WASH7P",tag="N")
    countByGeneName(uc,bam,gene="WASH7P",tag="nAligns")

[Package spliceSites version 1.28.0 Index]