def main():
    length = 16
    helices = [sc.Helix(max_offset=length, grid_position=(h, v, 0))
               for v in range(-4, 6) for h in range(-4, 6)]
    design = sc.DNADesign(helices=helices, strands=[], grid=sc.hexagonal)

    return design
Esempio n. 2
0
def main():
    # helices
    helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)]

    # left staple
    stap_left_ss1 = sc.Domain(helix=1, forward=True, start=8, end=24)
    stap_left_ss0 = sc.Domain(helix=0, forward=False, start=8, end=24)
    stap_left = sc.Strand(domains=[stap_left_ss1, stap_left_ss0])

    # right staple
    stap_right_ss0 = sc.Domain(helix=0, forward=False, start=24, end=40)
    stap_right_ss1 = sc.Domain(helix=1, forward=True, start=24, end=40)
    stap_right = sc.Strand(domains=[stap_right_ss0, stap_right_ss1])
    stap_right.set_modification_5p(mod.biotin_5p)

    # scaffold
    scaf_ss1_left = sc.Domain(helix=1, forward=False, start=8, end=24)
    scaf_ss0 = sc.Domain(helix=0, forward=True, start=8, end=40)
    loopout = sc.Loopout(length=3)
    scaf_ss1_right = sc.Domain(helix=1, forward=False, start=24, end=40)
    scaf = sc.Strand(domains=[scaf_ss1_left, scaf_ss0, loopout, scaf_ss1_right], is_scaffold=True)

    # whole design
    design = sc.DNADesign(helices=helices, strands=[scaf, stap_left, stap_right], grid=sc.square)

    # deletions and insertions added to design are added to both strands on a helix
    design.add_deletion(helix=1, offset=20)
    design.add_insertion(helix=0, offset=14, length=1)
    design.add_insertion(helix=0, offset=26, length=2)

    # also assigns complement to strands other than scaf bound to it
    design.assign_dna(scaf, 'AACGT' * 18)

    return design
Esempio n. 3
0
def main():
    length = 16
    helices = [
        sc.Helix(major_tick_distance=4,
                 max_offset=length,
                 position=sc.Position3D(x=0, y=0, z=0),
                 min_offset=0),
        sc.Helix(major_tick_distance=4,
                 max_offset=length,
                 position=sc.Position3D(x=0, y=3, z=3),
                 min_offset=8),
        sc.Helix(major_tick_distance=4,
                 max_offset=length,
                 position=sc.Position3D(x=2.5, y=-3, z=8),
                 min_offset=0),
        sc.Helix(major_tick_distance=4,
                 max_offset=length,
                 position=sc.Position3D(x=2.5, y=1, z=11),
                 min_offset=8),
    ]
    design = sc.DNADesign(helices=helices,
                          strands=[
                              sc.Strand([sc.Domain(0, True, 0, length)]),
                              sc.Strand([sc.Domain(1, True, 8, length)]),
                              sc.Strand([sc.Domain(2, True, 0, length)]),
                              sc.Strand([sc.Domain(3, True, 8, length)]),
                          ],
                          grid=sc.Grid.none)

    return design
def main():
    length = 10
    helices = [
        sc.Helix(max_offset=length,
                 position=sc.Position3D(x=2.5, y=0, z=0),
                 pitch=0,
                 roll=0,
                 yaw=0),
        sc.Helix(max_offset=length,
                 position=sc.Position3D(x=0, y=3, z=3),
                 pitch=0,
                 roll=0,
                 yaw=0),
        sc.Helix(max_offset=length,
                 position=sc.Position3D(x=0, y=-3, z=8),
                 pitch=0,
                 roll=0,
                 yaw=0),
        sc.Helix(max_offset=length,
                 position=sc.Position3D(x=0, y=1, z=11),
                 pitch=0,
                 roll=0,
                 yaw=0),
    ]
    stap_ss = sc.Domain(0, True, 0, length)
    scaf_ss = sc.Domain(0, False, 0, length)
    stap = sc.Strand([stap_ss])
    scaf = sc.Strand([scaf_ss], color=sc.default_scaffold_color)
    strands = [stap, scaf]
    design = sc.DNADesign(helices=helices, strands=strands, grid=sc.Grid.none)

    return design
def main():
    blue = sc.Color(r=0, g=0, b=255)
    black = sc.Color(r=0, g=0, b=0)
    red = sc.Color(r=255, g=0, b=0)
    green = sc.Color(r=0, g=150, b=0)
    cols = 8
    rows = 8
    # helices = [sc.Helix(major_tick_distance=10) for _ in range(rows+1)]
    strands = []
    for col in range(cols):
        for row in range(rows):
            helix = row
            forward = row % 2 == 0
            if forward:
                offset = col * 20
                ss1 = sc.Domain(helix, forward, offset, offset + 20)
                ss2 = sc.Domain(helix + 1, forward, offset + 20, offset + 40)
            else:
                offset = col * 20
                ss1 = sc.Domain(helix, forward, offset + 30, offset + 50)
                ss2 = sc.Domain(helix + 1, forward, offset + 10, offset + 30)
            if forward:
                color = blue if col % 2 == 0 else black
            else:
                color = red if col % 2 == 0 else green
            strand = sc.Strand([ss1, ss2], color=color)
            strands.append(strand)

    # design = sc.DNADesign(helices=helices, strands=strands, grid=sc.square)
    design = sc.DNADesign(major_tick_distance=10,
                          strands=strands,
                          grid=sc.square)

    return design
