logo
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

Returns a Frame based on the integer frame offset

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

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

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

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

Returns true if the Frame is 0, 1 or 2

Trait Implementations

Calculates the next resulting Frame offset

The resulting type after applying the + operator.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Creates a Frame from a string (as in GTF format)

Only accepts the following options:

  • -1
  • 0
  • 1
  • 2
  • .

The associated error which can be returned from parsing.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.