pub struct Exon { /* private fields */ }Expand description
Represents a genomic exon.
Exons can be coding and non-coding. Coding exons have CDS start and end position and a frame-offset.
use atglib::models::{Exon, Frame};
let start = 1;
let end = 10;
let non_coding_exon = Exon::new(start, end, None, None, Frame::None);
assert_eq!(non_coding_exon.is_coding(), false);
let coding_exon = Exon::new(start, end, Some(start), Some(end), Frame::Zero);
assert_eq!(coding_exon.is_coding(), true);Implementations§
Source§impl Exon
impl Exon
Sourcepub fn new(
start: u32,
end: u32,
cds_start: Option<u32>,
cds_end: Option<u32>,
frame_offset: Frame,
) -> Exon
pub fn new( start: u32, end: u32, cds_start: Option<u32>, cds_end: Option<u32>, frame_offset: Frame, ) -> Exon
create a new Exon
use atglib::models::{Exon, Frame};
let start = 1;
let end = 10;
let non_coding_exon = Exon::new(start, end, None, None, Frame::None);
assert_eq!(non_coding_exon.is_coding(), false);
let coding_exon = Exon::new(start, end, Some(start), Some(end), Frame::Zero);
assert_eq!(coding_exon.is_coding(), true);Sourcepub fn cds_start(&self) -> &Option<u32>
pub fn cds_start(&self) -> &Option<u32>
If the exon is coding, it contains the leftmost genomic coding nucleotide position
Sourcepub fn cds_start_mut(&mut self) -> &mut Option<u32>
pub fn cds_start_mut(&mut self) -> &mut Option<u32>
modify the cds_start
Sourcepub fn cds_end(&self) -> &Option<u32>
pub fn cds_end(&self) -> &Option<u32>
If the exon is coding, it contains the rightmost genomic coding nucleotide position
Sourcepub fn cds_end_mut(&mut self) -> &mut Option<u32>
pub fn cds_end_mut(&mut self) -> &mut Option<u32>
modify the cds_end
Sourcepub fn frame_offset(&self) -> &Frame
pub fn frame_offset(&self) -> &Frame
If the exon is coding, the Frame specifies the offset of the reading frame
Sourcepub fn frame_offset_mut(&mut self) -> &mut Frame
pub fn frame_offset_mut(&mut self) -> &mut Frame
modify the frame offset
Sourcepub fn is_coding(&self) -> bool
pub fn is_coding(&self) -> bool
Returns true if the exon contains a coding sequence (CDS)
§Examples
use atglib::models::{Exon, Frame};
let start = 1;
let end = 2;
let mut a = Exon::new(start, end, None, None, Frame::None);
assert_eq!(a.is_coding(), false);
*a.cds_start_mut() = Some(1);
*a.cds_end_mut() = Some(2);
assert_eq!(a.is_coding(), true);Sourcepub fn coding_len(&self) -> u32
pub fn coding_len(&self) -> u32
Returns the number of bp of the exon’s coding sequence Non-coding exons have 0 bp coding sequence
Sourcepub fn downstream_frame(&self) -> Option<Frame>
pub fn downstream_frame(&self) -> Option<Frame>
Returns the coding frame of the next coding exon
pub fn set_frame(&mut self, frame: Frame)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Exon
impl<'de> Deserialize<'de> for Exon
Source§fn 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 Eq for Exon
impl StructuralPartialEq for Exon
Auto Trait Implementations§
impl Freeze for Exon
impl RefUnwindSafe for Exon
impl Send for Exon
impl Sync for Exon
impl Unpin for Exon
impl UnwindSafe for Exon
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