track.bam-class {Rgb}R Documentation

Class "track.bam"

Description

"track.bam" is a drawing wraper for Binary Alignment Map files (SAMtools).

Notice the data are not stored directly in the object, but stay in the original BAM file, thus exported track.bam objects may be broken (the check method can confirm this).

Objects are produced by the track.bam constructor.

Extends

Class sliceable, directly.
Class drawable, by class sliceable, distance 2.

All reference classes extend and inherit methods from envRefClass.

Fields

addChr:

Single logical value, whether to automatically add 'chr' ahead chromosome names when querying or not..

assembly:

Single character value, the assembly version for the coordinates stored in the object. Must have length 1, should not be NA.

baiPath:

Single character value, the full path to the BAI index file in use.

bamPath:

Single character value, the full path to the BAM file in use.

compression:

Single numeric value, an estimation of the BAM file compression ratio.

header:

A data.frame describing the @SQ elements of the BAM header (one per row).

index:

The parsed content of the BAI index, as a unamed list with one element by reference sequence, itself a list with 'bins' and 'intervals' elements. 'bins' is a named list of two-column matrices ('start' and 'end'), giving virtual BGZF coordinates of the described bin (as double). 'intervals' is a double vector of virtual BGZF coordinates, used for linear filtering (see SAM specification for further details).

organism:

Single character value, the name of the organism whose data is stored in the object. Must have length 1, should not be NA.

The following fields are inherited (from the corresponding class):

Methods

coverage(chrom, start = , end = , tracks = , binLevel = , rawSize = ):

Fast estimation of depth coverage in a genomic window, from indexing data. Values are normalized into [0:1] over the genomic window.
- chrom : single integer, numeric or character value, the chromosomal location.
- start : single integer or numeric value, inferior boundary of the window. If NA, the whole chromosome is considered.
- end : single integer or numeric value, superior boundary of the window. If NA, the whole chromosome is considered.
- tracks : single logical value, whether to return a data.frame or a track.table.
- binLevel : single integer value, the higher bin order to allow
0 = 537Mb, 1 = 67Mb, 2 = 8Mb, 3 = 1Mb, 4 = 130kb, 5 = 16kb
incrementing this value enhances boundary precision but discards reads located at bin junctions.
- rawSize : single logical value, whether to output raw size or normalize by the maximum encountered.

crawl(chrom, start, end, addChr = , maxRange = , maxRangeWarn = , verbosity = , ..., init, loop, final):

Apply a custom processing to reads in a genomic window (used by 'depth', 'extract' and 'pileup' methods).
- chrom : single integer, numeric or character value, the chromosomal location. NA is not handled.
- start : single integer or numeric value, inferior boundary of the window. NA is not handled.
- end : single integer or numeric value, superior boundary of the window. NA is not handled.
- addChr : single logical value, whether to systematically add 'chr' in front of the 'chrom' value or not.
- maxRange : single integer value, no extraction will be attempted if end and start are more than this value away (returns NULL).
- maxRangeWarn : single logical value, whether to throw a warning when 'maxRange' is exceeded and NULL is returned or not.
- verbosity : single integer value, the level of verbosity during processing (0, 1 or 2).
- ... : arguments to be passed to 'init', 'loop' or 'final'.
- init : a function taking a single storage environment as argument, to be evaluated before looping on reads for initialization.
This environment has R 'base' environment as parent and contains :
* all arguments passed to crawl()
* a 'self' reference to the current object.
* 'earlyBreak', a single logical value forcing crawl() to return immediately if set to TRUE.
* 'output', a place-holder for the variable to be returned by crawl().
* 'totalReads', the number of matching reads seen since the beginning of the whole looping process.
* 'blockReads', the number of matching reads seen since the beginning of the current BGZF block.
The 'init', 'loop' and 'final' functions defined by the user can freely store additionnal variables in this environment to share them.
- loop : a function taking a list-shapped read and the storage environment, to be evaluated for each read with matching coordinates.
- final : a function taking the storage environment as argument, to be evaluated once all reads were processed for finalization.

depth(..., qBase = , qMap = ):

Counts covering bases for each genomic position, similarly to SAMtools' depth.
- ... : arguments to be passed to the crawl() method.
- qBase : single integer value, minimal base quality for a base to be counted.
- qMap : single integer value, minimal mapping quality for a base to be counted.

extract(...):

Extract reads as a list, similarly to SAMtools' view.
- ... : arguments to be passed to the crawl() method.

getBlocks(limit = , quiet = ):

Jump from BGZF blocks to blocks, recording compressed (bsize) and uncompressed (isize) block sizes
- limit : single integer value, the amount of blocks to evaluate (NA for the whole BAM file, may be very time consuming).
- quiet : single logical value, whether to throw diagnostic messages or not.

getCompression(sample = ):

Estimate BGZF block compression level from a sample of blocks
- sample : single integer value, the amount of blocks to use for estimation (the first block is ignored).

pileup(..., qBase = , qMap = ):

Counts each nucleotide type for each genomic position, similarly to SAMtools' mpileup.
- ... : arguments to be passed to the crawl() method.
- qBase : single integer value, minimal base quality for a base to be counted.
- qMap : single integer value, minimal mapping quality for a base to be counted.

summary(chrom = , tracks = , binLevel = , rawSize = ):

Fast estimation of depth coverage for the whole genome, from indexing data. Values are normalized into [0:1] over the whole genome.
- chrom : character vector, the names of the chromosome to query. If NA, all chromosomes will be queried.
- tracks : single logical value, whether to return a data.frame or a track.table.
- binLevel : single integer value, the higher bin order to allow
0 = 537Mb, 1 = 67Mb, 2 = 8Mb, 3 = 1Mb, 4 = 130kb, 5 = 16kb
incrementing this value enhances boundary precision but discards reads located at bin junctions
- rawSize : single logical value, whether to output raw size or normalize by the maximum encountered.

The following methods are inherited (from the corresponding class):

Author(s)

Sylvain Mareschal

References

http://samtools.github.io/hts-specs/SAMv1.pdf

See Also

track.table, sliceable-class, drawable-class


[Package Rgb version 1.7.5 Index]