Struct Strand

Source
pub struct Strand<Label, DomainLabel> {
    pub domains: Vec<Domain<DomainLabel>>,
    pub sequence: Option<Cow<'static, str>>,
    pub cyclic: bool,
    pub color: Option<Color>,
    pub label: Option<Label>,
}
Expand description

A DNA strand.

Fields§

§domains: Vec<Domain<DomainLabel>>

The (ordered) vector of domains, where each domain is a directed interval of a helix.

§sequence: Option<Cow<'static, str>>

The sequence of this strand, if any. If the sequence is longer than specified by the domains, a prefix is assumed. Can be skipped in the serialisation.

§cyclic: bool

Is this sequence cyclic? Can be skipped (and defaults to false) in the serialization.

§color: Option<Color>

Colour of this strand. If skipped, a default colour will be chosen automatically.

§label: Option<Label>

An optional label for the strand. Can be serde_json::Value::Null, and skipped in the serialisation.

Implementations§

Source§

impl<Label, DomainLabel> Strand<Label, DomainLabel>

Source

pub fn find_nucl(&self, nucl: isize) -> (isize, isize, bool)

Find the nucl-th nucleotide of the strand. Output is (h, x, b) so that the nucl-th nucleotide of the strand is on helix h at position x with orientation b.

Source§

impl<StrandLabel, DomainLabel> Strand<StrandLabel, DomainLabel>

Source

pub fn default_color(&self) -> Color

Provide a default color to the strand.

Source

pub fn set_kelly_color(&mut self, color: usize)

Choose a color for this strand.

Source

pub fn is_empty(&self) -> bool

Return true iff the strand is empty

Source

pub fn len(&self) -> usize

Total length of the strand

Source

pub fn from_domain(domain: Domain<DomainLabel>) -> Self

Create a strand made of one domain

Source

pub fn first_nucl(&self) -> Option<(isize, isize, bool)>

Return the first Nucleotide of the strand if the length is at least 1. Return None otherwise

Source

pub fn last_nucl(&self) -> Option<(isize, isize, bool)>

Return the last Nucleotide of the strand if the length is at least 1. Return None otherwise

Source

pub fn nth_nucl(&self, n: usize) -> Option<(isize, isize, bool)>

Return the n-th nucleotide of the strand, or None if the length of the strand is less than n.

Source

pub fn set_sequence(&mut self, seq: String)

Set the sequence of the strand, if the strand is longer than the provided sequence, the 3’ end of the strand will not have a sequence. If the sequence is longer than the strand, the last chars of the sequence will be ignored

Trait Implementations§

Source§

impl<Label: Clone, DomainLabel: Clone> Clone for Strand<Label, DomainLabel>

Source§

fn clone(&self) -> Strand<Label, DomainLabel>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Label: Debug, DomainLabel: Debug> Debug for Strand<Label, DomainLabel>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Label: Default, DomainLabel: Default> Default for Strand<Label, DomainLabel>

Source§

fn default() -> Strand<Label, DomainLabel>

Returns the “default value” for a type. Read more
Source§

impl<'de, Label, DomainLabel> Deserialize<'de> for Strand<Label, DomainLabel>
where Label: Deserialize<'de>, DomainLabel: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<Label, DomainLabel> Serialize for Strand<Label, DomainLabel>
where Label: Serialize, DomainLabel: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<Label, DomainLabel> Freeze for Strand<Label, DomainLabel>
where Label: Freeze,

§

impl<Label, DomainLabel> RefUnwindSafe for Strand<Label, DomainLabel>
where Label: RefUnwindSafe, DomainLabel: RefUnwindSafe,

§

impl<Label, DomainLabel> Send for Strand<Label, DomainLabel>
where Label: Send, DomainLabel: Send,

§

impl<Label, DomainLabel> Sync for Strand<Label, DomainLabel>
where Label: Sync, DomainLabel: Sync,

§

impl<Label, DomainLabel> Unpin for Strand<Label, DomainLabel>
where Label: Unpin, DomainLabel: Unpin,

§

impl<Label, DomainLabel> UnwindSafe for Strand<Label, DomainLabel>
where Label: UnwindSafe, DomainLabel: UnwindSafe,

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Component + Float, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<Swp, Dwp, T>,

Convert the source color to the destination color using the specified method
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,