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: StringTranscript accession (e.g., “NM_000088.3”)
gene_symbol: Option<String>Gene symbol (e.g., “COL1A1”)
strand: StrandStrand orientation
sequence: StringFull 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: GenomeBuildGenome build/assembly version
mane_status: ManeStatusMANE (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
impl Transcript
Sourcepub 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
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
Sourcepub fn sequence_length(&self) -> u64
pub fn sequence_length(&self) -> u64
Get the length of the transcript sequence
Sourcepub fn cds_length(&self) -> Option<u64>
pub fn cds_length(&self) -> Option<u64>
Get the CDS length
Sourcepub fn get_sequence(&self, start: u64, end: u64) -> Option<&str>
pub fn get_sequence(&self, start: u64, end: u64) -> Option<&str>
Get sequence at a position range (0-based)
Sourcepub fn exon_at(&self, pos: u64) -> Option<&Exon>
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.
Sourcepub fn utr5_length(&self) -> Option<u64>
pub fn utr5_length(&self) -> Option<u64>
Get the 5’ UTR length
Sourcepub fn utr3_length(&self) -> Option<u64>
pub fn utr3_length(&self) -> Option<u64>
Get the 3’ UTR length
Sourcepub fn has_genomic_coords(&self) -> bool
pub fn has_genomic_coords(&self) -> bool
Check if this transcript has genomic coordinates
Sourcepub fn genomic_length(&self) -> Option<u64>
pub fn genomic_length(&self) -> Option<u64>
Get the genomic length (span) of the transcript
Sourcepub fn contains_genomic_pos(&self, pos: u64) -> bool
pub fn contains_genomic_pos(&self, pos: u64) -> bool
Check if a genomic position falls within this transcript’s span
Sourcepub fn is_mane_select(&self) -> bool
pub fn is_mane_select(&self) -> bool
Check if this is a MANE Select transcript
Sourcepub fn is_mane_plus_clinical(&self) -> bool
pub fn is_mane_plus_clinical(&self) -> bool
Check if this is a MANE Plus Clinical transcript
Sourcepub fn introns(&self) -> &[Intron]
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.
Sourcepub fn calculate_introns(&self) -> Vec<Intron>
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.
Sourcepub fn find_intron_at_genomic(
&self,
genomic_pos: u64,
) -> Option<(Intron, IntronPosition)>
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).
Sourcepub fn intron_count(&self) -> usize
pub fn intron_count(&self) -> usize
Get the number of introns in this transcript
Sourcepub fn find_intron_at_tx_boundary(
&self,
tx_boundary: u64,
offset: i64,
) -> Option<&Intron>
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 boundaryoffset- 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
Sourcepub fn genomic_to_intronic(&self, genomic_pos: u64) -> Option<(u64, i64)>
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
impl Clone for Transcript
Source§impl Debug for Transcript
impl Debug for Transcript
Source§impl<'de> Deserialize<'de> for Transcript
impl<'de> Deserialize<'de> for Transcript
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>,
Source§impl PartialEq for Transcript
impl PartialEq for Transcript
Source§impl Serialize for Transcript
impl Serialize for Transcript
impl Eq for Transcript
Auto Trait Implementations§
impl !Freeze for Transcript
impl RefUnwindSafe for Transcript
impl Send for Transcript
impl Sync for Transcript
impl Unpin for Transcript
impl UnsafeUnpin for Transcript
impl UnwindSafe for Transcript
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.