コード例 #1
0
def add_adapters(design):
    # left adapters
    left_inside_seed = 48
    left_outside_seed = left_inside_seed - 26
    for bot_helix in range(2, 18, 2):
        top_helix = bot_helix - 1 if bot_helix != 2 else 17
        ss_top = sc.Domain(helix=top_helix,
                           forward=True,
                           start=left_outside_seed,
                           end=left_inside_seed)
        ss_bot = sc.Domain(helix=bot_helix,
                           forward=False,
                           start=left_outside_seed,
                           end=left_inside_seed)
        idt = sc.IDTFields(name=f'adap-left-{top_helix}-{bot_helix}',
                           scale='25nm',
                           purification='STD')
        adapter = sc.Strand(domains=[ss_bot, ss_top], idt=idt)
        design.add_strand(adapter)

    # right adapters
    right_inside_seed = 464
    right_outside_seed = right_inside_seed + 26
    for bot_helix in range(2, 18, 2):
        top_helix = bot_helix - 1 if bot_helix != 2 else 17
        ss_top = sc.Domain(helix=top_helix,
                           forward=True,
                           start=right_inside_seed,
                           end=right_outside_seed)
        ss_bot = sc.Domain(helix=bot_helix,
                           forward=False,
                           start=right_inside_seed,
                           end=right_outside_seed)
        idt = sc.IDTFields(name=f'adap-right-{top_helix}-{bot_helix}',
                           scale='25nm',
                           purification='STD')
        adapter = sc.Strand(domains=[ss_top, ss_bot], idt=idt)
        design.add_strand(adapter)
