Skip to main content

IndexedFastaReader

Struct IndexedFastaReader 

Source
pub struct IndexedFastaReader<R> { /* private fields */ }
Expand description

Seekable FASTA reader backed by a .fai index.

Implementations§

Source§

impl<R: Read + Seek> IndexedFastaReader<R>

Source

pub fn new(inner: R, index: FastaIndex) -> Self

Create a seekable FASTA reader from an input stream and index.

Source

pub fn index(&self) -> &FastaIndex

Return the loaded FASTA index.

Source

pub fn fetch_into( &mut self, name: &[u8], range: Range<u64>, out: &mut Vec<u8>, ) -> Result<()>

Fetch a zero-based half-open sequence range into out.

Source

pub fn fetch(&mut self, name: &[u8], range: Range<u64>) -> Result<Vec<u8>>

Fetch a zero-based half-open sequence range into an owned buffer.

Source

pub fn reference_chunks( &mut self, name: &[u8], range: Range<u64>, chunk_bases: u64, ) -> Result<FastaReferenceChunks<'_, R>>

Stream owned sequence chunks for one reference range.

chunk_bases values below 1 are raised to 1. Chunks are yielded as owned buffers so callers can move them to worker threads after each iterator step.

Source

pub fn reference_chunks_into<S>( &mut self, name: &[u8], range: Range<u64>, chunk_bases: u64, out: &mut Vec<u8>, sink: &mut S, ) -> Result<()>

Stream borrowed sequence chunks into a sink using caller-owned storage.

chunk_bases values below 1 are raised to 1. out is cleared and reused for each chunk, and the borrowed chunk passed to sink is valid only until the next sink call or until this method returns.

Source

pub fn fetch_partition( &mut self, partition: &FastaPartition, ) -> Result<FastaReferenceChunk>

Fetch a planned partition into an owned reference chunk.

Source

pub fn into_inner(self) -> (R, FastaIndex)

Return the wrapped reader and index.

Auto Trait Implementations§

§

impl<R> Freeze for IndexedFastaReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for IndexedFastaReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for IndexedFastaReader<R>
where R: Send,

§

impl<R> Sync for IndexedFastaReader<R>
where R: Sync,

§

impl<R> Unpin for IndexedFastaReader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for IndexedFastaReader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for IndexedFastaReader<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.