pub struct Spliced<R, S> { /* private fields */ }
Expand description
Spliced sequence annotation on a particular, named sequence (e.g. a chromosome).
Parameterized over the type of the reference sequence identifier and over the strandedness of the position.
The display format for a Spliced
is
chr:start_0-end_0;start_1-end_1;…;start_N-end_N(+/-/.). The
boundaries for each individual exon are given as a half-open
0-based interval, like the Rust Range
and BED format.
let tad3 = Spliced::with_lengths_starts("chrXII".to_owned(), 765265,
&vec![808,52,109], &vec![0,864,984],
ReqStrand::Reverse)?;
assert_eq!(tad3.to_string(), "chrXII:765265-766073;766129-766181;766249-766358(-)");
let tad3_exons = tad3.exon_contigs();
assert_eq!(tad3_exons.len(), 3);
assert_eq!(tad3_exons[0].to_string(), "chrXII:766249-766358(-)");
assert_eq!(tad3_exons[1].to_string(), "chrXII:766129-766181(-)");
assert_eq!(tad3_exons[2].to_string(), "chrXII:765265-766073(-)");
Implementations§
Source§impl<R, S> Spliced<R, S>
impl<R, S> Spliced<R, S>
Sourcepub fn new(refid: R, start: isize, exon_0_length: usize, strand: S) -> Self
pub fn new(refid: R, start: isize, exon_0_length: usize, strand: S) -> Self
Construct a new, single-exon “spliced” location
use std::rc::Rc;
use bio_types::annot::spliced::Spliced;
use bio_types::strand::ReqStrand;
let chr = Rc::new("chrX".to_owned());
let tma22 = Spliced::new(chr, 461829, 462426 - 461829, ReqStrand::Forward);
Sourcepub fn with_lengths_starts(
refid: R,
start: isize,
exon_lengths: &[usize],
exon_starts: &[usize],
strand: S,
) -> Result<Self, SplicingError>
pub fn with_lengths_starts( refid: R, start: isize, exon_lengths: &[usize], exon_starts: &[usize], strand: S, ) -> Result<Self, SplicingError>
Construct a multi-exon “spliced” location using BED-style exon starts and lengths.
Sourcepub fn exon_count(&self) -> usize
pub fn exon_count(&self) -> usize
Number of exons
Sourcepub fn exon_starts(&self) -> Vec<usize>
pub fn exon_starts(&self) -> Vec<usize>
Vector of exon starting positions, relative to the start of the location overall.
These positions run from left to right on the reference sequence, regardless of the location’s strand.
Sourcepub fn exon_lengths(&self) -> Vec<usize>
pub fn exon_lengths(&self) -> Vec<usize>
Vector of exon lengths.
Exon lengths are given from left to right on the reference sequence, regardless of the location’s strand.
Sourcepub fn exon_total_length(&self) -> usize
pub fn exon_total_length(&self) -> usize
Total length of exons only.
The length
method from the Loc
trait returns the total
length spanned by the annotation, including both introns and
exons.
Sourcepub fn into_stranded(self, strand: ReqStrand) -> Spliced<R, ReqStrand>
pub fn into_stranded(self, strand: ReqStrand) -> Spliced<R, ReqStrand>
Convert into a stranded sequence location on the specified strand