LazyNucleotideSequences

Struct LazyNucleotideSequences 

Source
pub struct LazyNucleotideSequences { /* private fields */ }
Expand description

A lazy-loaded set of nucleotide sequences based on indexed FASTA files

Implementations§

Source§

impl LazyNucleotideSequences

Source

pub fn new( filepath: impl Into<PathBuf>, seqnames: Option<Vec<String>>, ) -> Result<Self, GRangesError>

Create a new LazyNucleotideSequences, which can lazyily retrieve regions and whole sequences from an indexed FASTA file.

§Arguments
  • filepath - the path to the bgzipped and indexed FASTA file.
  • seqnames - optional vector of sequences to consider (i.e. used for iterators over sequences).
Source

pub fn is_empty(&self) -> bool

Check of the lazy-loading cache is empty.

Source

pub fn clear(&self)

Clear the lazy-loading cache.

Source

pub fn seqlens(&self) -> IndexMap<String, Position>

Get an IndexMap of the sequence names and their lengths.

Source

pub fn is_loaded(&self, key: &str) -> bool

Return a bool indicating whether the specified key is cached.

§Arguments
  • key: a &str key passed to the loader function.

Trait Implementations§

Source§

impl Debug for LazyNucleotideSequences

Source§

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

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

impl Sequences for LazyNucleotideSequences

Source§

fn seqnames(&self) -> Vec<String>

Retrieve all sequence names.

Source§

fn get_sequence( &self, seqname: &str, ) -> Result<Self::Container<'_>, GRangesError>

Retrieve the Nucleotides for a particular sequence name.

Source§

fn region_map<V, F>( &self, func: &F, seqname: &str, start: Position, end: Position, ) -> Result<V, GRangesError>
where F: for<'b> Fn(&'b [u8]) -> V,

Apply an arbitrary function to the specified region.

§Arguments
  • func: a function that takes Bytes and processes them, returning a generic type V.
  • seqname: the sequence name of the region to apply the function to.
  • start: the start position of the region to apply the function to.
  • end: the end position of the region to apply the function to.
Source§

fn get_sequence_length(&self, seqname: &str) -> Result<Position, GRangesError>

Get the length of a particular sequence.

Source§

type Container<'a> = Ref<'a, Nucleotides>

Source§

type Slice<'a> = &'a [u8]

Source§

fn seqlens(&self) -> Result<IndexMap<String, Position>, GRangesError>

Source§

fn region_map_into_granges<'b, C, F, V, T: 'b>( &self, granges: &'b impl AsGRangesRef<'b, C, T>, func: &F, ) -> Result<GRanges<VecRangesIndexed, Vec<V>>, GRangesError>
where V: Clone, C: IterableRangeContainer + 'b, F: Fn(<Self as Sequences>::Slice<'_>) -> V,

Create a new GRanges<C, Vec<V>> by apply the function func on the genomic ranges from granges. Read more

Auto Trait Implementations§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V