{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Multi-tube design example for orthogonal systems (simple)\n", "\n", "Design N orthogonal strand displacement gates. \n", "\n", "See the accompanying design specification (PDF file). See also the LaTeX spec file that you can edit to make your own design specs in a standardized format.\n", "\n", "This is a 1-step reaction. To design N orthogonal gates, there are 2 elementary step tubes per gate plus 1 global crosstalk tube. \n", "\n", "Target test tubes: \n", "- (Step 0: Reactants) x N orthogonal systems\n", "- (Step 1: Products) x N orthogonal systems\n", "- Global crosstalk\n", "\n", "Material: RNA \n", "Temperature: 23 C" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Import Python NUPACK module\n", "from nupack import *" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Domain results:\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DomainSequence
da[0]
CAUACUCCGA
da[0]*
UCGGAGUAUG
da[1]
CACAUGAUUC
da[1]*
GAAUCAUGUG
da[2]
GAACAAGCUA
da[2]*
UAGCUUGUUC
da[3]
CCUUUCUCUC
da[3]*
GAGAGAAAGG
db[0]
AACCCAAC
db[0]*
GUUGGGUU
db[1]
AGAAACGC
db[1]*
GCGUUUCU
db[2]
AACCACAG
db[2]*
CUGUGGUU
db[3]
CUUUCUAC
db[3]*
GUAGAAAG
Strand results:\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
StrandSequence
sA_toe[2]
CUGUGGUU
sB[2]
GAACAAGCUA
sX[1]
CACAUGAUUCAGAAACGC
sX[2]
GAACAAGCUAAACCACAG
sA[2]
CUGUGGUUUAGCUUGUUC
sA_toe[1]
GCGUUUCU
sA_toe[0]
GUUGGGUU
sA_toe[3]
GUAGAAAG
sX[0]
CAUACUCCGAAACCCAAC
sA[3]
GUAGAAAGGAGAGAAAGG
sB[0]
CAUACUCCGA
sX[3]
CCUUUCUCUCCUUUCUAC
sA[0]
GUUGGGUUUCGGAGUAUG
sB[3]
CCUUUCUCUC
sA[1]
GCGUUUCUGAAUCAUGUG
sB[1]
CACAUGAUUC
Objective function:\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Objective typeValue
Weighted ensemble defect0.0187
Ensemble defect: 0.0140

On-target complex defects:\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ComplexComplex defect (nt)Normalized complex defect
cX[3]0.002980.000165
cAB[2]0.6890.0246
cXA[3]0.1890.00526
cX[1]0.6590.0366
cA_toe[1]0.01490.00186
cB[0]0.03090.00309
cXA[2]0.2260.00629
cB[2]0.06990.00699
cAB[0]0.5870.0209
cX[0]0.1910.0106
cAB[3]0.1390.00497
cA_toe[3]0.002580.000323
cXA[0]0.2540.00707
cA_toe[2]0.01070.00134
cXA[1]0.1910.00531
cA_toe[0]0.001420.000177
cX[2]0.3830.0213
cB[3]0.000.00
cAB[1]0.1910.00681
cB[1]0.03770.00377
Tube defects:\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TubeTube defect (M)Normalized tube defect
reactants[0]8.52e-090.0185
products[0]2.85e-090.00620
reactants[1]1.53e-080.0333
products[1]2.32e-090.00504
reactants[2]1.57e-080.0341
products[2]3.06e-090.00666
reactants[3]1.81e-090.00394
products[3]1.89e-090.00412
crosstalk3.62e-080.0141
Complex contributions to tube defects:\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TubeOn-target complexStructural defect (M)Concentration defect (M)Total defect (M)
reactants[0]cX[0]1.91e-096.42e-131.91e-09
reactants[0]cAB[0]5.85e-097.63e-106.61e-09
products[0]cXA[0]2.54e-094.72e-142.54e-09
products[0]cB[0]3.09e-101.20e-133.09e-10
reactants[1]cX[1]6.54e-091.31e-097.85e-09
reactants[1]cAB[1]1.87e-095.59e-097.46e-09
products[1]cXA[1]1.91e-093.87e-141.91e-09
products[1]cB[1]3.77e-102.90e-114.06e-10
reactants[2]cX[2]3.83e-091.44e-103.97e-09
reactants[2]cAB[2]6.76e-094.97e-091.17e-08
products[2]cXA[2]2.26e-094.94e-142.26e-09
products[2]cB[2]6.98e-109.88e-117.97e-10
reactants[3]cX[3]2.98e-113.17e-162.98e-11
reactants[3]cAB[3]1.39e-093.94e-101.78e-09
products[3]cXA[3]1.89e-091.15e-131.89e-09
products[3]cB[3]0.003.22e-143.22e-14
crosstalkcX[0]1.89e-091.55e-093.44e-09
crosstalkcAB[0]5.86e-092.84e-106.14e-09
crosstalkcA_toe[0]1.41e-112.41e-102.55e-10
crosstalkcB[0]3.09e-100.003.09e-10
crosstalkcX[1]6.52e-091.74e-098.26e-09
crosstalkcAB[1]1.91e-091.26e-102.03e-09
crosstalkcA_toe[1]1.47e-106.18e-107.66e-10
crosstalkcB[1]3.77e-103.48e-114.12e-10
crosstalkcX[2]3.82e-096.33e-104.45e-09
crosstalkcAB[2]6.88e-099.08e-116.97e-09
crosstalkcA_toe[2]1.07e-101.11e-102.18e-10
crosstalkcB[2]6.98e-101.62e-108.60e-10
crosstalkcX[3]2.98e-115.26e-118.24e-11
crosstalkcAB[3]1.39e-096.26e-131.39e-09
crosstalkcA_toe[3]2.57e-112.40e-102.65e-10
crosstalkcB[3]0.003.05e-103.05e-10
On-target complex concentrations:\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TubeComplexConcentration (M)Target concentration (M)
reactants[0]cX[0]1.00e-081.00e-08
reactants[0]cAB[0]9.97e-091.00e-08
products[0]cXA[0]1.00e-081.00e-08
products[0]cB[0]1.00e-081.00e-08
reactants[1]cX[1]9.93e-091.00e-08
reactants[1]cAB[1]9.80e-091.00e-08
products[1]cXA[1]1.00e-081.00e-08
products[1]cB[1]1.00e-081.00e-08
reactants[2]cX[2]9.99e-091.00e-08
reactants[2]cAB[2]9.82e-091.00e-08
products[2]cXA[2]1.00e-081.00e-08
products[2]cB[2]9.99e-091.00e-08
reactants[3]cX[3]1.00e-081.00e-08
reactants[3]cAB[3]9.99e-091.00e-08
products[3]cXA[3]1.00e-081.00e-08
products[3]cB[3]1.00e-081.00e-08
crosstalkcX[0]9.91e-091.00e-08
crosstalkcAB[0]9.99e-091.00e-08
crosstalkcA_toe[0]9.97e-091.00e-08
crosstalkcB[0]1.00e-081.00e-08
crosstalkcX[1]9.90e-091.00e-08
crosstalkcAB[1]1.00e-081.00e-08
crosstalkcA_toe[1]9.92e-091.00e-08
crosstalkcB[1]1.00e-081.00e-08
crosstalkcX[2]9.96e-091.00e-08
crosstalkcAB[2]1.00e-081.00e-08
crosstalkcA_toe[2]9.99e-091.00e-08
crosstalkcB[2]9.98e-091.00e-08
crosstalkcX[3]1.00e-081.00e-08
crosstalkcAB[3]1.00e-081.00e-08
crosstalkcA_toe[3]9.97e-091.00e-08
crosstalkcB[3]9.97e-091.00e-08
\n", "\n", "Significant off-target complex concentrations (≥ 1% max complex concentration in tube):\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TubeComplexConcentration (M)
reactants[1](sA[1])2.00e-10
reactants[1]cB[1]2.00e-10
reactants[2](sA[2])1.77e-10
reactants[2]cB[2]1.77e-10
products[3]
reactants[0]
reactants[3]
products[2]
products[1]
products[0]
crosstalk
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Define physical model\n", "my_model = Model(material='rna', celsius=23)\n", "\n", "# Set number of orthogonal systems\n", "systems = 4 \n", "\n", "# Initialize working variables\n", "crosstalk_targets = {}\n", "crosstalk_excludes = []\n", "step_tubes = []\n", "\n", "# Loop over orthogonal systems\n", "for i in range(systems):\n", " \n", " # Define sequence domains\n", " da = Domain('N10', name=['da', i])\n", " db = Domain('N8', name=['db', i])\n", "\n", " # Define strands containing these domains\n", " sX = TargetStrand([da, db], name=['sX', i])\n", " sA = TargetStrand([~db, ~da], name=['sA', i])\n", " sB = TargetStrand([da], name=['sB', i]) # ~dgate is the reverse complement of dgate\n", " sA_toe = TargetStrand([~db], name=['sA_toe', i])\n", " \n", " # Define target complexes\n", " cX = TargetComplex([sX], 'U18', name=['cX', i])\n", " cAB = TargetComplex([sA, sB], 'U8D10+', name=['cAB', i])\n", " cXA = TargetComplex([sX, sA], 'D18+', name=['cXA', i])\n", " cB = TargetComplex([sB], 'U10', name=['cB', i])\n", " cA_toe = TargetComplex([sA_toe], 'U8', name=['cA_toe', i])\n", " \n", " # Define 2 elementary step tubes for each orthogonal system\n", " step0_tube = TargetTube(on_targets={cX: 1e-08, cAB: 1e-08}, \n", " off_targets=SetSpec(max_size=2, exclude=[cXA]), name=['reactants', i])\n", " step1_tube = TargetTube(on_targets={cXA: 1e-08, cB: 1e-08}, \n", " off_targets=SetSpec(max_size=2), name=['products', i])\n", " step_tubes += [step0_tube, step1_tube]\n", " \n", " # Store contributions to global crosstalk tube\n", " crosstalk_targets.update({cX: 1e-08, cAB: 1e-08, cA_toe: 1e-08, cB:1e-8})\n", " crosstalk_excludes += [cXA, [sX, sA_toe]]\n", " \n", "# Define 1 global crosstalk tube \n", "crosstalk_tube = TargetTube(on_targets=crosstalk_targets, \n", " off_targets=SetSpec(max_size=2, exclude=crosstalk_excludes), name='crosstalk')\n", "\n", "# Define tube set \n", "my_tubes = step_tubes + [crosstalk_tube] \n", " \n", "# Define defect weight of N for global crosstalk tube \n", "# (maintain balance between elementary step tubes and global crosstalk tube as number of \n", "# orthogonal systems increases) \n", "my_weights = Weights(my_tubes)\n", "my_weights[:,:,:,crosstalk_tube] *= systems\n", "\n", "# Set a stop condition of 2% \n", "# Set seed for random number generation to get a reproducible result for this demo\n", "my_options = DesignOptions(f_stop=0.02, seed=93)\n", "\n", "# Define and run the test tube design job\n", "my_design = tube_design(tubes=my_tubes, defect_weights=my_weights, model=my_model, options=my_options)\n", "my_results = my_design.run(trials=1)[0]\n", "\n", "# Display the design results\n", "my_results" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.8" } }, "nbformat": 4, "nbformat_minor": 4 }