Exon

Struct Exon 

Source
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

Source

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);
Source

pub fn start(&self) -> u32

Genomic start (leftmost) position of the exon

Source

pub fn start_mut(&mut self) -> &mut u32

modify the start

Source

pub fn end(&self) -> u32

Genomic end (rightmost) position of the exon

Source

pub fn end_mut(&mut self) -> &mut u32

modify the end

Source

pub fn cds_start(&self) -> &Option<u32>

If the exon is coding, it contains the leftmost genomic coding nucleotide position

Source

pub fn cds_start_mut(&mut self) -> &mut Option<u32>

modify the cds_start

Source

pub fn cds_end(&self) -> &Option<u32>

If the exon is coding, it contains the rightmost genomic coding nucleotide position

Source

pub fn cds_end_mut(&mut self) -> &mut Option<u32>

modify the cds_end

Source

pub fn frame_offset(&self) -> &Frame

If the exon is coding, the Frame specifies the offset of the reading frame

Source

pub fn frame_offset_mut(&mut self) -> &mut Frame

modify the frame offset

Source

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);
Source

pub fn len(&self) -> u32

Returns the number of bp of the exon

Source

pub fn is_empty(&self) -> bool

Only implemented to satisfy clippy… Exons cannot be empty.

Source

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

Source

pub fn downstream_frame(&self) -> Option<Frame>

Returns the coding frame of the next coding exon

Source

pub fn set_frame(&mut self, frame: Frame)

Trait Implementations§

Source§

impl Debug for Exon

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Exon

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Exon

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<GtfRecord> for Exon

Source§

fn from(feature: GtfRecord) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Exon

Source§

fn eq(&self, other: &Exon) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Exon

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Exon

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,