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

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);

Position on the reference sequence (0-based).

Convert into a stranded sequence position on the specified strand

Trait Implementations

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(-)");

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

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

Name of the reference sequence (chromosome name, etc.)

Starting (lowest, left-most, 5’-most) position on the reference sequence (0-based). Read more

Length of the region

Strand of the position

Map a sequence position on a reference sequence into a relative position within an annotated location on the reference sequence. Read more

Map a relative position within an annotated location out of that location onto the enclosing reference sequence. Read more

Contiguous sequence location that fully covers the location.

The first Pos in a location, on the annotated strand. Read more

The last Pos in a location, on the annotated strand. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Indicate when two positions are the “same” – when positions have unknown/unspecified strands they can be the “same” but not equal.

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(-)");

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.