Learn R Programming

rbamtools (version 2.4.0)

rbamtools-package: Reading, writing and manipulating BAM-file format.

Description

BAM is Binary (Sequence) Alignment/Map format. Many sequence alignment products which align Second Generation Sequence reads to a Sequence reference (such as the human genome) use BAM-file format as output. Analysis of results of a sequence alignment requires reading and interpreting BAM-files and sometimes manipulating BAM-files. The rbamtools package provides a R-interface to the samtools C-library by Heng Li.

Arguments

Details

ll{ Package: rbamtools Type: Package Version: 2.0 Date: 2012-02-03 License: Artistic 2.0 + MIT License (see LICENSE in src/samtools subdirectory) LazyLoad: yes Depends: methods }

The package is organized in S4 classes. Four classes represent the data and organize the defined functionality: ll{ bamReader Reading aligns from a BAM-file bamAlign Single BAM alignment (including Data accessor functions) bamRange (Linked-) List container for BAM alignments bamWriter Writing alings to a BAM-file gapList (Linked-) List container for alignment gaps. }

References

The SAM Format Specification (v1.4-r985). The SAM Format Specification Working Group. September 7, 2011. http://www.samtools.sourceforge.net/SAM1.pdf

Li H.*, Handsaker B.*, Wysoker A., Fennell T., Ruan J., Homer N., Marth G., Abecasis G., Durbin R. and 1000 Genome Project Data Processing Subgroup (2009) The Sequence alignment/map (SAM) format and SAMtools. Bioinformatics, 25, 2078-9.

Examples

Run this code
library(rbamtools)
bam <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
idx <- system.file("extdata", "accepted_hits.bam.bai", package="rbamtools")
reader<-bamReader(bam)
isOpen(reader)
align<-getNextAlign(reader)
load.index(reader,idx)
index.initialized(reader)
coords<-as.integer(c(0,0,249250621))
range<-bamRange(reader,coords)
align<-getNextAlign(range)
bamClose(reader)

Run the code above in your browser using DataLab