[][src]Struct gb_io::seq::Seq

pub struct Seq {
    pub name: Option<String>,
    pub topology: Topology,
    pub date: Option<Date>,
    pub len: Option<usize>,
    pub molecule_type: Option<String>,
    pub division: String,
    pub definition: Option<String>,
    pub accession: Option<String>,
    pub version: Option<String>,
    pub source: Option<Source>,
    pub dblink: Option<String>,
    pub keywords: Option<String>,
    pub references: Vec<Reference>,
    pub comments: Vec<String>,
    pub seq: Vec<u8>,
    pub contig: Option<Position>,
    pub features: Vec<Feature>,
}

Fields

name: Option<String>

Name as specified in the LOCUS line

topology: Topology

Whether this molecule is linear or circular

date: Option<Date>

The date specified in the LOCUS line

len: Option<usize>

Length as specified in the LOCUS line. Note that this may differ from seq.len(), especially if contig is Some and seq is empty. When parsing a file, if sequence data is provided we check that this value is equal to seq.len()

molecule_type: Option<String>division: Stringdefinition: Option<String>accession: Option<String>version: Option<String>source: Option<Source>dblink: Option<String>keywords: Option<String>references: Vec<Reference>comments: Vec<String>seq: Vec<u8>contig: Option<Position>features: Vec<Feature>

Methods

impl Seq[src]

pub fn empty() -> Seq[src]

Create a new, empty Seq

pub fn is_circular(&self) -> bool[src]

pub fn len(&self) -> i64[src]

Returns the "actual" length of the sequence. Note that this may not be equal to self.seq.len(), in the following circumstances:

  • self.seq is empty and self.contig is not, and the corresponding file's LOCUS line specified a length. The returned value is i64 to simplifiy arithmetic with coords from Position

pub fn unwrap_range(&self, start: i64, end: i64) -> (i64, i64)[src]

"Normalises" an exclusive range on the chromosome, to make handling circular sequences simpler. For linear sequences, it doesn't do anything except panic unless start and end are both within the sequence, or if end <= start. For circular sequences, all values, including negative values, are allowed.

If end <= start, the range is assumed to wrap around. The returned values will satisfy the following conditions:

  • 0 <= first < len
  • first < last This means that in the case of a range which wraps around, last >= len.

pub fn range_to_position(&self, start: i64, end: i64) -> Position[src]

Given a range on this sequence, returns a corresponding Position Note: this is a rust-style, exclusive range

pub fn unwrap_position(&self, p: Position) -> Result<Position, PositionError>[src]

"Unwraps" a position on a circular sequence, so that coordinates that span the origin are replaced with positions beyond the origin.

pub fn unwrap_position2(
    &self,
    p: Position,
    pivot: i64
) -> Result<Position, PositionError>
[src]

pub fn wrap_position(&self, p: Position) -> Result<Position, PositionError>[src]

pub fn relocate_feature(
    &self,
    f: Feature,
    shift: i64
) -> Result<Feature, PositionError>
[src]

"Shifts" a feature forwards by shift NTs (can be negative) Note: If this fails you won't get the original Feature back. If this is important, you should clone first

pub fn relocate_position(
    &self,
    p: Position,
    shift: i64
) -> Result<Position, PositionError>
[src]

"Shifts" a position forwards by shift NTs (can be negative) Note: If this fails you won't get the original Position back. If this is important, you should clone first

pub fn revcomp_position(&self, p: Position) -> Result<Position, PositionError>[src]

Note: If this fails you won't get the original Position back. If this is important, you should clone first

pub fn revcomp_feature(&self, f: Feature) -> Result<Feature, PositionError>[src]

Note: If this fails you won't get the original Feature back. If this is important, you should clone first

pub fn revcomp(&self) -> Seq[src]

Returns the reverse complement of a Seq, skipping any features which can't be processed with a warning

pub fn extract_range_seq(&self, start: i64, end: i64) -> Cow<[u8]>[src]

Extracts just the sequence from start to end, taking into account circularity. Note that end is exclusive. Use this instead of extract_range if you don't need the features.

pub fn extract_range_no_truncation(&self, start: i64, end: i64) -> Seq[src]

Extracts from start to end, keeping only features which fall entirely within this range. Note that end is not inclusive. Skips ambiguous features with a warning.

pub fn extract_range(&self, start: i64, end: i64) -> Seq[src]

Extracts from start to end, truncating features that extend beyond this range. Note that end is not inclusive. Skips ambiguous features with a warning.

pub fn set_origin(&self, origin: i64) -> Seq[src]

Returns a new Seq, rotated so that origin is at the start

pub fn write<T: Write>(&self, file: T) -> Result<()>[src]

Trait Implementations

impl PartialEq<Seq> for Seq[src]

impl Clone for Seq[src]

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

Performs copy-assignment from source. Read more

impl Debug for Seq[src]

Auto Trait Implementations

impl Send for Seq

impl Sync for Seq

Blanket Implementations

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

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

type Owned = T

impl<T> From for 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]