pub struct Pos<R, S> { /* private fields */ }
Expand description
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);
Implementations§
source§impl<R, S> Pos<R, S>
impl<R, S> Pos<R, S>
sourcepub fn new(refid: R, pos: isize, strand: S) -> Self
pub fn new(refid: R, pos: isize, strand: S) -> Self
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);
sourcepub fn into_stranded(self, strand: ReqStrand) -> Pos<R, ReqStrand>
pub fn into_stranded(self, strand: ReqStrand) -> Pos<R, ReqStrand>
Convert into a stranded sequence position on the specified strand
Trait Implementations§
source§impl<R, T> AddAssign<T> for Pos<R, ReqStrand>
impl<R, T> AddAssign<T> for Pos<R, ReqStrand>
source§fn add_assign(&mut self, dist: T)
fn add_assign(&mut self, dist: T)
Slide the reference position by an offset on the strand of the annotation.
§Arguments
dist
specifies the offset for sliding the position. A positivedist
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(-)");
source§impl<R, S> Loc for Pos<R, S>
impl<R, S> Loc for Pos<R, S>
type RefID = R
type Strand = S
source§fn start(&self) -> isize
fn start(&self) -> isize
Starting (lowest, left-most, 5’-most) position on the
reference sequence (0-based).
source§fn pos_into<T>(&self, pos: &Pos<Self::RefID, T>) -> Option<Pos<(), T>>
fn pos_into<T>(&self, pos: &Pos<Self::RefID, T>) -> Option<Pos<(), T>>
Map a sequence position on a reference sequence into a
relative position within an annotated location on the
reference sequence. Read more
source§fn pos_outof<Q, T>(&self, pos: &Pos<Q, T>) -> Option<Pos<Self::RefID, T>>
fn pos_outof<Q, T>(&self, pos: &Pos<Q, T>) -> Option<Pos<Self::RefID, T>>
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>
source§impl<R, T> SubAssign<T> for Pos<R, ReqStrand>
impl<R, T> SubAssign<T> for Pos<R, ReqStrand>
source§fn sub_assign(&mut self, dist: T)
fn sub_assign(&mut self, dist: T)
Slide the reference position by an offset on the strand of the annotation.
§Arguments
dist
specifies the offset for sliding the position. A positivedist
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: Eq, S: Eq> Eq for Pos<R, S>
impl<R, S> StructuralPartialEq for Pos<R, S>
Auto Trait Implementations§
impl<R, S> Freeze for Pos<R, S>
impl<R, S> RefUnwindSafe for Pos<R, S>where
R: RefUnwindSafe,
S: RefUnwindSafe,
impl<R, S> Send for Pos<R, S>
impl<R, S> Sync for Pos<R, S>
impl<R, S> Unpin for Pos<R, S>
impl<R, S> UnwindSafe for Pos<R, S>where
R: UnwindSafe,
S: UnwindSafe,
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)