pub enum ModType {
SixMA,
FiveMC,
FourMC,
}Expand description
Represents a DNA base modification type.
This enum defines the types of modifications that can occur on DNA bases, including their associated codes for parsing and visualization.
§Variants
SixMA: N6-methyladenine (6mA), represented by the pileup codea.FiveMC: 5-methylcytosine (5mC), represented by the pileup codem.FourMC: 4-methylcytosine (4mC), represented by the pileup code21839.
§Examples
use epimetheus_methylome::ModType;
let mod_type = ModType::SixMA;
assert_eq!(mod_type.to_pileup_code(), "a");Variants§
Implementations§
Source§impl ModType
impl ModType
Sourcepub fn to_pileup_code(&self) -> &'static str
pub fn to_pileup_code(&self) -> &'static str
Returns the pileup code corresponding to the modification type.
Pileup codes are compact representations of modification types used in sequencing data (or maybe just modkit):
SixMA(6mA):"a"FiveMC(5mC):"m"FourMC(4mC):"21839"
§Examples
use epimetheus_methylome::ModType;
let mod_type = ModType::FiveMC;
assert_eq!(mod_type.to_pileup_code(), "m");Sourcepub fn from_sam_code(base: char, modification: &str) -> Option<Self>
pub fn from_sam_code(base: char, modification: &str) -> Option<Self>
Passes the sam header tag to ModType
Sam tags have the following and more for the methylation types: MM:Z:{*}
A+a(6mA):"a"C+m(5mC):"m"C+21839(4mC):"21839"
§Examples
use epimetheus_methylome::ModType;
assert_eq!(ModType::from_sam_code('A', "a"), Some(ModType::SixMA));Trait Implementations§
Source§impl Display for ModType
impl Display for ModType
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the modification type for display purposes.
Each modification type is represented in the format:
<Modification Name> (<Pileup Code>).
For example:
6mA (a)forSixMA5mC (m)forFiveMC4mC (21839)forFourMC
§Examples
use epimetheus_methylome::ModType;
let mod_type = ModType::FourMC;
assert_eq!(format!("{}", mod_type), "4mC (21839)");Source§impl FromStr for ModType
Parses a modification type from a string.
impl FromStr for ModType
Parses a modification type from a string.
The input string must match one of the following:
"a"forSixMA(6mA)"m"forFiveMC(5mC)"21839"forFourMC(4mC)
§Arguments
mod_type: A string slice representing the modification type.
§Returns
Ok(ModType)if the string matches a supported modification type.Errif the string does not match any supported modification type.
§Examples
use epimetheus_methylome::ModType;
let mod_type = "a".parse::<ModType>().unwrap();
assert_eq!(mod_type, ModType::SixMA);
let invalid = "unsupported".parse::<ModType>();
assert!(invalid.is_err());Source§impl Ord for ModType
impl Ord for ModType
Source§impl PartialOrd for ModType
impl PartialOrd for ModType
impl Copy for ModType
impl Eq for ModType
impl StructuralPartialEq for ModType
Auto Trait Implementations§
impl Freeze for ModType
impl RefUnwindSafe for ModType
impl Send for ModType
impl Sync for ModType
impl Unpin for ModType
impl UnwindSafe for ModType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.