alignmentStats: Get statistics on alignments

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/utilities.R

Description

Get statistics on alignments from bam file or qProjec object.

Usage

1
alignmentStats(x, collapseBySample=TRUE)

Arguments

x

the source of alignment bam files, one of:

  • a character vector with bam files

  • a qProject object

collapseBySample

If TRUE and x is a qProject object, sum counts for bam files with identical sample names.

Details

Internally, alignmentStats queries the bam index files similar to 'idxstats' from samtools. Please note that this does not discriminate for example between primary and secondary alignments. If you need more statistics, see for example quickBamFlagSummary from package Rsamtools.

If x is a qProject object, the auxiliary bam files will not contain any unmapped reads, and the corresponding unmapped counts are calculated by subtracting auxiliary mapped counts from the total reads. The latter correspond to the unmapped counts from the corresponding genome bam files.

Value

A matrix with one row per bam file and three columns ("seqlength", "mapped" and "unmapped").

Author(s)

Anita Lerch, Dimos Gaidatzis and Michael Stadler

See Also

qProject, quickBamFlagSummary from package Rsamtools

Examples

1
2
3
4
5
## Not run: 
    # see qProject manual page for an example
    example(qProject)

## End(Not run)

QuasR documentation built on Nov. 8, 2020, 8:31 p.m.