Struct Design

Source
pub struct Design<StrandLabel, DomainLabel> {
    pub version: String,
    pub helices: Vec<Helix>,
    pub strands: Vec<Strand<StrandLabel, DomainLabel>>,
    pub parameters: Option<Parameters>,
}
Expand description

The main type of this crate, describing a DNA design.

Fields§

§version: String

Version of this format.

§helices: Vec<Helix>

The vector of all helices used in this design. Helices have a position and an orientation in 3D.

§strands: Vec<Strand<StrandLabel, DomainLabel>>

The vector of strands.

§parameters: Option<Parameters>

Parameters of DNA geometry. This can be skipped (in JSON), or set to None in Rust, in which case a default set of parameters from the literature is used.

Implementations§

Source§

impl<StrandLabel, DomainLabel> Design<StrandLabel, DomainLabel>

Source

pub fn to_cadnano<W: Write>( &mut self, w: W, try_do_skip: bool, grid_type: GridType, ) -> Result<(), Error>

Output a design in Cadnano format.

Source§

impl Design<(), ()>

Source

pub fn from_cadnano<P: AsRef<Path>>(file: P) -> Self

Create a design from a cadnano file

Source§

impl<StrandLabel, DomainLabel> Design<StrandLabel, DomainLabel>

Source

pub fn to_mrdna<W: Write>(&self, w: W) -> Result<(), Error>

Output a design in Cadnano format.

Source§

impl<S, T> Design<S, T>

Source

pub fn separate_helix(&mut self, n: usize)

Cut helix n into several contiguous helices

Source

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

Return the interval (m, M) where m is the leftmost nucleotide on helix m and M the rightmost.

Source

pub fn separate_all_helices(&mut self)

Apply separate_helix on all helices

Source

pub fn guess_bfs(&mut self, separate: bool)

guess a 3d form of the design by doing a bfs

Source§

impl<StrandLabel: Serialize, DomainLabel: Serialize> Design<StrandLabel, DomainLabel>

Source

pub fn new() -> Self

Initiates a design.

Source

pub fn square_grid_helix(&self, h: isize, v: isize) -> Helix

Creates a flat helix (in the z = 0 plane).

Source

pub fn honneycomb_grid_helix(&self, h: isize, v: isize) -> Helix

Create an helix on the honneycomb grid

Source

pub fn adjusted_grid_helix(&self, h: isize, v: isize) -> Helix

Creates a flat helix in the z = 0 plane with adjusted roll.

Source

pub fn with_parameters(parameters: Parameters) -> Self

Initiates a design with the given geometric parameters.

Source

pub fn add_grid_helix(&mut self, h: isize, v: isize) -> HelixId

Add a helix created by Self::square_grid_helix.

Source

pub fn add_honneycomb_helix(&mut self, h: isize, v: isize) -> HelixId

Add a helix created by Self::honneycomb_grid_helix.

Source

pub fn add_adjusted_grid_helix(&mut self, h: isize, v: isize) -> HelixId

Add a helix created by Self::add_grid_helix.

Source

pub fn add_helix( &mut self, x: f64, y: f64, z: f64, roll: f64, pitch: f64, yaw: f64, ) -> HelixId

Add an arbitrary helix. Parameters x,y,z are in nanometers and are the 3D coordinates of the centre of the helix. roll,pitch,yaw are in radians.

Source

pub fn strand<H: Into<HelixId>>( &mut self, helix: H, start: isize, ) -> StrandRef<'_, StrandLabel, DomainLabel>

Start a strand, placing the first base at the position given by helix and start.

Source

pub fn empty_strand(&mut self) -> StrandRef<'_, StrandLabel, DomainLabel>

Create a strand with no initial domain. Useful for adding custom domains, for example domains obtained by geometric operations from other domains.

Source

pub fn get_strand_ref( &mut self, strand_id: usize, ) -> StrandRef<'_, StrandLabel, DomainLabel>

Return a StrandRef that can build the strand strand_id

Source

pub fn fix_colors(&mut self)

Set all the colors of the strands to Some(). For each strand, if the color is Some(), it is not modified. If the color is none, it is set to Some(s.default_color()) where n depends on the position of the 5’ end of the strand

Source

pub fn write(&self) -> Result<(), Error>

Write this design to the standard output.

Source

pub fn write_to<P: AsRef<Path>>(&self, p: P) -> Result<(), Error>

Write this design to a file. If the REMOTE environment variable is set, write it to the standard output instead.

Source

pub fn json_string(&self) -> String

Return a string describing the design in the json format.

Source

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

Tests whether all bases have different positions, and returns an offending strand else. The return format is (helix, position, orientation, i, j), where i and j are the indices of two strands sharing this position. Bases that are the start/end of a cycle are not detected and do not cause their strand to be offending

Source

pub fn check_and_write_to<P: AsRef<Path>>(&self, p: P) -> Result<(), Error>

Tests whether all bases have different positions, and warns the user otherwise. Write this design to a file. If the REMOTE environment variable is set, write it to the standard output instead.