Esempio n. 6
0
def main():
    num_helices = 16
    bases = 48
    helices = [sc.Helix() for _ in range(num_helices)]
    strands = []
    for bot in range(num_helices // 2):
        top = num_helices - bot - 1
        helix_top = helices[bot]
        helix_bot = helices[top]

        stap_left_ss_top = sc.Domain(top, sc.forward, 0, bases // 3)
        stap_left_ss_bot = sc.Domain(bot, sc.reverse, 0, bases // 3)
        stap_mid_ss_bot = sc.Domain(bot, sc.reverse, bases // 3,
                                    bases * 2 // 3)
        stap_mid_ss_top = sc.Domain(top, sc.forward, bases // 3,
                                    bases * 2 // 3)
        stap_right_ss_top = sc.Domain(top, sc.forward, bases * 2 // 3, bases)
        stap_right_ss_bot = sc.Domain(bot, sc.reverse, bases * 2 // 3, bases)
        stap_left = sc.Strand([stap_left_ss_bot, stap_left_ss_top])
        stap_mid = sc.Strand([stap_mid_ss_top, stap_mid_ss_bot])
        stap_right = sc.Strand([stap_right_ss_bot, stap_right_ss_top])
        strands.append(stap_left)
        strands.append(stap_mid)
        strands.append(stap_right)

    design = sc.DNADesign(helices=helices, strands=strands, grid=sc.square)

    return design
Esempio n. 7
0
def main():
    helices = []
    num_helices, max_bases = 30, 2000
    for _ in range(num_helices):
        helices.append(sc.Helix(max_bases))
    design = sc.DNADesign(helices=helices, strands=[], grid=sc.square)

    return design
def precursor_scaffolds() -> sc.DNADesign:
    helices = [sc.Helix(max_offset=304) for _ in range(24)]
    scaffolds = [
        sc.Strand(
            [sc.Domain(helix=helix, forward=helix % 2 == 0, start=8, end=296)])
        for helix in range(24)
    ]
    return sc.DNADesign(helices=helices, strands=scaffolds, grid=sc.square)
Esempio n. 9
0
def main():
    ss_f = sc.Domain(helix=0, forward=True, start=0, end=10)
    loop = sc.Loopout(length=5)
    ss_r = sc.Domain(helix=0, forward=False, start=0, end=10)
    hairpin = sc.Strand([ss_f, loop, ss_r])
    design = sc.DNADesign(strands=[hairpin], grid=sc.square)

    design.assign_dna(hairpin, 'AAAAACCCCCTGCAT')

    return design
Esempio n. 10
0
def main():
    helices = [
        sc.Helix(idx=2, max_offset=20),
        sc.Helix(idx=3, max_offset=20),
        sc.Helix(idx=5, max_offset=20),
        sc.Helix(idx=7, max_offset=20),
        sc.Helix(idx=11, max_offset=20),
    ]
    design = sc.DNADesign(helices=helices, strands=[])
    # design.set_helices_view_order([5, 2, 11, 3, 7])
    return design
Esempio n. 11
0
def main():
    length = 9
    helices = [sc.Helix(max_offset=length, major_ticks=[2, 5])]
    stap_ss = sc.Domain(0, True, 0, length)
    scaf_ss = sc.Domain(0, False, 0, length)
    stap = sc.Strand([stap_ss])
    scaf = sc.Strand([scaf_ss], color=sc.default_scaffold_color)
    strands = [stap, scaf]
    design = sc.DNADesign(helices=helices, strands=strands, grid=sc.square)
    design.assign_dna(scaf, 'AACT' * (length // 4))

    return design
Esempio n. 12
0
def main():
    length = 9
    helices = [sc.Helix(max_offset=length, rotation=math.pi/2, rotation_anchor=2)]
    stap_ss = sc.Domain(0, sc.forward, 0, length)
    scaf_ss = sc.Domain(0, sc.reverse, 0, length)
    stap = sc.Strand([stap_ss])
    scaf = sc.Strand([scaf_ss], color=sc.default_scaffold_color)
    strands = [stap, scaf]
    design = sc.DNADesign(helices=helices, strands=strands, grid=sc.square)
    design.assign_dna(scaf, 'AACT' * (length // 4))

    return design
def main():
    length = 10
    stap_ss = sc.Domain(0, True, 0, length)
    scaf_ss = sc.Domain(0, False, 0, length)
    stap = sc.Strand([stap_ss])
    scaf = sc.Strand([scaf_ss], color=sc.default_scaffold_color)
    strands = [stap, scaf]
    design = sc.DNADesign(strands=strands, grid=sc.square)
    insertion_length = 4
    design.add_insertion(helix=0, offset=2, length=insertion_length)
    design.add_insertion(helix=0, offset=8, length=insertion_length)
    scaf.set_dna_sequence('AG' + 'A' * (length + 2*insertion_length - 2))
    stap.set_dna_sequence('ATTCTCTTGCTTTTTTCA')

    return design
def main():
    # multiple-domain
    ss0_1 = sc.Domain(helix=0, forward=False, start=0, end=4)
    ss1 = sc.Domain(helix=1, forward=True, start=0, end=8)
    ss0_2 = sc.Domain(helix=0, forward=False, start=4, end=8)
    strand_multi = sc.Strand(domains=[ss0_1, ss1, ss0_2])

    # single domain
    ss0_single = sc.Domain(helix=0, forward=True, start=0, end=8)
    strand_single = sc.Strand(domains=[ss0_single])

    # whole design
    design = sc.DNADesign(strands=[strand_multi, strand_single], grid=sc.square)

    return design
Esempio n. 15
0
def main():
    length = 9
    helices = [
        sc.Helix(max_offset=length,
                 major_ticks=[2, 5],
                 position3d=sc.Position3D(x=3, y=2, z=1),
                 pitch=90)
    ]
    stap_ss = sc.Domain(0, sc.forward, 0, length)
    scaf_ss = sc.Domain(0, sc.reverse, 0, length)
    stap = sc.Strand([stap_ss])
    scaf = sc.Strand([scaf_ss], color=sc.default_scaffold_color)
    strands = [stap, scaf]
    design = sc.DNADesign(helices=helices, strands=strands, grid=sc.square)
    design.assign_dna(scaf, 'AACT' * (length // 4))

    return design
Esempio n. 16
0
def main():
    stap_left_ss1 = sc.Domain(1, True, 0, 16)
    stap_left_ss0 = sc.Domain(0, False, 0, 16)
    stap_right_ss0 = sc.Domain(0, False, 16, 32)
    stap_right_ss1 = sc.Domain(1, True, 16, 32)
    scaf_ss1_left = sc.Domain(1, False, 0, 16)
    scaf_ss0 = sc.Domain(0, True, 0, 32)
    scaf_ss1_right = sc.Domain(1, False, 16, 32)
    stap_left = sc.Strand([stap_left_ss1, stap_left_ss0])
    stap_right = sc.Strand([stap_right_ss0, stap_right_ss1])
    scaf = sc.Strand([scaf_ss1_left, scaf_ss0, scaf_ss1_right],
                     color=sc.default_scaffold_color)
    strands = [scaf, stap_left, stap_right]
    design = sc.DNADesign(strands=strands, grid=sc.square)
    design.add_deletion(helix=0, offset=11)
    design.add_deletion(helix=0, offset=12)
    design.add_deletion(helix=0, offset=24)
    design.add_deletion(helix=1, offset=12)
    design.add_deletion(helix=1, offset=24)
    design.add_insertion(helix=0, offset=29, length=1)
    design.add_insertion(helix=1, offset=2, length=1)
    design.assign_dna(scaf, 'AACT' * 16)

    # biotin_mod_5p = dataclasses.replace(mod.biotin_5p, font_size=30)
    # cy3_mod_3p = dataclasses.replace(mod.cy3_3p, font_size=30)

    stap_left.set_modification_5p(mod.biotin_5p)
    stap_left.set_modification_3p(mod.cy3_3p)
    stap_left.set_modification_internal(9, mod.cy3_int)
    stap_left.set_modification_internal(10, mod.biotin_int)
    stap_left.set_modification_internal(11, mod.cy3_int)
    stap_left.set_modification_internal(12, mod.cy5_int)
    stap_left.set_modification_internal(4, mod.cy3_int)
    stap_left.set_modification_internal(26, mod.cy5_int)

    stap_right.set_modification_5p(mod.cy5_5p)
    stap_right.set_modification_internal(5, mod.cy3_int)
    stap_right.set_modification_3p(mod.biotin_3p)

    scaf.set_modification_5p(mod.biotin_5p)
    scaf.set_modification_3p(mod.cy3_3p)
    scaf.set_modification_internal(5, mod.cy5_int)
    scaf.set_modification_internal(32, mod.cy3_int)

    return design
Esempio n. 17
0
def main():
    ss1_r = sc.Domain(0, True, 0, 4)
    ss2_r = sc.Domain(0, True, 4, 8)
    ss3_r = sc.Domain(0, True, 8, 12)
    ss_l = sc.Domain(0, False, 0, 12)

    s1_r = sc.Strand([ss1_r], idt=sc.IDTFields('s1_r'))
    s2_r = sc.Strand([ss2_r], idt=sc.IDTFields('s1_r'))
    s3_r = sc.Strand([ss3_r], idt=sc.IDTFields('s1_r'))
    s_l = sc.Strand([ss_l], idt=sc.IDTFields('s_l'))

    strands = [s1_r, s2_r, s3_r, s_l]

    design = sc.DNADesign(strands=strands, grid=sc.square)

    design.assign_dna(s_l, 'AGTT' * 3)

    return design
def main():
    length = 30
    helices = [
        sc.Helix(min_offset=0, max_offset=length, grid_position=(0, 0)),
        sc.Helix(min_offset=1, max_offset=length, grid_position=(0, 1)),
        sc.Helix(min_offset=2, max_offset=length, grid_position=(0, 2)),
        sc.Helix(min_offset=3, max_offset=length, grid_position=(0, 3)),
    ]
    stap_ss = sc.Domain(0, True, 0, length - 1)
    scaf_ss = sc.Domain(0, False, 0, length - 1)
    stap = sc.Strand([stap_ss])
    scaf = sc.Strand([scaf_ss], color=sc.default_scaffold_color)
    strands = [stap, scaf]
    design = sc.DNADesign(helices=helices,
                          strands=strands,
                          grid=sc.Grid.square)

    return design
Esempio n. 19
0
def main():
    # helices
    helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)]

    # left staple
    stap_left_ss1 = sc.Domain(helix=1, forward=True, start=8, end=24)
    stap_left_ss0 = sc.Domain(helix=0, forward=False, start=8, end=24)
    stap_left = sc.Strand(domains=[stap_left_ss1, stap_left_ss0])

    # right staple
    stap_right_ss0 = sc.Domain(helix=0, forward=False, start=24, end=40)
    stap_right_ss1 = sc.Domain(helix=1, forward=True, start=24, end=40)
    stap_right = sc.Strand(domains=[stap_right_ss0, stap_right_ss1])

    # scaffold
    scaf_ss1_left = sc.Domain(helix=1, forward=False, start=8, end=24)
    scaf_ss0 = sc.Domain(helix=0, forward=True, start=8, end=40)
    loopout = sc.Loopout(length=3)
    scaf_ss1_right = sc.Domain(helix=1, forward=False, start=24, end=40)
    scaf = sc.Strand(
        domains=[scaf_ss1_left, scaf_ss0, loopout, scaf_ss1_right],
        is_scaffold=True)

    # geometry
    geometry = sc.Geometry(rise_per_base_pair=0.2,
                           helix_radius=1.2,
                           inter_helix_gap=1.0)

    # whole design
    design = sc.DNADesign(helices=helices,
                          strands=[scaf, stap_left, stap_right],
                          grid=sc.square,
                          geometry=geometry)

    # deletions and insertions added to design are added to both strands on a helix
    design.add_deletion(helix=1, offset=20)
    design.add_insertion(helix=0, offset=14, length=1)
    design.add_insertion(helix=0, offset=26, length=2)

    # also assigns complement to strands other than scaf bound to it
    design.assign_dna(scaf, 'AACGT' * 18)

    return design
Esempio n. 20
0
def main():
    NUM_HELICES = 8
    WIDTH = 16
    doms = [sc.Domain(h, h % 2 == 0, 0, WIDTH) for h in range(NUM_HELICES)]
    strand = sc.Strand(doms)
    design = sc.DNADesign(strands=[strand], grid=sc.square)
    design.add_deletion(helix=0, offset=11)
    design.add_deletion(helix=0, offset=12)
    design.add_deletion(helix=1, offset=12)
    design.add_insertion(helix=1, offset=4, length=1)
    design.assign_dna(strand, 'T' * (NUM_HELICES * WIDTH))

    strand.set_modification_5p(mod.biotin_5p)
    strand.set_modification_3p(mod.cy3_3p)
    for h in range(NUM_HELICES):
        strand.set_modification_internal(WIDTH * h + 5, mod.cy3_int)
        strand.set_modification_internal(WIDTH * h + 10, mod.biotin_int)

    return design
def main():
    # helices
    helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)]

    # whole design
    design = sc.DNADesign(helices=helices, strands=[], grid=sc.square)

    design.strand(1, 8).to(24).cross(0).to(8) # left staple
    design.strand(0, 40).to(24).cross(1).to(40).with_modification_5p(mod.biotin_5p) # right staple
    design.strand(1, 24).to(8).cross(0).to(40).loopout(1, 3).to(24).as_scaffold()

    # deletions and insertions added to design are added to both strands on a helix
    design.add_deletion(helix=1, offset=20)
    design.add_insertion(helix=0, offset=14, length=1)
    design.add_insertion(helix=0, offset=26, length=2)

    # also assigns complement to strands other than scaf bound to it
    design.assign_dna(design.scaffold, 'AACGT' * 18)

    return design
Esempio n. 22
0
def main():
    stap_left_ss1 = sc.Domain(1, True, 0, 16)
    stap_left_ss0 = sc.Domain(0, False, 0, 16)
    stap_right_ss0 = sc.Domain(0, False, 16, 32)
    stap_right_ss1 = sc.Domain(1, True, 16, 32)
    scaf_ss1_left = sc.Domain(1, False, 0, 16)
    scaf_ss0 = sc.Domain(0, True, 0, 32)
    scaf_ss1_right = sc.Domain(1, False, 16, 32)
    stap_left = sc.Strand([stap_left_ss1, stap_left_ss0])
    stap_right = sc.Strand([stap_right_ss0, stap_right_ss1])
    scaf = sc.Strand([scaf_ss1_left, scaf_ss0, scaf_ss1_right],
                     color=sc.default_scaffold_color)
    strands = [stap_left, stap_right, scaf]
    design = sc.DNADesign(strands=strands, grid=sc.square)
    design.add_deletion(helix=0, offset=11)
    design.add_deletion(helix=0, offset=12)
    design.add_deletion(helix=0, offset=24)
    design.add_deletion(helix=1, offset=12)
    design.add_deletion(helix=1, offset=24)
    design.assign_dna(scaf, 'AACT' * 16)

    return design
Esempio n. 23
0
def main():
    num_strands = 208
    start = 0
    strands = []
    plate = 1
    row_idx = 0
    col_idx = 0

    for s in range(1, num_strands + 1):
        ss_f = sc.Domain(helix=0, forward=True, start=start, end=start + 10)
        ss_r = sc.Domain(helix=1, forward=False, start=start, end=start + 10)

        row = ROWS[row_idx]
        col = COLS[col_idx]
        well = f'{row}{col}'
        idt = sc.IDTFields(name=f"staple{s}", plate=f'plate{plate}', well=well)

        strand = sc.Strand(domains=[ss_f, ss_r], idt=idt)
        strands.append(strand)
        row_idx += 1
        if row_idx == len(ROWS):
            row_idx = 0
            col_idx += 1
            if col_idx == len(COLS):
                col_idx = 0
                plate += 1
        start += 10

    scaffold = sc.Strand([
        sc.Domain(helix=0, forward=False, start=0, end=start),
        sc.Domain(helix=1, forward=True, start=0, end=start)
    ],
                         is_scaffold=True)
    strands.append(scaffold)
    design = sc.DNADesign(strands=strands, grid=sc.square)
    design.assign_m13_to_scaffold()

    return design
Esempio n. 24
0
def main():
    ss_f0 = sc.Domain(helix=0, forward=True, start=0, end=8)
    hairpin0 = sc.Loopout(length=5)
    ss_r0 = sc.Domain(helix=0, forward=False, start=0, end=8)

    crossover_like_loopout = sc.Loopout(length=5)
    ss_f1 = sc.Domain(helix=1, forward=True, start=0, end=8)

    long_range_loopout = sc.Loopout(length=10)
    ss_r2 = sc.Domain(helix=2, forward=False, start=16, end=24)
    hairpin2 = sc.Loopout(length=20)
    ss_f2 = sc.Domain(helix=2, forward=True, start=16, end=32)
    hairpin2_2 = sc.Loopout(length=1)
    ss_r2_2 = sc.Domain(helix=2, forward=False, start=24, end=32)

    strand = sc.Strand([
        ss_f0, hairpin0, ss_r0, crossover_like_loopout, ss_f1,
        long_range_loopout, ss_r2, hairpin2, ss_f2, hairpin2_2, ss_r2_2
    ])

    design = sc.DNADesign(strands=[strand], grid=sc.square)
    t5 = 'TTTAC'
    t10 = 'TTTACTTACG'
    t20 = 'TTTTTTTTTTACGTTGCAGG'
    design.assign_dna(
        strand, f'ACGACGAC '
        f'{t5} '
        f'???????? '
        f'{t5} '
        f'GACGACGA '
        f'{t10} '
        f'CACGACGA '
        f'{t20} '
        f'???????? '
        f'ACGACGAC '
        f'T')

    return design
Esempio n. 25
0
def main():
    width = 6
    width_h = width // 2
    stap_left_ss1 = sc.Domain(1, sc.forward, 0, width_h)
    stap_left_ss0 = sc.Domain(0, sc.reverse, 0, width_h)
    stap_right_ss0 = sc.Domain(0, sc.reverse, width_h, width)
    stap_right_ss1 = sc.Domain(1, sc.forward, width_h, width)
    scaf_ss1_left = sc.Domain(1, sc.reverse, 0, width_h)
    scaf_ss0 = sc.Domain(0, sc.forward, 0, width)
    scaf_ss1_right = sc.Domain(1, sc.reverse, width_h, width)
    stap_left = sc.Strand([stap_left_ss1, stap_left_ss0])
    stap_right = sc.Strand([stap_right_ss0, stap_right_ss1])
    scaf = sc.Strand([scaf_ss1_left, scaf_ss0, scaf_ss1_right],
                     color=sc.default_scaffold_color)
    strands = [stap_left, stap_right, scaf]
    design = sc.DNADesign(strands=strands, grid=sc.square)
    design.add_deletion(helix=0, offset=1)
    design.add_deletion(helix=0, offset=4)
    design.add_deletion(helix=1, offset=1)
    design.add_deletion(helix=1, offset=4)
    design.assign_dna(scaf, 'AACATCGT')

    return design
def main():
    # left staple
    stap_left_ss1 = sc.Domain(helix=1, forward=True, start=0, end=16)
    stap_left_ss0 = sc.Domain(helix=0, forward=False, start=0, end=16)
    stap_left = sc.Strand(domains=[stap_left_ss1, stap_left_ss0])

    # right staple
    stap_right_ss0 = sc.Domain(helix=0, forward=False, start=16, end=32)
    stap_right_ss1 = sc.Domain(helix=1, forward=True, start=16, end=32)
    stap_right = sc.Strand(domains=[stap_right_ss0, stap_right_ss1])

    # scaffold
    scaf_ss1_left = sc.Domain(helix=1, forward=False, start=0, end=16)
    scaf_ss0 = sc.Domain(helix=0, forward=True, start=0, end=32)
    loopout = sc.Loopout(length=3)
    scaf_ss1_right = sc.Domain(helix=1, forward=False, start=16, end=32)
    scaf = sc.Strand(
        domains=[scaf_ss1_left, scaf_ss0, loopout, scaf_ss1_right],
        is_scaffold=True)

    # whole design
    design = sc.DNADesign(strands=[scaf, stap_left, stap_right],
                          grid=sc.square)

    # deletions and insertions added to design so they can be added to both strands on a helix
    design.add_deletion(helix=0, offset=11)
    design.add_deletion(helix=0, offset=12)
    design.add_deletion(helix=0, offset=24)
    design.add_deletion(helix=1, offset=12)
    design.add_deletion(helix=1, offset=24)

    design.add_insertion(helix=0, offset=6, length=1)
    design.add_insertion(helix=0, offset=18, length=2)
    design.add_insertion(helix=1, offset=6, length=3)
    design.add_insertion(helix=1, offset=18, length=4)

    return design
Esempio n. 27
0
def main():
    return sc.DNADesign(strands=[], grid=sc.square)
Esempio n. 28
0
def initial_design():
    max_offset = 1295
    helices = [

        # below uses cadnano honeycomb coordinates
        # https://github.com/UC-Davis-molecular-computing/scadnano-python-package/blob/master/misc/cadnano-format-specs/v2.txt
        sc.Helix(grid_position=(1, 1, 0), max_offset=max_offset),
        sc.Helix(grid_position=(0, 1, 0), max_offset=max_offset),
        sc.Helix(grid_position=(0, 2, 0), max_offset=max_offset),
        sc.Helix(grid_position=(1, 2, 0), max_offset=max_offset),
        sc.Helix(grid_position=(2, 2, 0), max_offset=max_offset),
        sc.Helix(grid_position=(2, 1, 0), max_offset=max_offset),

        # below uses original mistaken convention from mistaken cadnano specs
        # sc.Helix(grid_position=(1, 0, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(0, 0, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(0, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(1, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 0, 0), max_offset=max_offset),

        # # below uses odd-q coordinates:
        # sc.Helix(grid_position=(1, -1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(0, 0, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(0, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(1, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 0, 0), max_offset=max_offset),

        # below uses even-q coordinates:
        # sc.Helix(grid_position=(1, 0, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(0, 0, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(0, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(1, 2, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 0, 0), max_offset=max_offset),

        # below uses odd-r coordinates:
        # sc.Helix(grid_position=(1, 0, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(0, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(1, 2, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 2, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 1, 0), max_offset=max_offset),
        # sc.Helix(grid_position=(2, 0, 0), max_offset=max_offset),
    ]
    scafs = [
        sc.Strand([sc.Domain(helix=0, forward=True, start=16, end=1276)]),
        sc.Strand([sc.Domain(helix=1, forward=False, start=16, end=1276)]),
        sc.Strand([sc.Domain(helix=2, forward=True, start=12, end=1272)]),
        sc.Strand([sc.Domain(helix=3, forward=False, start=12, end=1272)]),
        sc.Strand([sc.Domain(helix=4, forward=True, start=19, end=1279)]),
        sc.Strand([sc.Domain(helix=5, forward=False, start=19, end=1279)]),
    ]
    staps = [
        sc.Strand([sc.Domain(helix=0, forward=False, start=42, end=1246)]),
        sc.Strand([sc.Domain(helix=1, forward=True, start=42, end=1246)]),
        sc.Strand([sc.Domain(helix=2, forward=False, start=42, end=1246)]),
        sc.Strand([sc.Domain(helix=3, forward=True, start=42, end=1246)]),
        sc.Strand([sc.Domain(helix=4, forward=False, start=42, end=1246)]),
        sc.Strand([sc.Domain(helix=5, forward=True, start=42, end=1246)]),
    ]
    strands = scafs + staps
    return sc.DNADesign(helices=helices, strands=strands, grid=sc.honeycomb)
Esempio n. 29
0
def main():
    design = sc.DNADesign(helices=[], strands=[], grid=sc.square)
    return design
def create(*, num_helices: int, num_cols: int, assign_seq: bool = True, seam_left_column=-1,
           nick_pattern: NickPattern = NickPattern.staggered,
           twist_correction_deletion_spacing: int = 0, twist_correction_start_col: int = 1,
           twist_correction_deletion_offset=-1,
           num_flanking_columns: int = 1, num_flanking_helices=0,
           custom_scaffold: str = None, edge_staples: bool = True,
           scaffold_nick_offset: int = -1, use_idt_defaults: bool = False) -> sc.DNADesign:
    """
    Creates a DNA origami rectangle with a given number of helices and "columns" 
    (16-base-wide region in each helix). 
    The columns include the 16-base regions on the end where potential "edge staples" go, 
    as well as the two-column-wide "seam" region in the middle.

    Below is an example diagram of the staples created by this function.

    Consider for example the function call
    ``create(num_helices=8, num_cols=10, nick_pattern=origami_rectangle.staggered)``.
    The scaffold strand resulting from this call is shown below:

    .. code-block:: none

          #       C0       #       C1       #       C2       #       C3       #       C4       #       C5       #       C6       #       C7       #       C8       #       C9       #
        H0 +--------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------+
           |                                                                                                                                                                       |
        H1 +--------------- ---------------- ---------------- ---------------- ---------------+ +--------------- ---------------- ---------------- ---------------- ---------------+
                                                                                              | |
        H2 +--------------- ---------------- ---------------- ---------------- ---------------+ +--------------- ---------------- ---------------- ---------------- ---------------+
           |                                                                                                                                                                       |
        H3 +--------------- ---------------- ---------------- ---------------- ---------------+ +--------------- ---------------- ---------------- ---------------- ---------------+
                                                                                              | |
        H4 +--------------- ---------------- ---------------- ---------------- ---------------+ +--------------- ---------------- ---------------- ---------------- ---------------+
           |                                                                                                                                                                       |
        H5 +--------------- ---------------- ---------------- ---------------- ---------------+ +--------------- ---------------- ---------------- ---------------- ---------------+
                                                                                              | |
        H6 +--------------- ---------------- ---------------- ---------------- ---------------+ +--------------- ---------------- ---------------- ---------------- ---------------+
           |                                                                                                                                                                       |
        H7 +--------------- ---------------- ---------------- ---------------- ---------------] <--------------- ---------------- ---------------- ---------------- ---------------+


    Helix indices are labelled ``H0``, ``H1``, ... and column indices are labeled ``C0``, ``C1``, ...
    Each single symbol ``-``, ``+``, ``<``, ``>``, ``[``, ``]``, ``+``
    represents one DNA base, so each column is 16 bases wide.
    The ``#`` is a visual delimiter between columns and does not represent any bases,
    nor do spaces between the base-representing symbols.
    The 5' end of a strand is indicated with ``[`` or ``]``
    and the 3' end is indicated with ``>`` or ``<``.
    A crossover is indicated with

    .. code-block:: none

        +
        |
        +

    Below are the staples resulting from this same call.

    .. code-block:: none

          #       C0       #       C1       #       C2       #       C3       #       C4       #       C5       #       C6       #       C7       #       C8       #       C9       #
        H0 <--------------+ +--------------- -------]<------+ +--------------- -------]<------+ +--------------- -------]<------+ +--------------- -------]<------+ +--------------]
                          | |                               | |                                                                 | |                               | |                               
        H1 [--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +-------------->
                                           | |                               | |                               | |                               | |                               
        H2 <--------------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------]
                          | |                               | |                                                                 | |                               | |                               
        H3 [--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +-------------->
                                           | |                               | |                               | |                               | |                               
        H4 <--------------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------]
                          | |                               | |                                                                 | |                               | |                               
        H5 [--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +------>[------+ +--------------+ +-------------->
                                           | |                               | |                               | |                               | |                               
        H6 <--------------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------+ +------]<------+ +--------------]
                          | |                               | |                                                                 | |                               | |                               
        H7 [--------------+ +------>[------- ---------------+ +------>[------- ---------------+ +------>[------- ---------------+ +------>[------- ---------------+ +-------------->

    The seam crosses columns ``C4`` and ``C5``.
    The left and right edge staples respectively are in columns ``C0`` and ``C9``.

    Prints warning if number of bases exceeds 7249 (length of standard M13 scaffold strand),
    but does not otherwise cause an error.

    `num_cols` must be even and at least 4.
    
    `seam_left_column` specifies the location of the seam. (i.e., scaffold crossovers in the middle of the
    origami.) 
    If positive, the seam occupies two columns, and `seam_left_column` specifies the column on the left.
    To make the crossover geometry work out, a nonnegative `seam_left_column` must be even,
    greater than 0, and less than `num_helices` - 2. 
    If negative, it is calculated automatically to be roughly in the middle.  

    If `twist_correction_deletion_spacing` > 0, adds deletions between crossovers in one out of
    every `twist_correction_deletion_spacing` columns. (TODO: cite Sungwook's paper)
    
    `twist_correction_start_col` is ignored if `twist_correction_deletion_spacing` <= 0, otherwise
    it indicates the column at which to put the first deletions. Default = 1.
    
    `twist_correction_deletion_offset` is the *relative* offset of the deletion, relative to the left side
    of the column.

    `num_flanking_columns` is the number of empty columns on the helix on each side of the origami.

    `num_flanking_helices` is the number of empty helices above and below the origami.

    `nick_pattern` describes whether nicks between staples should be "staggered" or not.
    See :class:`origami_rectangle.NickPattern` for details.
    
    `custom_scaffold` is the scaffold sequence to use. 
    If set to ``None``, the standard 7249-base M13 is used: :py:func:`scadnano.m13`.
    
    `edge_staples` indicates whether to include the edge staples. (Leaving them out prevents multiple
    origami rectangles from polymerizing in solution due to base stacking interactions on the left and
    right edges of the origami rectangle.)
    
    `scaffold_nick_offset` is the position of the "nick" on the scaffold (the M13 scaffold is circular,
    so for such a scaffold this really represents where any unused and undepicted bases of the scaffold will
    form a loop-out). If negative (default value) then it will be chosen to be along the origami seam.
    
    `use_idt_defaults`, if ``True``, creates an :py:class:`IDTFields` in each staple strand suitable for 
    calling :py:meth:`DNADesign.write_idt_file` or :py:meth:`DNADesign.write_idt_plate_excel_file` .

    Here's an example of using :any:`origami_rectangle.create` to create a design for a
    16-helix rectangle and write it to a file readable by scadnano.
    (By default the output file name is the same as the script calling 
    :py:meth:`DNADesign.write_scadnano_file`
    but with the extension ``.py`` changed to ``.dna``.)

    .. code-block:: Python

        import origami_rectangle as rect
        
        # XXX: ensure num_cols is even since we divide it by 2
        design = rect.create(num_helices=16, num_cols=24, nick_pattern=rect.staggered)
        design.write_scadnano_file()

    However, we caution that :py:func:`create` is not intended to be very
    extensible for creating many different types of DNA origami. It is more intended as an
    example whose source code can be an efficient reference to learn the :mod:`scadnano` API.
    """  # noqa (This line is here to suppress a PEP warning about long lines in the source code)

    if num_cols < 4:
        raise ValueError(f'num_cols must be at least 4 but is {num_cols}')
    # if num_cols % 4 != 2:
    #     raise ValueError(f'num_cols must be congruent to 2 mod 4 (6, 10, 14, 18, 22, ...) but is {num_cols}')
    if num_cols % 2 != 0:
        raise ValueError(f'num_cols must be even, but is {num_cols}')
    if num_helices % 2 != 0:
        raise ValueError(f'num_helices must be even but is {num_helices}')
    if num_cols * num_helices * BASES_PER_COLUMN > 7249:
        print(f'WARNING: you chose {num_cols} columns and {num_helices} helices, '
              f'which requires {num_cols * num_helices * BASES_PER_COLUMN} bases, '
              f'greater than the 7249 available in standard M13.')
    if seam_left_column < 0:
        seam_left_column = num_cols // 2 - 1
        if seam_left_column % 2 == 1:
            seam_left_column += 1
    if seam_left_column % 2 == 1:
        raise ValueError(f'seam_left_column must be even but is {seam_left_column}')

    # allow empty "flanking" columns on each side
    num_bases_per_helix = BASES_PER_COLUMN * (num_cols + 2 * num_flanking_columns)
    # leftmost x offset
    offset_start = BASES_PER_COLUMN * num_flanking_columns
    # rightmost x offset
    offset_end = offset_start + BASES_PER_COLUMN * num_cols
    # x offset just to left of seam
    offset_mid = offset_start + BASES_PER_COLUMN * (seam_left_column + 1)

    helices = _create_helices(num_helices + 2 * num_flanking_helices, num_bases_per_helix)
    scaffold = _create_scaffold(offset_start, offset_end, offset_mid, num_helices, num_flanking_helices,
                                scaffold_nick_offset)
    staples = _create_staples(offset_start, offset_end, offset_mid, num_helices, num_flanking_helices,
                              num_cols, nick_pattern, edge_staples, use_idt_defaults)

    design = sc.DNADesign(helices=helices, strands=[scaffold] + staples, grid=sc.square)

    if twist_correction_deletion_spacing > 0:
        add_twist_correction_deletions(design=design,
                                       offset_start=offset_start,
                                       deletion_spacing=twist_correction_deletion_spacing,
                                       deletion_start_col=twist_correction_start_col,
                                       deletion_offset=twist_correction_deletion_offset,
                                       num_helices=num_helices,
                                       num_cols=num_cols,
                                       num_flanking_helices=num_flanking_helices)

    if assign_seq:
        scaffold_seq = sc.m13() if custom_scaffold is None else custom_scaffold
        design.assign_dna(scaffold, scaffold_seq)

    if use_idt_defaults:
        design.set_default_idt(True)
        scaffold.set_default_idt(False)

    return design