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 Design<(), ()>
impl Design<(), ()>
Sourcepub fn from_cadnano<P: AsRef<Path>>(file: P) -> Self
pub fn from_cadnano<P: AsRef<Path>>(file: P) -> Self
Create a design from a cadnano file
Source§impl<S, T> Design<S, T>
impl<S, T> Design<S, T>
Sourcepub fn separate_helix(&mut self, n: usize)
pub fn separate_helix(&mut self, n: usize)
Cut helix n into several contiguous helices
Sourcepub fn get_interval_helix(&self, n: usize) -> Option<(isize, isize)>
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.
Sourcepub fn separate_all_helices(&mut self)
pub fn separate_all_helices(&mut self)
Apply separate_helix
on all helices
Source§impl<StrandLabel: Serialize, DomainLabel: Serialize> Design<StrandLabel, DomainLabel>
impl<StrandLabel: Serialize, DomainLabel: Serialize> Design<StrandLabel, DomainLabel>
Sourcepub fn square_grid_helix(&self, h: isize, v: isize) -> Helix
pub fn square_grid_helix(&self, h: isize, v: isize) -> Helix
Creates a flat helix (in the z = 0
plane).
Sourcepub fn honneycomb_grid_helix(&self, h: isize, v: isize) -> Helix
pub fn honneycomb_grid_helix(&self, h: isize, v: isize) -> Helix
Create an helix on the honneycomb grid
Sourcepub fn adjusted_grid_helix(&self, h: isize, v: isize) -> Helix
pub fn adjusted_grid_helix(&self, h: isize, v: isize) -> Helix
Creates a flat helix in the z = 0
plane with adjusted roll.
Sourcepub fn with_parameters(parameters: Parameters) -> Self
pub fn with_parameters(parameters: Parameters) -> Self
Initiates a design with the given geometric parameters.
Sourcepub fn add_grid_helix(&mut self, h: isize, v: isize) -> HelixId
pub fn add_grid_helix(&mut self, h: isize, v: isize) -> HelixId
Add a helix created by Self::square_grid_helix
.
Sourcepub fn add_honneycomb_helix(&mut self, h: isize, v: isize) -> HelixId
pub fn add_honneycomb_helix(&mut self, h: isize, v: isize) -> HelixId
Add a helix created by Self::honneycomb_grid_helix
.
Sourcepub fn add_adjusted_grid_helix(&mut self, h: isize, v: isize) -> HelixId
pub fn add_adjusted_grid_helix(&mut self, h: isize, v: isize) -> HelixId
Add a helix created by Self::add_grid_helix
.
Sourcepub fn add_helix(
&mut self,
x: f64,
y: f64,
z: f64,
roll: f64,
pitch: f64,
yaw: f64,
) -> HelixId
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.
Sourcepub fn strand<H: Into<HelixId>>(
&mut self,
helix: H,
start: isize,
) -> StrandRef<'_, StrandLabel, DomainLabel>
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
.
Sourcepub fn empty_strand(&mut self) -> StrandRef<'_, StrandLabel, DomainLabel>
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.
Sourcepub fn get_strand_ref(
&mut self,
strand_id: usize,
) -> StrandRef<'_, StrandLabel, DomainLabel>
pub fn get_strand_ref( &mut self, strand_id: usize, ) -> StrandRef<'_, StrandLabel, DomainLabel>
Return a StrandRef that can build the strand strand_id
Sourcepub fn fix_colors(&mut self)
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
Sourcepub fn write_to<P: AsRef<Path>>(&self, p: P) -> Result<(), Error>
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.
Sourcepub fn json_string(&self) -> String
pub fn json_string(&self) -> String
Return a string describing the design in the json format.
Sourcepub fn unique_positions(&self) -> Option<(isize, isize, bool, usize, usize)>
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
Sourcepub fn check_and_write_to<P: AsRef<Path>>(&self, p: P) -> Result<(), Error>
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.
Sourcepub fn get_domain_builder(
&mut self,
h: isize,
x: isize,
b: bool,
) -> &mut Domain<DomainLabel>
pub fn get_domain_builder( &mut self, h: isize, x: isize, b: bool, ) -> &mut Domain<DomainLabel>
Return a domain builder containing the nucleotide
Sourcepub fn get_domain_bound(
&self,
h: isize,
x: isize,
b: bool,
) -> (isize, isize, usize, usize)
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)
Sourcepub fn get_strand_nucl(&self, h: isize, x: isize, b: bool) -> Option<usize>
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
Sourcepub fn cross_nucl(
&mut self,
h1: isize,
x1: isize,
b1: bool,
h2: isize,
x2: isize,
b2: bool,
)
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
Sourcepub fn patch_cross_nucl(
&self,
h1: isize,
x1: isize,
b1: bool,
h2: isize,
x2: isize,
b2: bool,
) -> Option<Patch>
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
Sourcepub fn add_link_helix(
&mut self,
helix_1: usize,
pos_1: isize,
forward_1: bool,
helix_2: usize,
pos_2: isize,
forward_2: bool,
) -> usize
pub fn add_link_helix( &mut self, helix_1: usize, pos_1: isize, forward_1: bool, helix_2: usize, pos_2: isize, forward_2: bool, ) -> usize
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
Source§impl<S, T> Design<S, T>
impl<S, T> Design<S, T>
Sourcepub fn optimize_cross_over(&mut self)
pub fn optimize_cross_over(&mut self)
Optimize locally all the cross over of the design
Sourcepub fn space_pos(&self, h: isize, x: isize, b: bool) -> [f64; 3]
pub fn space_pos(&self, h: isize, x: isize, b: bool) -> [f64; 3]
Return the position in space of the nucleotide (h, x, b)
Sourcepub fn get_cross_overs_helices(
&self,
h1: isize,
h2: isize,
) -> Vec<(isize, bool, isize, bool)>
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
Sourcepub fn adjust_helix(&mut self, h1: usize, h2: usize)
pub fn adjust_helix(&mut self, h1: usize, h2: usize)
Adjust the roll of two helices to minimize the distance at crossing overs
Source§impl<StrandLabel: Ord + Display, DomainLabel> Design<StrandLabel, DomainLabel>
impl<StrandLabel: Ord + Display, DomainLabel> Design<StrandLabel, DomainLabel>
Sourcepub 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,
)
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<'de, StrandLabel, DomainLabel> Deserialize<'de> for Design<StrandLabel, DomainLabel>where
StrandLabel: Deserialize<'de>,
DomainLabel: Deserialize<'de>,
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>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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>
impl<StrandLabel, DomainLabel> Sync for Design<StrandLabel, DomainLabel>
impl<StrandLabel, DomainLabel> Unpin for Design<StrandLabel, DomainLabel>
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
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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