Struct rust_htslib::faidx::Reader

source ·
pub struct Reader { /* private fields */ }
Expand description

A Fasta reader.

Implementations§

source§

impl Reader

source

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, Error>

Create a new Reader from a path.

§Arguments
  • path - the path to open.
source

pub fn from_url(url: &Url) -> Result<Self, Error>

Create a new Reader from an URL.

§Arguments
  • url - the url to open
source

pub fn fetch_seq<N: AsRef<str>>( &self, name: N, begin: usize, end: usize ) -> Result<&[u8]>

Fetch the sequence as a byte array.

§Arguments
  • name - the name of the template sequence (e.g., “chr1”)
  • begin - the offset within the template sequence (starting with 0)
  • end - the end position to return (if smaller than begin, the behavior is undefined).
source

pub fn fetch_seq_string<N: AsRef<str>>( &self, name: N, begin: usize, end: usize ) -> Result<String>

Fetches the sequence and returns it as string.

§Arguments
  • name - the name of the template sequence (e.g., “chr1”)
  • begin - the offset within the template sequence (starting with 0)
  • end - the end position to return (if smaller than begin, the behavior is undefined).
source

pub fn n_seqs(&self) -> u64

Fetches the number of sequences in the fai index

source

pub fn seq_name(&self, i: i32) -> Result<String>

Fetches the i-th sequence name

§Arguments
  • i - index to query
source

pub fn fetch_seq_len<N: AsRef<str>>(&self, name: N) -> u64

Fetches the length of the given sequence name.

§Arguments
  • name - the name of the template sequence (e.g., “chr1”)

Trait Implementations§

source§

impl Debug for Reader

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Reader

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Reader

§

impl !Send for Reader

§

impl !Sync for Reader

§

impl Unpin for Reader

§

impl UnwindSafe for Reader

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>,

§

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>,

§

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.