Trait rust_htslib::bam::Read
source · pub trait Read: Sized {
fn read(&mut self, record: &mut Record) -> Result<(), ReadError>;
fn records(&mut self) -> Records<'_, Self> ⓘ;
fn pileup(&mut self) -> Pileups<'_, Self> ⓘ;
fn bgzf(&self) -> *mut BGZF;
fn header(&self) -> &HeaderView;
fn seek(&mut self, offset: i64) -> Result<(), SeekError> { ... }
fn tell(&self) -> i64 { ... }
fn set_threads(&mut self, n_threads: usize) -> Result<(), ThreadingError> { ... }
}
Expand description
A trait for a BAM reader with a read method.
Required Methods§
sourcefn read(&mut self, record: &mut Record) -> Result<(), ReadError>
fn read(&mut self, record: &mut Record) -> Result<(), ReadError>
Read next BAM record into given record. Use this method in combination with a single allocated record to avoid the reallocations occurring with the iterator.
Arguments
record
- the record to be filled
sourcefn records(&mut self) -> Records<'_, Self> ⓘ
fn records(&mut self) -> Records<'_, Self> ⓘ
Iterator over the records of the seeked region.
Note that, while being convenient, this is less efficient than pre-allocating a
Record
and reading into it with the read
method, since every iteration involves
the allocation of a new Record
.
sourcefn header(&self) -> &HeaderView
fn header(&self) -> &HeaderView
Return the header.
Provided Methods§
sourcefn seek(&mut self, offset: i64) -> Result<(), SeekError>
fn seek(&mut self, offset: i64) -> Result<(), SeekError>
Seek to the given virtual offset in the file
sourcefn set_threads(&mut self, n_threads: usize) -> Result<(), ThreadingError>
fn set_threads(&mut self, n_threads: usize) -> Result<(), ThreadingError>
Activate multi-threaded BAM read support in htslib. This should permit faster reading of large BAM files.
Setting nthreads
to 0
does not change the current state. Note that it is not
possible to set the number of background threads below 1
once it has been set.
Arguments
n_threads
- number of extra background writer threads to use, must be> 0
.