コード例 #2
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
コード例 #3
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
コード例 #4
0
def create_design():
    # 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)

    # whole design
    design = sc.Design(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
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
コード例 #6
0
def add_precursor_staples(design: sc.Design, staple_domain, label = None, dna_seq = None):
    """Add precursor staples to the design"""
    for helix in range(len(staple_domain)):
        if dna_seq == None:
            seq = None
        else:
            seq = dna_seq[helix]
        forward = sc_general.forward_strand(helix, 'staple')
        outline = staple_domain[helix]
        for i in range(outline[0] + 1):
            lines = outline[1]
            line = lines[i]
            start = line[0]
            end = line[1]
            staples = sc.Strand([sc.Domain(helix = helix, forward = forward, start = start, end = end, label = label)], dna_sequence = seq)
            design.add_strand(staples)
コード例 #7
0
def add_precursor_scaffolds(design: sc.Design, shape_outline, label = None, dna_seq = None):
    """Adds the precursor scaffold to the design"""
    for helix in range(len(shape_outline)):
        if dna_seq == None:
            seq = None
        else:
            seq = dna_seq[helix]
        forward = sc_general.forward_strand(helix, 'scaffold')
        one_line_outline = shape_outline[helix]
        for i in range(one_line_outline[0] + 1):
            lines = one_line_outline[1]
            line = lines[i]
            start = line[0]
            end = line[1]
            scaffold = sc.Strand([sc.Domain(helix = helix, forward = forward, start = start, end = end, label = label)], dna_sequence = seq, name = 'scaffold')
            design.add_strand(scaffold)
コード例 #8
0
def _create_left_edge_staples(offset_start: int, num_helices: int,
                              num_flanking_helices: int, idt: bool):
    staples = []
    crossover_right = offset_start + BASES_PER_COLUMN
    for helix in range(0 + num_flanking_helices,
                       num_helices + num_flanking_helices, 2):
        bot_helix_forward = True
        ss_5p_bot = sc.Substrand(helix=helix + 1,
                                 forward=bot_helix_forward,
                                 start=offset_start,
                                 end=crossover_right)
        ss_3p_top = sc.Substrand(helix=helix,
                                 forward=not bot_helix_forward,
                                 start=offset_start,
                                 end=crossover_right)
        staple = sc.Strand(substrands=[ss_5p_bot, ss_3p_top])
        staples.append(staple)
    return staples
コード例 #9
0
def _create_right_edge_staples(offset_end: int, num_helices: int,
                               num_flanking_helices: int) -> List[sc.Strand]:
    staples = []
    crossover_left = offset_end - BASES_PER_COLUMN
    for helix in range(0 + num_flanking_helices,
                       num_helices + num_flanking_helices, 2):
        bot_helix_forward = True
        ss_5p_top = sc.Domain(helix=helix,
                              forward=not bot_helix_forward,
                              start=crossover_left,
                              end=offset_end)
        ss_3p_bot = sc.Domain(helix=helix + 1,
                              forward=bot_helix_forward,
                              start=crossover_left,
                              end=offset_end)
        staple = sc.Strand(domains=[ss_5p_top, ss_3p_bot])
        staples.append(staple)
    return staples
コード例 #10
0
def create_design():
    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.Design(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
コード例 #11
0
def create_design() -> sc.Design:
    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.Design(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
コード例 #12
0
def _create_scaffold(offset_start: int, offset_end: int, offset_mid: int, num_helices: int,
                     num_flanking_helices: int, scaffold_nick_offset: int):
    # top domain is continguous
    top_domain = sc.Domain(helix=0 + num_flanking_helices, forward=True,
                              start=offset_start, end=offset_end)
    domains_left = []
    domains_right = []
    if scaffold_nick_offset < 0:
        scaffold_nick_offset = offset_mid
    for helix in range(1 + num_flanking_helices, num_helices + num_flanking_helices):
        # otherwise there's a nick (bottom helix) or the seam crossover (all other than top and bottom)
        # possibly nick on bottom helix is not along seam
        center_offset = offset_mid if helix < num_helices + num_flanking_helices - 1 else scaffold_nick_offset
        forward = (helix % 2 == num_flanking_helices % 2)
        left_domain = sc.Domain(helix=helix, forward=forward,
                                   start=offset_start, end=center_offset)
        right_domain = sc.Domain(helix=helix, forward=forward,
                                    start=center_offset, end=offset_end)
        domains_left.append(left_domain)
        domains_right.append(right_domain)
    domains_left.reverse()
    domains = domains_left + [top_domain] + domains_right
    return sc.Strand(domains=domains, color=sc.default_scaffold_color, is_scaffold=True)
コード例 #13
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)
def add_precursor_staples(design: sc.Design):
    staples = [sc.Strand([sc.Domain(helix=helix, forward=helix % 2 == 1, start=8, end=296)])
               for helix in range(24)]
    for staple in staples:
        design.add_strand(staple)
コード例 #15
0
def add_hairpins(design, hairpin_locations, hairpin_lattice):
    """Given the design, the hairpin lattice, and the hairpin locations, adds the hairpins to the hairpin lattice and crossovers to the seed"""
    seed_domain = range(len(hairpin_locations))
    hairpin_domain = range(len(hairpin_locations),
                           len(hairpin_locations) + len(hairpin_lattice))
    #creates the hairpins, included the loopout crossover
    for i in range(len(hairpin_domain)):
        helix = hairpin_domain[i]
        for j in range(len(hairpin_locations[helix - len(seed_domain)])):
            left_offset = hairpin_locations[helix - len(seed_domain)][j]
            right_offset = left_offset + 8
            index = 6 * (i - 1) + j
            pin_seq = non_random_hairpin_sequence(index)
            staple = sc.Strand([
                sc.Domain(helix=helix,
                          forward=True,
                          start=left_offset,
                          end=right_offset),
                sc.Loopout(length=4),
                sc.Domain(helix=helix,
                          forward=False,
                          start=left_offset - 2,
                          end=right_offset)
            ],
                               dna_sequence=pin_seq)
            design.add_strand(staple)

    #add nicks on staple strands to be able to connect the hairpins
    for helix in seed_domain:
        forward = sc_general.forward_strand(helix, 'staple')
        for nick in hairpin_locations[helix]:
            design.add_nick(helix=helix, offset=nick, forward=forward)

    #crossovers between the main helices and the hairpins
    crossovers = []
    for helix in seed_domain:
        helix2 = hairpin_domain[helix]
        forward = sc_general.forward_strand(helix, 'staple')
        for pin in hairpin_locations[helix]:
            if forward == True:
                forward_pin_offset = pin - 1
                reverse_pin_offset = pin
            else:
                forward_pin_offset = pin
                reverse_pin_offset = pin - 1
            crossovers.append(
                sc.Crossover(helix=helix,
                             helix2=helix2,
                             offset=forward_pin_offset,
                             offset2=pin,
                             forward=forward,
                             forward2=True,
                             half=True))
            crossovers.append(
                sc.Crossover(helix=helix,
                             helix2=helix2,
                             offset=reverse_pin_offset,
                             offset2=pin - 2,
                             forward=forward,
                             forward2=False,
                             half=True))

    design.add_crossovers(crossovers)
コード例 #16
0
def main():
    helices = [
        sc.Helix(max_offset=64),
        sc.Helix(max_offset=64),
        sc.Helix(max_offset=64)
    ]

    # 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)

    ss_extra1 = sc.Domain(helix=1, forward=True, start=32, end=48)
    ss_extra2 = sc.Domain(helix=1, forward=True, start=48, end=64)
    ss_extra3 = sc.Domain(helix=2, forward=False, start=32, end=48)
    ss_extra1b = sc.Domain(helix=1, forward=False, start=32, end=48)
    ss_extra2b = sc.Domain(helix=1, forward=False, start=48, end=64)
    ss_extra3b = sc.Domain(helix=2, forward=True, start=32, end=48)
    ss_extra4 = sc.Domain(helix=2, forward=True, start=16, end=32)
    ss_extra5 = sc.Domain(helix=2, forward=True, start=0, end=16)
    s_extra1 = sc.Strand(domains=[ss_extra1])
    s_extra2 = sc.Strand(domains=[ss_extra2])
    s_extra3 = sc.Strand(domains=[ss_extra3])
    s_extra4 = sc.Strand(domains=[ss_extra4])
    s_extra5 = sc.Strand(domains=[ss_extra5])
    s_extra1b = sc.Strand(domains=[ss_extra1b])
    s_extra2b = sc.Strand(domains=[ss_extra2b])
    s_extra3b = sc.Strand(domains=[ss_extra3b])

    # whole design
    design = sc.DNADesign(helices=helices,
                          strands=[
                              scaf, stap_left, stap_right, s_extra1, s_extra2,
                              s_extra3, s_extra4, s_extra1b, s_extra2b,
                              s_extra3b, s_extra5
                          ],
                          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)

    # DNA assigned to whole design so complement can be assigned to strands other than scaf
    design.assign_dna(scaf, 'AACT' * 18)
    design.assign_dna(s_extra1, 'AACT' * 4)
    design.assign_dna(s_extra2, 'GGTA' * 4)

    return design
コード例 #17
0
def _create_inner_staples(offset_start: int, offset_end: int, offset_mid: int,
                          num_helices: int, num_flanking_helices: int,
                          num_cols: int,
                          nick_pattern: NickPattern) -> List[sc.Strand]:
    if nick_pattern is not NickPattern.staggered:
        raise NotImplementedError(
            "Currently can only handle staggered nick pattern")
    # if ((num_cols - 4) // 2) % 2 != 0:
    #     raise NotImplementedError("Currently can only handle num_cols such that an even number of "
    #                               "columns appear between each edge column and seam column, "
    #                               "i.e., ((num_cols - 4) // 2) % 2 == 0")
    len_half_col = BASES_PER_COLUMN // 2

    staples = []
    for col in range(num_cols):
        x_l = offset_start + BASES_PER_COLUMN * col
        x_r = offset_start + BASES_PER_COLUMN * (col + 1)
        x_mid_col = x_l + len_half_col
        if (x_l == offset_start  # skip left edge column
                or x_r == offset_mid  # skip left seam column
                or x_l == offset_mid  # skip right seam column
                or x_r == offset_end):  # skip right edge column
            continue
        if col % 2 == 1:
            # special staple in odd column is 24-base staple along top helix
            h1_forward = True
            ss_top_5p_h0 = sc.Domain(helix=0 + num_flanking_helices,
                                     forward=not h1_forward,
                                     start=x_l,
                                     end=x_mid_col + BASES_PER_COLUMN)
            ss_top_3p_h1 = sc.Domain(helix=1 + num_flanking_helices,
                                     forward=h1_forward,
                                     start=x_l,
                                     end=x_mid_col)
            staple_top = sc.Strand(domains=[ss_top_5p_h0, ss_top_3p_h1])
            staples.append(staple_top)

            for helix in range(1 + num_flanking_helices,
                               num_helices + num_flanking_helices - 2, 2):
                helix_i_forward = True
                ss_helix_i = sc.Domain(helix=helix,
                                       forward=helix_i_forward,
                                       start=x_mid_col,
                                       end=x_r)
                ss_helix_ip1 = sc.Domain(helix=helix + 1,
                                         forward=not helix_i_forward,
                                         start=x_l,
                                         end=x_r)
                ss_helix_ip2 = sc.Domain(helix=helix + 2,
                                         forward=helix_i_forward,
                                         start=x_l,
                                         end=x_mid_col)
                staple = sc.Strand(
                    domains=[ss_helix_i, ss_helix_ip1, ss_helix_ip2])
                staples.append(staple)

        else:
            # special staple in even column is 24-base staple along bottom helix (hm1="helix minus 1")
            hm1_forward = True
            ss_bot_5p_hm1 = sc.Domain(helix=num_helices +
                                      num_flanking_helices - 1,
                                      forward=hm1_forward,
                                      start=x_mid_col - BASES_PER_COLUMN,
                                      end=x_r)
            ss_bot_3p_hm2 = sc.Domain(helix=num_helices +
                                      num_flanking_helices - 2,
                                      forward=not hm1_forward,
                                      start=x_mid_col,
                                      end=x_r)
            staple_bot = sc.Strand(domains=[ss_bot_5p_hm1, ss_bot_3p_hm2])
            staples.append(staple_bot)

            for helix in range(0 + num_flanking_helices,
                               num_helices + num_flanking_helices - 3, 2):
                helix_i_forward = False
                ss_helix_i = sc.Domain(helix=helix,
                                       forward=helix_i_forward,
                                       start=x_mid_col,
                                       end=x_r)
                ss_helix_ip1 = sc.Domain(helix=helix + 1,
                                         forward=not helix_i_forward,
                                         start=x_l,
                                         end=x_r)
                ss_helix_ip2 = sc.Domain(helix=helix + 2,
                                         forward=helix_i_forward,
                                         start=x_l,
                                         end=x_mid_col)
                staple = sc.Strand(
                    domains=[ss_helix_ip2, ss_helix_ip1, ss_helix_i])
                staples.append(staple)

    return staples
def precursor_scaffolds() -> sc.Design:
    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.Design(helices=helices, strands=scaffolds, grid=sc.square)