Struct Domain

Source
pub struct Domain<Label> {
    pub helix: isize,
    pub start: isize,
    pub end: isize,
    pub forward: bool,
    pub label: Option<Label>,
    pub sequence: Option<Cow<'static, str>>,
}
Expand description

A domain, i.e. an interval of a helix.

Fields§

§helix: isize

Index of the helix in the array of helices. Indices start at 0.

§start: isize

Position of the leftmost base of this domain along the helix (this might be the first or last base of the domain, depending on the orientation parameter below).

§end: isize

Position of the first base after the forwardmost base of the domain, along the helix. Domains must always be such that domain.start < domain.end.

§forward: bool

If true, the “5’ to 3’” direction of this domain runs in the same direction as the helix, i.e. “to the forward” along the axis of the helix. Else, the 5’ to 3’ runs to the left along the axis.

§label: Option<Label>

An optional label that can be attached to strands.

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

In addition to the strand-level sequence, individual domains may have sequences too. The precedence has to be defined by the user of this library.

Implementations§

Source§

impl<Label> Domain<Label>

Source

pub fn iter(&self) -> DomainIter

Iterate through the positions of this domain, in 5’ to 3’ order (meaning that the values produced by this iterator might be increasing or decreasing).

Source

pub fn translate(self, dx: isize, dy: isize) -> Self

Translate this domain. The first parameter is the translation along the helix, the second one is a translation across helices (probably most meaningful for a flat design).

Source

pub fn shift_x(self, dx: isize) -> Self

Translate this domain along its helix.

Source

pub fn shift_y(self, dy: isize) -> Self

Translate this domain to a different helix (probably most meaningful for a flat design).

Source

pub fn length(&self) -> isize

Number of Nucleotides on the domain

Source

pub fn pseudo_copy(&self) -> Self

Return a domain that has the same bounds as self

Source

pub fn contains(&self, h: isize, x: isize, b: bool) -> bool

Return true iff self contains the nucleotide (h, x, b)

Source

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

Return the first nucl of self or None if self is empty

Source

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

Return the last nucl of self or None if self is empty

Trait Implementations§

Source§

impl<Label: Clone> Clone for Domain<Label>

Source§

fn clone(&self) -> Domain<Label>

Returns a copy 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> Debug for Domain<Label>

Source§

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

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

impl<Label: Default> Default for Domain<Label>

Source§

fn default() -> Domain<Label>

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

impl<'de, Label> Deserialize<'de> for Domain<Label>
where Label: 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> Serialize for Domain<Label>
where Label: 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> Freeze for Domain<Label>
where Label: Freeze,

§

impl<Label> RefUnwindSafe for Domain<Label>
where Label: RefUnwindSafe,

§

impl<Label> Send for Domain<Label>
where Label: Send,

§

impl<Label> Sync for Domain<Label>
where Label: Sync,

§

impl<Label> Unpin for Domain<Label>
where Label: Unpin,

§

impl<Label> UnwindSafe for Domain<Label>
where Label: 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>,