[][src]Struct rust_htslib::bam::buffer::RecordBuffer

pub struct RecordBuffer { /* fields omitted */ }

A buffer for BAM records. This allows access regions in a sorted BAM file while iterating over it in a single pass. The buffer is implemented as a ringbuffer, such that extension or movement to the right has linear complexity. The buffer makes use of indexed random access. Hence, when fetching a region at the very end of the BAM, everything before is omitted without cost.

Implementations

impl RecordBuffer[src]

pub fn new(bam: IndexedReader, cache_cigar: bool) -> Self[src]

Create a new RecordBuffer.

Arguments

  • bam - BAM reader
  • cache_cigar - whether to call bam::Record::cache_cigar() for each record.

pub fn set_min_refetch_distance(&mut self, min_refetch_distance: u64)[src]

maximum distance to previous fetch window such that a new fetch operation is performed. If the distance is smaller, buffer will simply read through until the start of the new fetch window (probably saving some time by avoiding the random access).

pub fn fetch(
    &mut self,
    chrom: &[u8],
    start: u64,
    end: u64
) -> Result<(usize, usize)>
[src]

Fill buffer at the given interval. If the start coordinate is left of the previous start coordinate, this will use an additional BAM fetch IO operation. Coordinates are 0-based, and end is exclusive. Returns tuple with numbers of added and deleted records since the previous fetch.

pub fn iter<'a>(&'a self) -> Iter<'a, Rc<Record>>[src]

Iterate over records that have been fetched with fetch.

pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, Rc<Record>>[src]

Iterate over mutable references to records that have been fetched with fetch.

pub fn len(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

Trait Implementations

impl Debug for RecordBuffer[src]

impl Send for RecordBuffer[src]

impl Sync for RecordBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.