Struct gb_io::seq::Seq

source · []
pub struct Seq {
Show 17 fields 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>

Implementations

Create a new, empty Seq

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

“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.

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

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

“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

“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

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

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

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.

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

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

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.

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. 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.