[−][src]Struct rust_htslib::bam::IndexedReader
Implementations
impl IndexedReader
[src]
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
[src]
pub fn from_path_and_index<P: AsRef<Path>>(
path: P,
index_path: P
) -> Result<Self>
[src]
path: P,
index_path: P
) -> Result<Self>
pub fn from_url(url: &Url) -> Result<Self>
[src]
pub fn fetch<'a, T: Into<FetchDefinition<'a>>>(
&mut self,
fetch_definition: T
) -> Result<()>
[src]
&mut self,
fetch_definition: T
) -> Result<()>
Define the region from which .read() or .records will retrieve reads.
Both iterating (with .records()) and looping without allocation (with .read() are a two stage process:
- 'fetch' the region of interest
- iter/loop trough the reads.
Example:
use rust_htslib::bam::{IndexedReader, Read}; let mut bam = IndexedReader::from_path(&"test/test.bam").unwrap(); bam.fetch(("chrX", 10000, 20000)); // coordinates 10000..20000 on reference named "chrX" for read in bam.records() { println!("read name: {:?}", read.unwrap().qname()); }
The arguments may be anything that can be converted into a FetchDefinition such as
- fetch(tid: u32) -> fetch everything on this reference
- fetch(reference_name: &u8 | &str) -> fetch everything on this reference
- fetch((tid: i32, start: i64, stop: i64)): -> fetch in this region on this tid
- fetch((reference_name: &u8 | &str, start: i64, stop: i64) -> fetch in this region on this tid
- fetch(FetchDefinition::All) or fetch(".") -> Fetch overything
- fetch(FetchDefinition::Unmapped) or fetch("*") -> Fetch unmapped (as signified by the 'unmapped' flag in the BAM - might be unreliable with some aligners.
The start / stop coordinates will take i64 (the correct type as of htslib's 'large coordinates' expansion), i32, u32, and u64 (with a possible panic! if the coordinate won't fit an i64).
This replaces the old fetch and fetch_str implementations.
pub fn set_reference<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
Trait Implementations
impl Debug for IndexedReader
[src]
impl Drop for IndexedReader
[src]
impl Read for IndexedReader
[src]
pub fn read(&mut self, record: &mut Record) -> Option<Result<()>>
[src]
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 IndexedReader
[src]
Auto Trait Implementations
impl !RefUnwindSafe for IndexedReader
[src]
impl !Sync for IndexedReader
[src]
impl Unpin for IndexedReader
[src]
impl !UnwindSafe for IndexedReader
[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>,