Note: requires DSDdiagramV1.wl to be loaded.

SetDirectory[NotebookDirectory[]];

Domain-level parens-plus notation

Each single-stranded domain is represented by a domain name, each double-stranded domain by  a domain name and matching parentheses, and each nick between strands by a plus. Adjacent domains and nicks are separated by a space. 

For example, the following molecule can be defined as string  S( + ) T* 

When defining a complex, strands must be listed in an order such that every subsequent strand binds to a previous strand.  For example, the following complex can be defined as string  S2( + ) T*( S1*( T* + ) ) but not as  S1( T( + S2( + ) ) ) T*

If desired, you may use AutoShift to find a strand order that satisfies the above requirement. For example,  
AutoShift[“S1( T( + S2( + ) ) ) T*”] produces string  S2( + ) T*( S1*( T* + ) )

An angle can be introduced between domains by @degree. For example, S1( T( @60 S2 + ) ) T*

Surface CRNs: unimolecular (Qian et. al. 2014)

(* assign domain sequences *)
T1="CTCCTC";
T2="ACACAC";
X="CTTCTACTTCATAAC";
RA="CATTTCAACTAAACC";
A="CATCTCATTCTAAAC";
B="CTTACATTTCAACAC";

(* assign domain colors *)
cl["T1"]=1;
cl["T2"]=2;
cl["X"]=-1;
cl["RA"]=3;
cl["A"]=5;
cl["B"]=4;

(* define strands and complexes *)
gateRAtoB="@90 RA( + ) @90 X*( + B ) @90 T2*";

diagramDSD[gateRAtoB,SquiggleToehold->True,LineBasepair->True,DistinctComplement->False]

diagramDSD[gateRAtoB,SquiggleToehold->True,DistinctComplement->False,DNASequence->True]

Default style

diagramDSD[gateRAtoB]

Note: if the dashed lines are not properly displayed on your computer, try using option VectorFormat->False.

diagramDSD[gateRAtoB,VectorFormat->False]

Alternative style A

(* assign domain colors *)
cl["T1"]=-1;
cl["T2"]=-1;
cl["X"]=-1;
cl["RA"]=-1;
cl["A"]=-1;
cl["B"]=-1;

diagramDSD[gateRAtoB,SquiggleToehold->True,DistinctComplement->False]

Alternative style B

(* assign domain colors *)
cl["T1"]=1;
cl["T2"]=2;
cl["X"]=-1;
cl["RA"]=-1;
cl["A"]=-1;
cl["B"]=-1;

diagramDSD[gateRAtoB,GreyBasepair->True,DomainSeparator->True,DistinctComplement->False]

Alternative style C

(* assign domain colors *)
cl["T1"]=1;
cl["T2"]=2;
cl["X"]=-1;
cl["RA"]=3;
cl["A"]=5;
cl["B"]=4;

diagramDSD[gateRAtoB,SquiggleToehold->True,LineBasepair->True,DistinctComplement->False]

Alternative style D

(* assign domain colors *)
cl["T1"]=1;
cl["T2"]=2;
cl["X"]=-1;
cl["RA"]=3;
cl["A"]=5;
cl["B"]=4;

diagramDSD[gateRAtoB,DotBasepair->True,DistinctComplement->False]

Displace sequences

diagramDSD[gateRAtoB,DNASequence->True]

Export diagrams

Export["gateRAtoB.pdf",diagramDSD[gateRAtoB]];
Export["gateRAtoB.svg",diagramDSD[gateRAtoB]];
Export["gateRAtoB.png",diagramDSD[gateRAtoB,VectorFormat->False],ImageResolution->200];

Export["gateRAtoB_SEQ.pdf",diagramDSD[gateRAtoB,DNASequence->True]];
Export["gateRAtoB_SEQ.svg",diagramDSD[gateRAtoB,DNASequence->True]];
Export["gateRAtoB_SEQ.png",diagramDSD[gateRAtoB,DNASequence->True,VectorFormat->False],ImageResolution->200];

Hairpin motif (Yin et. al. 2008)

(* assign domain sequences *)
a="GCTTGA";
b="AGGGAG";
c="GTTGTG";
x="GATGTT";
y="TAGTGC";
z="ATTGGA";

(* assign domain colors *)
cl["a"]=1;
cl["b"]=3;
cl["c"]=5;
cl["x"]=2;
cl["y"]=4;
cl["z"]=6;

(* define strands and complexes *)
strandI="y* b* x* a*";
gateA="a x( b( y( z* c* ) ) )";
gateB="b y( c( z( x* a* ) ) )";
gateC="c z( a( x( y* b* ) ) )";
complexABC="a( x( b( y( z*( c*( y*( b*( x* + ) ) ) ) x*( a*( z*( c*( y* + ) ) ) ) ) ) ) ) z*";

diagramDSD[gateB,DistinctComplement->False,LineBasepair->True]

