Struct EncodedSequence

Source
pub struct EncodedSequence<A: Alphabet> { /* private fields */ }
Expand description

A biological sequence encoded with an alphabet.

Implementations§

Source§

impl<A: Alphabet> EncodedSequence<A>

Source

pub fn new(data: Vec<A::Symbol>) -> Self

Create a new encoded sequence.

Source

pub fn encode<S: AsRef<[u8]>>(sequence: S) -> Result<Self, InvalidSymbol>

Create a new encoded sequence from a textual representation.

§Note

Uses platform-accelerated implementation when available.

Source

pub fn sample<R: Rng>(rng: R, background: Background<A>, length: usize) -> Self

Sample a new random sequence from the given background frequencies.

Source

pub fn len(&self) -> usize

Return the number of symbols in the sequence.

Source

pub fn is_empty(&self) -> bool

Check whether the sequence is empty.

Source

pub fn iter(&self) -> <&[A::Symbol] as IntoIterator>::IntoIter

Iterate over the symbols in the sequence.

Source

pub fn to_striped<C>(&self) -> StripedSequence<A, C>

Convert the encoded sequence to a striped matrix.

§Note

Uses platform-accelerated implementation when available.

Trait Implementations§

Source§

impl<A: Alphabet> AsRef<[<A as Alphabet>::Symbol]> for EncodedSequence<A>

Source§

fn as_ref(&self) -> &[A::Symbol]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: Alphabet> AsRef<EncodedSequence<A>> for EncodedSequence<A>

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: Clone + Alphabet> Clone for EncodedSequence<A>
where A::Symbol: Clone,

Source§

fn clone(&self) -> EncodedSequence<A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug + Alphabet> Debug for EncodedSequence<A>
where A::Symbol: Debug,

Source§

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

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

impl<A: Alphabet> Default for EncodedSequence<A>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<A: Alphabet> Display for EncodedSequence<A>

Source§

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

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

impl<A: Alphabet, C: PositiveLength> From<EncodedSequence<A>> for StripedSequence<A, C>
where Pipeline<A, Dispatch>: Stripe<A, C>,

Source§

fn from(encoded: EncodedSequence<A>) -> Self

Converts to this type from the input type.
Source§

impl<A: Alphabet> From<Vec<<A as Alphabet>::Symbol>> for EncodedSequence<A>

Source§

fn from(data: Vec<A::Symbol>) -> Self

Converts to this type from the input type.
Source§

impl<A: Alphabet> FromIterator<<A as Alphabet>::Symbol> for EncodedSequence<A>

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = A::Symbol>,

Creates a value from an iterator. Read more
Source§

impl<A: Alphabet> FromIterator<EncodedSequence<A>> for Result<CountMatrix<A>, InvalidData>

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = EncodedSequence<A>>,

Creates a value from an iterator. Read more
Source§

impl<A: Alphabet> FromStr for EncodedSequence<A>

Source§

type Err = InvalidSymbol

The associated error which can be returned from parsing.
Source§

fn from_str(seq: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<A: Alphabet> Index<usize> for EncodedSequence<A>

Source§

type Output = <A as Alphabet>::Symbol

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, A: Alphabet> IntoIterator for &'a EncodedSequence<A>

Source§

type Item = &'a <A as Alphabet>::Symbol

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, <A as Alphabet>::Symbol>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<A, S> PartialEq<S> for EncodedSequence<A>
where A: Alphabet, S: AsRef<[<A as Alphabet>::Symbol]>,

Source§

fn eq(&self, other: &S) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A: Alphabet> SymbolCount<A> for EncodedSequence<A>

Source§

fn count_symbol(&self, symbol: <A as Alphabet>::Symbol) -> usize

Source§

fn count_symbols(&self) -> GenericArray<usize, A::K>

Auto Trait Implementations§

§

impl<A> Freeze for EncodedSequence<A>

§

impl<A> RefUnwindSafe for EncodedSequence<A>

§

impl<A> Send for EncodedSequence<A>
where A: Send, <A as Alphabet>::Symbol: Send,

§

impl<A> Sync for EncodedSequence<A>
where A: Sync, <A as Alphabet>::Symbol: Sync,

§

impl<A> Unpin for EncodedSequence<A>
where A: Unpin, <A as Alphabet>::Symbol: Unpin,

§

impl<A> UnwindSafe for EncodedSequence<A>
where A: UnwindSafe, <A as Alphabet>::Symbol: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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