[−][src]Struct rust_htslib::bam::Reader
A BAM reader.
Implementations
impl Reader
[src]
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
[src]
pub fn from_stdin() -> Result<Self>
[src]
Create a new Reader from STDIN.
pub fn from_url(url: &Url) -> Result<Self>
[src]
Create a new Reader from URL.
pub fn iter_chunk(
&mut self,
start: Option<i64>,
end: Option<i64>
) -> ChunkIterator<'_, Self>ⓘNotable traits for ChunkIterator<'a, R>
impl<'a, R: Read> Iterator for ChunkIterator<'a, R> type Item = Result<Record>;
[src]
&mut self,
start: Option<i64>,
end: Option<i64>
) -> ChunkIterator<'_, Self>ⓘ
Notable traits for ChunkIterator<'a, R>
impl<'a, R: Read> Iterator for ChunkIterator<'a, R> type Item = Result<Record>;
Iterator over the records between the (optional) virtual offsets start
and end
Arguments
-
start
- Optional starting virtual offset to seek to. Throws an error if it is not a valid virtual offset. -
end
- Read until the virtual offset is less thanend
pub fn set_reference<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
Trait Implementations
impl Debug for Reader
[src]
impl Drop for Reader
[src]
impl Read for Reader
[src]
pub fn read(&mut self, record: &mut Record) -> Option<Result<()>>
[src]
Read the next BAM record into the given Record
.
Returns None
if there are no more records.
This method is useful if you want to read records as fast as possible as the
Record
can be reused. A more ergonomic approach is to use the records
iterator.
Errors
If there are any issues with reading the next record an error will be returned.
Examples
use rust_htslib::errors::Error; use rust_htslib::bam::{Read, Reader, Record}; let mut bam = Reader::from_path(&"test/test.bam")?; let mut record = Record::new(); // Print the TID of each record while let Some(r) = bam.read(&mut record) { r.expect("Failed to parse record"); println!("TID: {}", record.tid()) }
pub fn records(&mut self) -> Records<'_, Self>ⓘ
[src]
Iterator over the records of the fetched 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
.
pub fn rc_records(&mut self) -> RcRecords<'_, Self>ⓘ
[src]
pub fn pileup(&mut self) -> Pileups<'_, Self>ⓘ
[src]
pub fn htsfile(&self) -> *mut htsFile
[src]
pub fn header(&self) -> &HeaderView
[src]
pub fn set_thread_pool(&mut self, tpool: &ThreadPool) -> Result<()>
[src]
pub fn seek(&mut self, offset: i64) -> Result<()>
[src]
pub fn tell(&self) -> i64
[src]
pub fn set_threads(&mut self, n_threads: usize) -> Result<()>
[src]
impl Send for Reader
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Reader
[src]
impl !Sync for Reader
[src]
impl Unpin for Reader
[src]
impl !UnwindSafe for Reader
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,