Struct bio_types::annot::pos::Pos [−][src]
pub struct Pos<R, S> { /* fields omitted */ }Position 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 Pos is chr:pos(+/-). A stranded
position must have a (+) or a (-), while an unstranded
position does not.
use bio_types::annot::pos::Pos; use bio_types::strand::ReqStrand; let start = Pos::new("chrIV".to_owned(), 683946, ReqStrand::Reverse); let start_str = start.to_string(); assert_eq!(start_str, "chrIV:683946(-)"); let start_str_pos = start_str.parse()?; assert_eq!(start, start_str_pos);
Methods
impl<R, S> Pos<R, S>[src]
impl<R, S> Pos<R, S>pub fn new(refid: R, pos: isize, strand: S) -> Self[src]
pub fn new(refid: R, pos: isize, strand: S) -> SelfConstruct a new sequence position
use std::rc::Rc; use bio_types::annot::pos::Pos; use bio_types::strand::ReqStrand; let chr = Rc::new("chrIV".to_owned()); let start = Pos::new(chr, 683946, ReqStrand::Reverse);
pub fn pos(&self) -> isize[src]
pub fn pos(&self) -> isizePosition on the reference sequence (0-based).
pub fn into_stranded(self, strand: ReqStrand) -> Pos<R, ReqStrand>[src]
pub fn into_stranded(self, strand: ReqStrand) -> Pos<R, ReqStrand>Convert into a stranded sequence position on the specified strand
Trait Implementations
impl<R: Debug, S: Debug> Debug for Pos<R, S>[src]
impl<R: Debug, S: Debug> Debug for Pos<R, S>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<R: Clone, S: Clone> Clone for Pos<R, S>[src]
impl<R: Clone, S: Clone> Clone for Pos<R, S>fn clone(&self) -> Pos<R, S>[src]
fn clone(&self) -> Pos<R, S>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<R: Hash, S: Hash> Hash for Pos<R, S>[src]
impl<R: Hash, S: Hash> Hash for Pos<R, S>fn hash<__HRS: Hasher>(&self, state: &mut __HRS)[src]
fn hash<__HRS: Hasher>(&self, state: &mut __HRS)Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl<R: PartialEq, S: PartialEq> PartialEq for Pos<R, S>[src]
impl<R: PartialEq, S: PartialEq> PartialEq for Pos<R, S>fn eq(&self, other: &Pos<R, S>) -> bool[src]
fn eq(&self, other: &Pos<R, S>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Pos<R, S>) -> bool[src]
fn ne(&self, other: &Pos<R, S>) -> boolThis method tests for !=.
impl<R: Eq, S: Eq> Eq for Pos<R, S>[src]
impl<R: Eq, S: Eq> Eq for Pos<R, S>impl<R, T> AddAssign<T> for Pos<R, ReqStrand> where
isize: AddAssign<T>,
isize: SubAssign<T>, [src]
impl<R, T> AddAssign<T> for Pos<R, ReqStrand> where
isize: AddAssign<T>,
isize: SubAssign<T>, fn add_assign(&mut self, dist: T)[src]
fn add_assign(&mut self, dist: T)Slide the reference position by an offset on the strand of the annotation.
Arguments
distspecifies the offset for sliding the position. A positivedistwill numerically increase the position for forward-strand features and decrease it for reverse-strand features.
use bio_types::annot::pos::Pos; use bio_types::strand::ReqStrand; let mut start = Pos::new("chrIV".to_owned(), 683946, ReqStrand::Reverse); assert_eq!(start.to_string(), "chrIV:683946(-)"); start += 100; assert_eq!(start.to_string(), "chrIV:683846(-)");
impl<R, T> SubAssign<T> for Pos<R, ReqStrand> where
isize: AddAssign<T>,
isize: SubAssign<T>, [src]
impl<R, T> SubAssign<T> for Pos<R, ReqStrand> where
isize: AddAssign<T>,
isize: SubAssign<T>, fn sub_assign(&mut self, dist: T)[src]
fn sub_assign(&mut self, dist: T)Slide the reference position by an offset on the strand of the annotation.
Arguments
distspecifies the offset for sliding the position. A positivedistwill numerically decrease the position for forward-strand features and increase it for reverse-strand features.
use bio_types::annot::pos::Pos; use bio_types::strand::ReqStrand; let mut start = Pos::new("chrIV".to_owned(), 683946, ReqStrand::Reverse); assert_eq!(start.to_string(), "chrIV:683946(-)"); start -= 100; assert_eq!(start.to_string(), "chrIV:684046(-)");
impl<R, S> Loc for Pos<R, S>[src]
impl<R, S> Loc for Pos<R, S>type RefID = R
type Strand = S
fn refid(&self) -> &R[src]
fn refid(&self) -> &RName of the reference sequence (chromosome name, etc.)
fn start(&self) -> isize[src]
fn start(&self) -> isizeStarting (lowest, left-most, 5'-most) position on the reference sequence (0-based). Read more
fn length(&self) -> usize[src]
fn length(&self) -> usizeLength of the region
fn strand(&self) -> S where
S: Copy, [src]
fn strand(&self) -> S where
S: Copy, Strand of the position
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]
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, Map a sequence position on a reference sequence into a relative position within an annotated location on the reference sequence. Read more
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]
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, Map a relative position within an annotated location out of that location onto the enclosing reference sequence. Read more
fn contig_intersection<T>(
&self,
contig: &Contig<Self::RefID, T>
) -> Option<Self> where
Self::RefID: PartialEq + Clone,
Self::Strand: Copy, [src]
fn contig_intersection<T>(
&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]
fn contig(&self) -> Contig<Self::RefID, Self::Strand> where
Self::RefID: Clone,
Self::Strand: Copy, Contiguous sequence location that fully covers the location.
fn first_pos(&self) -> Pos<Self::RefID, Self::Strand> where
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy, [src]
fn first_pos(&self) -> Pos<Self::RefID, Self::Strand> where
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy, The first Pos in a location, on the annotated strand. Read more
fn last_pos(&self) -> Pos<Self::RefID, Self::Strand> where
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy, [src]
fn last_pos(&self) -> Pos<Self::RefID, Self::Strand> where
Self::RefID: Clone,
Self::Strand: Into<ReqStrand> + Copy, The last Pos in a location, on the annotated strand. Read more
impl<R, S> Same for Pos<R, S> where
R: Eq,
S: Same, [src]
impl<R, S> Same for Pos<R, S> where
R: Eq,
S: Same, fn same(&self, p: &Self) -> bool[src]
fn same(&self, p: &Self) -> boolIndicate when two positions are the "same" -- when positions have unknown/unspecified strands they can be the "same" but not equal.
impl<R, S> Display for Pos<R, S> where
R: Display,
S: Display, [src]
impl<R, S> Display for Pos<R, S> where
R: Display,
S: Display, fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<R, S> FromStr for Pos<R, S> where
R: From<String>,
S: FromStr<Err = StrandError>, [src]
impl<R, S> FromStr for Pos<R, S> where
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]
fn from_str(s: &str) -> Result<Self, Self::Err>Parses a string s to return a value of this type. Read more
impl<R> From<Pos<R, ReqStrand>> for Pos<R, Strand>[src]
impl<R> From<Pos<R, ReqStrand>> for Pos<R, Strand>impl<R> From<Pos<R, NoStrand>> for Pos<R, Strand>[src]
impl<R> From<Pos<R, NoStrand>> for Pos<R, Strand>impl<R> From<Pos<R, Strand>> for Pos<R, NoStrand>[src]
impl<R> From<Pos<R, Strand>> for Pos<R, NoStrand>impl<R> From<Pos<R, ReqStrand>> for Pos<R, NoStrand>[src]
impl<R> From<Pos<R, ReqStrand>> for Pos<R, NoStrand>