Source

pub fn get_domain_builder( &mut self, h: isize, x: isize, b: bool, ) -> &mut Domain<DomainLabel>

Return a domain builder containing the nucleotide

Source

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

Return the bounds of the domain containing nucleotide (h, x, b)

Source

pub fn get_strand_nucl(&self, h: isize, x: isize, b: bool) -> Option<usize>

Return Some(s) if the nucleotide is on the strand s. Return None if the nucleotide is not in the design

Source

pub fn cross_nucl( &mut self, h1: isize, x1: isize, b1: bool, h2: isize, x2: isize, b2: bool, )

Create a cross over between the two nucleotides if they are the extremities of strands that can be merged

Source

pub fn patch_cross_nucl( &self, h1: isize, x1: isize, b1: bool, h2: isize, x2: isize, b2: bool, ) -> Option<Patch>

Return a patch that creates a cross over between two nucleotides if they are the extremities of strands that can be merged. Return None otherwise

Source

pub fn overlap(&self, h: &Helix) -> bool

True iff one of the helices of self overlaps h

Create an helix whose axis is the line that goes from helix_1.axis_pos(pos_1) to helix_2.axis_pos(pos_2). To avoid helices colision, the helix is shifted in the positive direction if forward_i == true or in the negative direction if forward_i == false

Create a strand on support_helix that goes from the nucleotide from_nucl of helix from_helix to the nucleotide to_nucl of to_helix

Source§

impl<S, T> Design<S, T>

Source

pub fn auto_roll(&mut self)

Adjust the roll of the Helices to make better cross overs

Source

pub fn clean_up(&mut self)

Remove empty domains and empty strands

Source

pub fn optimize_cross_over(&mut self)

Optimize locally all the cross over of the design

Source

pub fn space_pos(&self, h: isize, x: isize, b: bool) -> [f64; 3]

Return the position in space of the nucleotide (h, x, b)

Source

pub fn get_cross_overs_helices( &self, h1: isize, h2: isize, ) -> Vec<(isize, bool, isize, bool)>

Return the list of cross-overs between two helices

Source

pub fn adjust_helix(&mut self, h1: usize, h2: usize)

Adjust the roll of two helices to minimize the distance at crossing overs

Source

pub fn get_overlapping_nucl(&self) -> HashMap<(isize, isize, bool), Vec<usize>>

Return a HashMap mapping all nucleotides through which more than two strands pass, to the set of strands that pass through that nucleotide.

Source

pub fn get_nucl_map(&self) -> HashMap<(isize, isize, bool), Vec<usize>>

Return a HashMap that map all the nucleotide of the disign to the set of strands that pass through it.

Source§

impl<StrandLabel, DomainLabel> Design<StrandLabel, DomainLabel>

Source

pub fn sequences(&self) -> Vec<String>

Output all the sequences of the strands whose sequence has not been forced.

Source§

impl<StrandLabel: Ord + Display, DomainLabel> Design<StrandLabel, DomainLabel>

Source

pub fn make_plates_96<H: FnMut(&Strand<StrandLabel, DomainLabel>) -> usize, F: FnMut(&Strand<StrandLabel, DomainLabel>) -> Option<bool>, G: FnMut(usize) -> String>( &mut self, file: &str, seq_class: H, filter: F, format: G, )

Output plates with the sequences, ordered by label, as an Excel spreadsheet that can be ordered from the IDT website.

All strands s such that filter(s).is_some() are included, and only those. Moreover, if filter(s) == Some(true), a new plate is started if the current plate is nonempty.

Moreover, strands are ran through the filter function in the same order as they are in self.

Trait Implementations§

Source§

impl<StrandLabel: Clone, DomainLabel: Clone> Clone for Design<StrandLabel, DomainLabel>

Source§

fn clone(&self) -> Design<StrandLabel, DomainLabel>

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<'de, StrandLabel, DomainLabel> Deserialize<'de> for Design<StrandLabel, DomainLabel>
where StrandLabel: 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<StrandLabel, DomainLabel> Serialize for Design<StrandLabel, DomainLabel>
where StrandLabel: 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<StrandLabel, DomainLabel> Freeze for Design<StrandLabel, DomainLabel>

§

impl<StrandLabel, DomainLabel> RefUnwindSafe for Design<StrandLabel, DomainLabel>
where StrandLabel: RefUnwindSafe, DomainLabel: RefUnwindSafe,

§

impl<StrandLabel, DomainLabel> Send for Design<StrandLabel, DomainLabel>
where StrandLabel: Send, DomainLabel: Send,

§

impl<StrandLabel, DomainLabel> Sync for Design<StrandLabel, DomainLabel>
where StrandLabel: Sync, DomainLabel: Sync,

§

impl<StrandLabel, DomainLabel> Unpin for Design<StrandLabel, DomainLabel>
where StrandLabel: Unpin, DomainLabel: Unpin,

§

impl<StrandLabel, DomainLabel> UnwindSafe for Design<StrandLabel, DomainLabel>
where StrandLabel: 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>,