Learn R Programming

rbamtools (version 2.0.1)

getPrevAlign: Reads previous Align from bamRange.

Description

A bamRange object maintains a pointer to a current align. getPrevAlign shifts the current align to the previous align and then returns the value of the current align. When there is no align before the current align (e.g. first align in list), the getPrevAlign returns NULL.

Usage

getPrevAlign(object)

Arguments

object
An object of class bamReader or bamRange.

Value

  • An object of class bamAlign or NULL.

Examples

Run this code
library(rbamtools)
bam_file <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
idx_file <- system.file("extdata", "accepted_hits.bam.bai", package="rbamtools")
reader<-bamReader(bam_file)
isOpen(reader)
loadIndex(reader,idx_file)
index.initialized(reader)
coords<-as.integer(c(0,0,1874))
range<-bamRange(reader,coords)
align<-getPrevAlign(range)
bamClose(reader)

Run the code above in your browser using DataLab