Skip to main content

Transcript

Struct Transcript 

Source
pub struct Transcript {
Show 14 fields pub id: String, pub gene_symbol: Option<String>, pub strand: Strand, pub sequence: String, pub cds_start: Option<u64>, pub cds_end: Option<u64>, pub exons: Vec<Exon>, pub chromosome: Option<String>, pub genomic_start: Option<u64>, pub genomic_end: Option<u64>, pub genome_build: GenomeBuild, pub mane_status: ManeStatus, pub refseq_match: Option<String>, pub ensembl_match: Option<String>, /* private fields */
}
Expand description

A transcript with its exon structure and sequence

Fields§

§id: String

Transcript accession (e.g., “NM_000088.3”)

§gene_symbol: Option<String>

Gene symbol (e.g., “COL1A1”)

§strand: Strand

Strand orientation

§sequence: String

Full transcript sequence

§cds_start: Option<u64>

CDS start position (1-based, in transcript coordinates)

§cds_end: Option<u64>

CDS end position (1-based, in transcript coordinates)

§exons: Vec<Exon>

List of exons

§chromosome: Option<String>

Chromosome name (e.g., “chr1”, “1”, “X”)

§genomic_start: Option<u64>

Genomic start position of transcript (1-based, inclusive)

§genomic_end: Option<u64>

Genomic end position of transcript (1-based, inclusive)

§genome_build: GenomeBuild

Genome build/assembly version

§mane_status: ManeStatus

MANE (Matched Annotation from NCBI and EBI) status

§refseq_match: Option<String>

RefSeq accession matched to this transcript (for Ensembl transcripts)

§ensembl_match: Option<String>

Ensembl accession matched to this transcript (for RefSeq transcripts)

Implementations§

Source§

impl Transcript

Source

pub fn new( id: String, gene_symbol: Option<String>, strand: Strand, sequence: String, cds_start: Option<u64>, cds_end: Option<u64>, exons: Vec<Exon>, chromosome: Option<String>, genomic_start: Option<u64>, genomic_end: Option<u64>, genome_build: GenomeBuild, mane_status: ManeStatus, refseq_match: Option<String>, ensembl_match: Option<String>, ) -> Self

Create a new Transcript with the given fields

Source

pub fn sequence_length(&self) -> u64

Get the length of the transcript sequence

Source

pub fn is_coding(&self) -> bool

Check if this is a coding transcript

Source

pub fn cds_length(&self) -> Option<u64>

Get the CDS length

Source

pub fn get_sequence(&self, start: u64, end: u64) -> Option<&str>

Get sequence at a position range (0-based)

Source

pub fn exon_at(&self, pos: u64) -> Option<&Exon>

Find which exon contains a position using binary search

Assumes exons are sorted by start position (which they typically are). Falls back to linear search if exons are not sorted.

Source

pub fn utr5_length(&self) -> Option<u64>

Get the 5’ UTR length

Source

pub fn utr3_length(&self) -> Option<u64>

Get the 3’ UTR length

Source

pub fn has_genomic_coords(&self) -> bool

Check if this transcript has genomic coordinates

Source

pub fn genomic_length(&self) -> Option<u64>

Get the genomic length (span) of the transcript

Source

pub fn contains_genomic_pos(&self, pos: u64) -> bool

Check if a genomic position falls within this transcript’s span

Source

pub fn is_mane_select(&self) -> bool

Check if this is a MANE Select transcript

Source

pub fn is_mane_plus_clinical(&self) -> bool

Check if this is a MANE Plus Clinical transcript

Source

pub fn is_mane(&self) -> bool

Check if this is any type of MANE transcript

Source

pub fn introns(&self) -> &[Intron]

Get cached introns, computing them lazily if not already cached

This method provides O(1) access to introns after the first call, avoiding recalculation on every lookup.

Source

pub fn calculate_introns(&self) -> Vec<Intron>

Calculate introns from exon boundaries

Returns a vector of Intron structs derived from adjacent exon pairs. Exons should be sorted by transcript position.

Note: This method uses caching internally. For repeated access, prefer introns() which returns a slice reference.

Source

pub fn find_intron_at_genomic( &self, genomic_pos: u64, ) -> Option<(Intron, IntronPosition)>

Find which intron contains a genomic position

Returns the intron and the offset from the nearest exon boundary. Positive offset means downstream from 5’ boundary (c.N+offset notation). Negative offset means upstream from 3’ boundary (c.N-offset notation).

Source

pub fn intron_count(&self) -> usize

Get the number of introns in this transcript

Source

pub fn find_intron_at_tx_boundary( &self, tx_boundary: u64, offset: i64, ) -> Option<&Intron>

Find an intron given a transcript boundary position and offset

This is used to convert intronic positions like c.100+5 or c.200-10 to find which intron they’re in.

§Arguments
  • tx_boundary - The transcript position of the exon boundary
  • offset - The offset into the intron (positive = after exon, negative = before exon)
§Returns

The intron if found, along with whether this is a 5’ or 3’ boundary reference

Source

pub fn intronic_to_genomic(&self, tx_boundary: u64, offset: i64) -> Option<u64>

Convert an intronic position to a genomic coordinate

§Arguments
  • tx_boundary - The transcript position of the exon boundary (the base part of c.N+offset)
  • offset - The offset into the intron
§Returns

The genomic position if the transcript has genomic coordinates

Source

pub fn genomic_to_intronic(&self, genomic_pos: u64) -> Option<(u64, i64)>

Convert a genomic position to intronic transcript notation

§Arguments
  • genomic_pos - The genomic position
§Returns

A tuple of (tx_boundary_position, offset) where:

  • tx_boundary_position is the CDS/transcript position of the nearest exon boundary
  • offset is positive (c.N+offset) or negative (c.N-offset)

Trait Implementations§

Source§

impl Clone for Transcript

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Transcript

Source§

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

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

impl<'de> Deserialize<'de> for Transcript

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 PartialEq for Transcript

Source§

fn eq(&self, other: &Self) -> 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 Transcript

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 Transcript

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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