pub struct RnaSecondaryStructure {
pub pairs: Vec<Option<usize>>,
pub length: usize,
}Expand description
An RNA secondary structure as a pair table.
Each position i in the sequence is either paired to some position j
(pairs[i] = Some(j)) or unpaired (pairs[i] = None). Pairs are
non-crossing: if i pairs with j, no pair (p, q) exists with
i < p < j < q.
Fields§
§pairs: Vec<Option<usize>>Pair table: pairs[i] = Some(j) if position i is paired with j.
length: usizeLength of the sequence.
Implementations§
Source§impl RnaSecondaryStructure
impl RnaSecondaryStructure
Sourcepub fn from_dot_bracket(s: &str) -> Result<Self>
pub fn from_dot_bracket(s: &str) -> Result<Self>
Parse a dot-bracket string into a secondary structure.
( and ) denote paired bases; . denotes unpaired bases.
§Errors
Returns an error if parentheses are unbalanced or the string contains
characters other than (, ), and ..
§Example
use cyanea_seq::rna_structure::RnaSecondaryStructure;
let s = RnaSecondaryStructure::from_dot_bracket("(((...)))").unwrap();
assert_eq!(s.num_pairs(), 3);Sourcepub fn to_dot_bracket(&self) -> String
pub fn to_dot_bracket(&self) -> String
Convert this structure to dot-bracket notation.
§Example
use cyanea_seq::rna_structure::RnaSecondaryStructure;
let s = RnaSecondaryStructure::from_dot_bracket("..((..))..").unwrap();
assert_eq!(s.to_dot_bracket(), "..((..))..");Sourcepub fn base_pairs(&self) -> Vec<(usize, usize)>
pub fn base_pairs(&self) -> Vec<(usize, usize)>
Return sorted list of base pairs (i, j) where i < j.
Trait Implementations§
Source§impl Clone for RnaSecondaryStructure
impl Clone for RnaSecondaryStructure
Source§fn clone(&self) -> RnaSecondaryStructure
fn clone(&self) -> RnaSecondaryStructure
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RnaSecondaryStructure
impl Debug for RnaSecondaryStructure
Source§impl PartialEq for RnaSecondaryStructure
impl PartialEq for RnaSecondaryStructure
impl Eq for RnaSecondaryStructure
impl StructuralPartialEq for RnaSecondaryStructure
Auto Trait Implementations§
impl Freeze for RnaSecondaryStructure
impl RefUnwindSafe for RnaSecondaryStructure
impl Send for RnaSecondaryStructure
impl Sync for RnaSecondaryStructure
impl Unpin for RnaSecondaryStructure
impl UnsafeUnpin for RnaSecondaryStructure
impl UnwindSafe for RnaSecondaryStructure
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more