Skip to main content

Alignment

Struct Alignment 

Source
pub struct Alignment<Kind> {
    pub sequence_data: Vec<u8>,
    pub rows: usize,
    pub cols: usize,
    pub ids: Vec<String>,
    pub id_to_index: HashMap<String, usize>,
    pub _marker: PhantomData<Kind>,
}

Fields§

§sequence_data: Vec<u8>§rows: usize§cols: usize§ids: Vec<String>§id_to_index: HashMap<String, usize>§_marker: PhantomData<Kind>

Implementations§

Source§

impl<Kind> Alignment<Kind>

Source

pub fn new(sequence_data: Vec<u8>, rows: usize, ids: Vec<String>) -> Self

Source

pub fn get_row_by_id(&self, id: &str) -> Option<&[u8]>

Source

pub fn remove_columns(&mut self, start: usize, end: usize)

Source

pub fn remove_row_by_number(&mut self, row_idx: usize)

Source

pub fn remove_row_by_id(&mut self, id: &str)

Source

pub fn column_counts(&self, col_idx: usize) -> HashMap<u8, usize>

Source

pub fn all_column_counts(&self) -> Vec<HashMap<u8, usize>>

Source

pub fn is_gap_heavy(&self, col_idx: usize, cutoff: f32) -> bool

Source

pub fn identify_gappy_columns(&self, cutoff: f32) -> Vec<usize>

Source

pub fn purge_gappy_columns(&mut self, cutoff: f32)

Source

pub fn display( &self, row_range: Option<Range<usize>>, col_range: Option<Range<usize>>, ) -> Result<()>

Source

pub fn display_interleaved( &self, row_range: Option<Range<usize>>, col_range: Option<Range<usize>>, block_width: usize, ) -> Result<()>

Source

pub fn subset(&self, rows: Range<usize>, cols: Range<usize>) -> Self

Source

pub fn write_fasta_part<P: AsRef<Path>>( &self, path: P, row_range: Option<Range<usize>>, col_range: Option<Range<usize>>, wrap: Option<usize>, ) -> Result<()>

Source

pub fn write_fasta<P: AsRef<Path>>( &self, path: P, wrap: Option<usize>, ) -> Result<()>

Source§

impl Alignment<DNA>

Source

pub fn gc_content_at_col(&self, col_idx: usize) -> f32

Source

pub fn most_frequent_base(&self, column: &[u8]) -> char

Source

pub fn consensus_sequence(&self) -> String

Source

pub fn is_degenerate_site(&self, col_idx: usize, threshold: f32) -> bool

Source§

impl Alignment<Protein>

Source

pub fn calculate_shannon_entropy(&self, column: &[u8]) -> f32

Source

pub fn column_entropy(&self) -> Vec<f32>

Source

pub fn rare_residues_at_site(&self, col_idx: usize) -> Vec<u8> ⓘ

Source§

impl<Kind> Alignment<Kind>

Source

pub fn iter_cols(&self) -> ColumnIterator<'_, Kind> ⓘ

Trait Implementations§

Source§

impl<Kind: Debug> Debug for Alignment<Kind>

Source§

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

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

impl<Kind: PartialEq> PartialEq for Alignment<Kind>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<Kind: PartialEq> StructuralPartialEq for Alignment<Kind>

Auto Trait Implementations§

§

impl<Kind> Freeze for Alignment<Kind>
where PhantomData<Kind>: Freeze,

§

impl<Kind> RefUnwindSafe for Alignment<Kind>

§

impl<Kind> Send for Alignment<Kind>
where PhantomData<Kind>: Send,

§

impl<Kind> Sync for Alignment<Kind>
where PhantomData<Kind>: Sync,

§

impl<Kind> Unpin for Alignment<Kind>
where PhantomData<Kind>: Unpin,

§

impl<Kind> UnsafeUnpin for Alignment<Kind>
where PhantomData<Kind>: UnsafeUnpin,

§

impl<Kind> UnwindSafe for Alignment<Kind>
where PhantomData<Kind>: 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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