rustalign_common/types.rs
1//! Common type definitions
2
3/// Alignment score type
4pub type Score = i32;
5
6/// Strand of a read
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
8pub enum Strand {
9 /// Forward strand
10 #[default]
11 Forward,
12 /// Reverse complement strand
13 Reverse,
14}
15
16impl Strand {
17 /// Flip the strand
18 pub fn flip(&mut self) {
19 *self = match self {
20 Strand::Forward => Strand::Reverse,
21 Strand::Reverse => Strand::Forward,
22 };
23 }
24
25 /// Get flipped strand
26 pub fn flipped(self) -> Strand {
27 match self {
28 Strand::Forward => Strand::Reverse,
29 Strand::Reverse => Strand::Forward,
30 }
31 }
32}