[][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<Location>,
    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<Location>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 Location

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_location(&self, start: i64, end: i64) -> Location[src]

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

pub fn wrap_location(&self, p: Location) -> Result<Location, LocationError>[src]

"Wraps" a location on a circular sequence, so that coordinates that extend beyond the end of the sequence are are wrapped to the origin.

pub fn relocate_feature(
    &self,
    f: Feature,
    shift: i64
) -> Result<Feature, LocationError>
[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_location(
    &self,
    p: Location,
    shift: i64
) -> Result<Location, LocationError>
[src]

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

pub fn revcomp_feature(&self, f: Feature) -> Result<Feature, LocationError>[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(&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 extract_location(&self, l: &Location) -> Result<Vec<u8>, LocationError>[src]

Extract the sequence specified by l. This version returns Err(LocationError::External(_, NoFetcherError)) if it encounters a reference to an external sequence.

See extract_location_with_fetcher for details

pub fn extract_location_with_fetcher<'a, F, S>(
    &self,
    l: &Location,
    ext_fetcher: F
) -> Result<Vec<u8>, LocationError> where
    F: FnMut(&str) -> Result<S, Box<dyn Error>> + 'a,
    S: Borrow<Seq> + 'a, 
[src]

Extract the sequence specified by l. If the location references an external sequence, ext_fetcher will be called with the name of this sequence to retrieve it. Since an external feature may be referenced multiple times, it might be best to return &Seq or similar from ext_fetcher.

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

The resulting type after obtaining ownership.

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> Any for T where
    T: 'static + ?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.