bamRange-class | R Documentation |
"bamRange"
bamRange represents a double linked list of bamAlign objects which overlap with a defined region in a BAM-file. The bamRange-function retrieves all alignments in the depicted Range from BAM-File into a bamRange object. A bamRange object maintains a double-linked list of aligns and a pointer to a current align.
rewind shifts the current align before the first align (=past the last align). When there is no align, nothing happens. The functions writeCurrentAlign, insertPreCurrent, insertPastCurrent can be used to write bamAlign data to bamRange object. The function writeCurrentAlign overwrites the data of the current bamRange align. When no current align is set (i.e. ==NULL), nothing is written. The functions insertPreCurrent and insertPastCurrent insert an bamAlign object into the bamRange list. When no current align is set, insertPreCurrent inserts the object as the last object and insertPastCurrent inserts the object as the first align object in the bamRange list.
push_back (push_front) appends a bamAlign before the first (or behind the last) element of bamRange. pop_front (pop_back) removes the first (last) bamAlign from bamRange.
Objects can be created by calls of the form range<-bamRange(reader, coords)
.
range
:External pointer to double linked list of bamAligns.
signature(x = "bamRange")
: Returns data.frame representation of aligns.
signature(from = "bamRange", to = "data.frame")
: Coercion of bamRange to data.frame.
signature(object = "bamRange")
: Saves aligns stored in this list to BAM-file via a bamWriter object.
signature(object = "bamRange")
: Returns next align from current position and shifts current position to next one.
signature(object = "bamRange")
: Returns previous align from current position and shifts current position to previous one.
signature(.Object = "bamRange")
: Initializes bamRange object.
signature(object = "bamRange")
: Inserts align past current position into list.
signature(object = "bamRange")
: Insert align before current position into list.
signature(object = "bamRange")
: Removes last align from list.
signature(object = "bamRange")
: Removes first align from list.
signature(object = "bamRange")
: Adds align at the end of the list.
signature(object = "bamRange")
: Adds align at the front of the list.
signature(object = "bamRange")
: Shifts current align to position before first align.
signature(object = "bamRange")
: Returns number of aligns in list.
signature(object = "bamRange")
: Overwrites current align with given align.
signature(object = "bamRange")
: Returns quality scores of all aligned reads (one for each query-base). Will be reverse of raw if aligned to reverse strand.
signature(object = "bamRange")
: Returns base sequence of all aligned reads. Will be reverse complement of raw if aligned to reverse strand.
signature(object = "bamRange", tag="character")
: Retrieves the value of the given tag as a character vector, with "" if 'tag' not found.
signature(object = "bamRange", sep="character")
: Retrieves the complete descriptors of all tags as a character vector, with with 'sep' inserted between tags.
signature(object = "bamRange")
: Returns quality scores of all raw reads prior to alignment (one for each query-base).
signature(object = "bamRange")
: Returns base sequence of all raw reads prior to alignment.
signature(object = "bamRange")
: Returns all read Identifiers.
signature(object = "bamRange")
: Returns all reference sequence Identifiers.
signature(object = "bamRange")
: Returns all align positions (on Ref-Sequence).
signature(object = "bamRange")
: Gets flag item denoting alignment to the reverse strand.
Wolfgang Kaisers
library(rbamtools)
bam <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
idx<-paste(bam,"bai",sep=".")
# Open BAM file
reader<-bamReader(bam)
# create.index(reader,idx)
# Load BAM index file
load.index(reader,idx)
index.initialized(reader) # Should return 'TRUE'
# +++++++++++++++++++++++++++++++++++++++++++++++
# Find appropriate refid (=ID)
# Returns a data.frame with three columns:
# ID=refid, SN=Sequence Name, LN=Sequence length
rdf<-getRefData(reader)
head(rdf)
# +++++++++++++++++++++++++++++++++++++++++++++++
# The sequence length (LN) also determines valid
# range for start and stop coordinates
# Invalid refid-, start- or stop-coordinates will
# release an error.
# coords: refid=0, start=0, stop=249250621
# +++++++++++++++++++++++++++++++++++++++++++++++
coords<-as.integer(c(0,0,249250621))
range<-bamRange(reader,coords)
size(range)
range<-bamRange(reader,coords,complex=TRUE)
dfr<-as.data.frame(range)
size(range)
align<-getNextAlign(range)
cigarData(align)
rewind(range)
# while(!is.null(align))
# {
# print(position(align))
# align<-getNextAlign(range)
# }
bamClose(reader)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.