[][src]Struct bio_types::annot::pos::Pos

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]

pub fn new(refid: R, pos: isize, strand: S) -> Self[src]

Construct 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]

Position on the reference sequence (0-based).

pub fn into_stranded(self, strand: ReqStrand) -> Pos<R, ReqStrand>[src]

Convert into a stranded sequence position on the specified strand

Trait Implementations

impl<R, S> Loc for Pos<R, S>[src]

type RefID = R

type Strand = S

fn contig(&self) -> Contig<Self::RefID, Self::Strand> where
    Self::RefID: Clone,
    Self::Strand: Copy
[src]

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]

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]

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]

fn same(&self, p: &Self) -> bool[src]

Indicate when two positions are the "same" -- when positions have unknown/unspecified strands they can be the "same" but not equal.

impl<R: Clone, S: Clone> Clone for Pos<R, S>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<R: Eq, S: Eq> Eq for Pos<R, S>[src]

impl<R: PartialEq, S: PartialEq> PartialEq<Pos<R, S>> for Pos<R, S>[src]

impl<R> From<Pos<R, ReqStrand>> for Pos<R, Strand>[src]

impl<R> From<Pos<R, NoStrand>> for Pos<R, Strand>[src]

impl<R> From<Pos<R, Strand>> for Pos<R, NoStrand>[src]

impl<R> From<Pos<R, ReqStrand>> for Pos<R, NoStrand>[src]

impl<R, S> Display for Pos<R, S> where
    R: Display,
    S: Display
[src]

impl<R: Debug, S: Debug> Debug for Pos<R, S>[src]

impl<R, S> FromStr for Pos<R, S> where
    R: From<String>,
    S: FromStr<Err = StrandError>, 
[src]

type Err = ParseAnnotError

The associated error which can be returned from parsing.

impl<R, T> AddAssign<T> for Pos<R, ReqStrand> where
    isize: AddAssign<T>,
    isize: SubAssign<T>, 
[src]

fn add_assign(&mut self, dist: T)[src]

Slide the reference position by an offset on the strand of the annotation.

Arguments

  • dist specifies the offset for sliding the position. A positive dist will 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]

fn sub_assign(&mut self, dist: T)[src]

Slide the reference position by an offset on the strand of the annotation.

Arguments

  • dist specifies the offset for sliding the position. A positive dist will 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: Hash, S: Hash> Hash for Pos<R, S>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl<R, S> Send for Pos<R, S> where
    R: Send,
    S: Send

impl<R, S> Sync for Pos<R, S> where
    R: Sync,
    S: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]