Export["Yin2008gateB.pdf",diagramDSD[gateB,DistinctComplement->False,LineBasepair->True]];

diagramDSD[gateB,DistinctComplement->False,DNASequence->True]

Export["Yin2008gateB_SEQ.pdf",diagramDSD[gateB,DistinctComplement->False,DNASequence->True]];

Use AddTurns

Note : AddTurns attempts to calculate the number of branches in a complex and add a turn at each branching point.

AddTurns[complexABC]

diagramDSD[AddTurns[complexABC],DistinctComplement->False,LineBasepair->True]

Export["Yin2008complexABC.pdf",diagramDSD[AddTurns[complexABC],DistinctComplement->False,LineBasepair->True]];

diagramDSD[AddTurns[complexABC],DistinctComplement->False,DNASequence->True]

Export["Yin2008complexABC_SEQ.pdf",diagramDSD[AddTurns[complexABC],DistinctComplement->False,DNASequence->True]];

CRNs (Soloveichik et. al. 2010)

(* assign domain sequences *)
S1="NNNNNN";
S2="NNNNNNNNNNNNNNN";
S3="NNNNNN";
S4="NNNNNN";
S5="NNNNNNNNNNNNNNN";
S6="NNNNNN";
S7="NNNNNN";
S8="NNNNNNNNNNNNNNN";
S9="NNNNNN";
S10="NNNNNNNNNNNNNNN";
S11="NNNNNNNNNNNNNNN";

(* assign domain colors *)
cl["S1"]=1;
cl["S2"]=-1;
cl["S3"]=1;
cl["S4"]=2;
cl["S5"]=-1;
cl["S6"]=2;
cl["S7"]=3;
cl["S8"]=-1;
cl["S9"]=3;
cl["S10"]=-1;
cl["S11"]=-1;

(* define strands and complexes *)
complexT="S10( S4( S5 S6 + S11( S7( S8 S9 + ) ) ) ) S3*";

Use AutoShift

Note: when defining a complex, strands must be listed in an order such that every new strand will be attached to a previously listed strand.  AutoShift attempts to find a strand order that satisfies this requirement.

AutoShift[complexT]

(* copy and edit the AutoShift output, e.g. to add turns to the single-stranded domains *)

complexT="S11( S7( @60 S8 S9 + ) ) S4*( S10*( S3* + ) ) @60 S5 S6";

diagramDSD[complexT,SquiggleToehold->True,DistinctComplement->False,LineBasepair->True]

Display nicks

Note : use “:” at the left or right side of a domain to clearly display a nick at the 5’ or 3’ end of the domain.

complexT=":S11( S7( @60 S8 S9 + ) ) S4*( S10*( S3* + ) ) @60 S5 S6";

diagramDSD[complexT,SquiggleToehold->True,DistinctComplement->False,LineBasepair->True]

Export["Soloveichik2010complexT.pdf",diagramDSD[complexT,SquiggleToehold->True,DistinctComplement->False,LineBasepair->True]];

Seesaw motif (Qian et. al. 2011)

(* assign domain sequences *)
T="TCTAC";
S5="CACCACCAAACTTCA";
S6="CATAACACAATCACA";

(* assign domain colors *)
cl["T"]=1;
cl["S5"]=4;
cl["S6"]=3;

(* define strands and complexes *)
Gate56="S5( T( @60 S6 + ) ) T*";

diagramDSD[Gate56,DistinctComplement->False]

diagramDSD[Gate56,DistinctComplement->False,DNASequence->True]

Reverse the strand orientation

Note : the default strand orientation is from 5’ to 3’. Use “ReverseOrient->True” to reverse the strand orientation.

diagramDSD[Gate56,DistinctComplement->False,ReverseOrient->True]

diagramDSD[Gate56,DistinctComplement->False,ReverseOrient->True,DNASequence->True]

Export["SeesawGate56.pdf",diagramDSD[Gate56,DistinctComplement->False,ReverseOrient->True]];

Change the font size of domain labels

Note : the default font size of domain labels is 24. Use “DomainLabelSize->FontSize” to make the labels larger or smaller.

diagramDSD[Gate56,DistinctComplement->False,ReverseOrient->True,DomainLabelSize->32]

Export["SeesawGate56.pdf",diagramDSD[Gate56,DistinctComplement->False,ReverseOrient->True]];

Add fluorophores and quenchers

Note : fluorophores and quenchers are treated as special domains with a “_” in front of the names.

(* assign fluorophore and quencher labels *)
F="ROX";
Q="RQ";

(* assign fluorophore and quencher colors *)
cl["F"]=RGBColor[0.7,0,0];
cl["Q"]=Black;

(* define strands and complexes *)
Rep6="S6( _Q + _F ) T*";

diagramDSD[Rep6,DistinctComplement->False]

Export["SeesawRep6.pdf",diagramDSD[Rep6,DistinctComplement->False]];