[−][src]Struct bio_types::annot::contig::Contig
Contiguous sequence region 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 Contig is chr:start-end(+/-/.). The
boundaries are given as a half-open 0-based interval, like the
Rust Range and BED format.
use bio_types::annot::contig::Contig; use bio_types::strand::ReqStrand; let tma19 = Contig::new("chrXI".to_owned(), 334412, (334916 - 334412), ReqStrand::Reverse); let tma19_str = tma19.to_string(); assert_eq!(tma19_str, "chrXI:334412-334916(-)"); let tma19_str_loc = tma19_str.parse()?; assert_eq!(tma19, tma19_str_loc);
Implementations
impl<R, S> Contig<R, S>[src]
pub fn new(refid: R, start: isize, length: usize, strand: S) -> Self[src]
Construct a new sequence contig location
use std::rc::Rc; use bio_types::annot::contig::Contig; use bio_types::strand::ReqStrand; let chr = Rc::new("chrX".to_owned()); let tma22 = Contig::new(chr, 461829, 462426 - 461829, ReqStrand::Forward);
pub fn with_first_length(
pos: &Pos<R, S>,
length: usize
) -> Result<Self, AnnotError> where
R: Clone,
S: Into<Option<ReqStrand>> + Copy, [src]
pos: &Pos<R, S>,
length: usize
) -> Result<Self, AnnotError> where
R: Clone,
S: Into<Option<ReqStrand>> + Copy,
Construct a new sequence contig location from a starting position and length.
In general, the starting position must have a "strandedness", and reverse-strand starting positions will extend towards lower coordinates from the starting position.
use bio_types::annot::contig::Contig; use bio_types::annot::pos::Pos; use bio_types::strand::ReqStrand; let tma22_first = Pos::new("chrX".to_string(), 461829, ReqStrand::Forward); let tma22 = Contig::with_first_length(&tma22_first, 462426 - 461829)?; assert_eq!(tma22.to_string(), "chrX:461829-462426(+)"); let tma19_first = Pos::new("chrXI".to_string(), 335015, ReqStrand::Reverse); let tma19 = Contig::with_first_length(&tma19_first, 335016 - 334412)?; assert_eq!(tma19.to_string(), "chrXI:334412-335016(-)");
pub fn into_stranded(self, strand: ReqStrand) -> Contig<R, ReqStrand>[src]
Convert into a stranded sequence location on the specified strand
impl<R> Contig<R, ReqStrand>[src]
pub fn extend_upstream(&mut self, dist: usize)[src]
Extend the annotation by dist in the upstream direction on the
annotated strand.
Arguments
distspecifies the offset for sliding the position. The left, 5'-most end of the contig will expand for forward-strand annotations and the right, 3'-most end will expand for reverse-strand annotations.
use bio_types::annot::contig::Contig; use bio_types::strand::ReqStrand; let mut tma22 = Contig::new("chrX".to_owned(), 461829, 462426 - 461829, ReqStrand::Forward); tma22.extend_upstream(100); assert_eq!(tma22.to_string(), "chrX:461729-462426(+)"); let mut tma19 = Contig::new("chrXI".to_owned(), 334412, 334916 - 334412, ReqStrand::Reverse); tma19.extend_upstream(100); assert_eq!(tma19.to_string(), "chrXI:334412-335016(-)");
pub fn extend_downstream(&mut self, dist: usize)[src]
Extend the annotation by dist in the downstream direction on the
annotated strand.
Arguments
distspecifies the offset for sliding the position. The right, 3'-most end of the contig will expand for forward-strand annotations and the left, 5'-most end will expand for reverse-strand annotations.
use bio_types::annot::contig::Contig; use bio_types::strand::ReqStrand; let mut tma22 = Contig::new("chrX".to_owned(), 461829, 462426 - 461829, ReqStrand::Forward); tma22.extend_downstream(100); assert_eq!(tma22.to_string(), "chrX:461829-462526(+)"); let mut tma19 = Contig::new("chrXI".to_owned(), 334412, 334916 - 334412, ReqStrand::Reverse); tma19.extend_downstream(100); assert_eq!(tma19.to_string(), "chrXI:334312-334916(-)");
Trait Implementations
impl<R: Clone, S: Clone> Clone for Contig<R, S>[src]
impl<R: Debug, S: Debug> Debug for Contig<R, S>[src]
impl<R, S> Display for Contig<R, S> where
R: Display,
S: Display, [src]
R: Display,
S: Display,
impl<R: Eq, S: Eq> Eq for Contig<R, S>[src]
impl<R> From<Contig<R, NoStrand>> for Contig<R, Strand>[src]
impl<R> From<Contig<R, ReqStrand>> for Contig<R, Strand>[src]
impl<R> From<Contig<R, ReqStrand>> for Contig<R, NoStrand>[src]
impl<R> From<Contig<R, Strand>> for Contig<R, NoStrand>[src]
impl<R, S> FromStr for Contig<R, S> where
R: From<String>,
S: FromStr<Err = StrandError>, [src]
R: From<String>,
S: FromStr<Err = StrandError>,
type Err = ParseAnnotError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>[src]
impl<R: Hash, S: Hash> Hash for Contig<R, S>[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<R, S> Loc for Contig<R, S>[src]
type RefID = R
type Strand = S
fn refid(&self) -> &R[src]
fn start(&self) -> isize[src]
fn length(&self) -> usize[src]
fn strand(&self) -> S where
S: Copy, [src]
S: Copy,
fn pos_into<T>(&self, pos: &Pos<Self::RefID, T>) -> Option<Pos<(), T>> where
Self::RefID: Eq,
Self::Strand: Into<ReqStrand> + Copy,
T: Neg<Output = T> + Copy, [src]
Self::RefID: Eq,
Self::Strand: Into<ReqStrand> + Copy,
T: Neg<Output = T> + Copy,
fn pos_outof<Q, T>(&self, pos: &Pos<Q, T>) -> Option<Pos<Self::RefID, T>> where
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy,
T: Neg<Output = T> + Copy, [src]
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy,
T: Neg<Output = T> + Copy,
fn contig_intersection<T>(
&self,
contig: &Contig<Self::RefID, T>
) -> Option<Self> where
Self::RefID: PartialEq + Clone,
Self::Strand: Copy, [src]
&self,
contig: &Contig<Self::RefID, T>
) -> Option<Self> where
Self::RefID: PartialEq + Clone,
Self::Strand: Copy,
fn contig(&self) -> Contig<Self::RefID, Self::Strand> where
Self::RefID: Clone,
Self::Strand: Copy, [src]
Self::RefID: Clone,
Self::Strand: Copy,
fn first_pos(&self) -> Pos<Self::RefID, Self::Strand> where
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy, [src]
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy,
fn last_pos(&self) -> Pos<Self::RefID, Self::Strand> where
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy, [src]
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy,
impl<R: PartialEq, S: PartialEq> PartialEq<Contig<R, S>> for Contig<R, S>[src]
impl<R, S> StructuralEq for Contig<R, S>[src]
impl<R, S> StructuralPartialEq for Contig<R, S>[src]
Auto Trait Implementations
impl<R, S> RefUnwindSafe for Contig<R, S> where
R: RefUnwindSafe,
S: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
impl<R, S> Send for Contig<R, S> where
R: Send,
S: Send,
R: Send,
S: Send,
impl<R, S> Sync for Contig<R, S> where
R: Sync,
S: Sync,
R: Sync,
S: Sync,
impl<R, S> Unpin for Contig<R, S> where
R: Unpin,
S: Unpin,
R: Unpin,
S: Unpin,
impl<R, S> UnwindSafe for Contig<R, S> where
R: UnwindSafe,
S: UnwindSafe,
R: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,