pub enum Frame {
None,
Zero,
One,
Two,
}
Expand description
Frame indicates the reading frame offset of an Exon
It is based on GTF nomenclature:
- 0 indicates that the feature begins with a whole codon at the 5’ most base.
- 1 means that there is one extra base (the third base of a codon) before the first whole codon
- 2 means that there are two extra bases (the second and third bases of the codon) before the first codon.
Important: The reading-frame offset is handled differently in RefGene
Examples
use std::str::FromStr;
use atglib::models::Frame;
let frame_str = Frame::from_str("1").unwrap();
let frame_int = Frame::from_int(1).unwrap();
assert_eq!(frame_str, frame_int);
Variants
None
Zero
One
Two
Implementations
sourceimpl Frame
impl Frame
sourcepub fn from_int(s: u32) -> Result<Self, String>
pub fn from_int(s: u32) -> Result<Self, String>
Returns a Frame based on the integer frame offset
sourcepub fn from_gtf(s: &str) -> Result<Self, String>
pub fn from_gtf(s: &str) -> Result<Self, String>
Returns Frame
from a GTF value
This method is the same as Frame::from_str
but is present
for consistency reasons
Examples
use atglib::models::Frame;
let frame = Frame::from_gtf("1").unwrap();
assert_eq!(frame, Frame::One);
sourcepub fn from_refgene(s: &str) -> Result<Self, String>
pub fn from_refgene(s: &str) -> Result<Self, String>
Returns Frame
from a RefGene value
RefGene uses a different specification than GTF when it comes to specifying 1 or 2. RefGene specifies how many nucleotides of the first codon are present on the previous exon.
Examples
use atglib::models::Frame;
let frame = Frame::from_refgene("1").unwrap();
assert_eq!(frame, Frame::Two);
sourcepub fn to_gtf(&self) -> String
pub fn to_gtf(&self) -> String
Returns the GTF String for Frame
This method is the same as the fmt::Display trait but is present for consistency reasons
Examples
use atglib::models::Frame;
let frame = Frame::One.to_gtf();
assert_eq!(frame, "1".to_string());
sourcepub fn to_refgene(&self) -> String
pub fn to_refgene(&self) -> String
Returns the RefGene String for Frame
RefGene uses a different specification than GTF when it comes to specifying 1 or 2. RefGene specifies how many nucleotides of the first codon are present on the previous exon.
Examples
use atglib::models::Frame;
let frame = Frame::One.to_refgene();
assert_eq!(frame, "2".to_string());
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Frame
impl<'de> Deserialize<'de> for Frame
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Frame
impl Eq for Frame
impl StructuralEq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more