Ejemplo n.º 1
0
def add_domains_for_barrel_seam(design: sc.Design) -> None:
    top_staples_5p = design.strands_starting_on_helix(2)
    top_staples_3p = design.strands_ending_on_helix(2)
    bot_staples_5p = design.strands_starting_on_helix(17)
    bot_staples_3p = design.strands_ending_on_helix(17)

    # remove scaffold
    top_staples_5p = [st for st in top_staples_5p if len(st.domains) <= 3]
    top_staples_3p = [st for st in top_staples_3p if len(st.domains) <= 3]
    bot_staples_5p = [st for st in bot_staples_5p if len(st.domains) <= 3]
    bot_staples_3p = [st for st in bot_staples_3p if len(st.domains) <= 3]

    top_staples_5p.sort(key=lambda stap: stap.offset_5p())
    top_staples_3p.sort(key=lambda stap: stap.offset_3p())
    bot_staples_5p.sort(key=lambda stap: stap.offset_5p())
    bot_staples_3p.sort(key=lambda stap: stap.offset_3p())

    for top_5p, top_3p, bot_5p, bot_3p in zip(top_staples_5p, top_staples_3p,
                                              bot_staples_5p, bot_staples_3p):
        ss_top = sc.Domain(helix=2,
                           forward=False,
                           start=top_5p.first_domain().end,
                           end=top_3p.last_domain().start)
        ss_bot = sc.Domain(helix=17,
                           forward=True,
                           start=bot_3p.last_domain().end,
                           end=bot_5p.first_domain().start)
        design.insert_domain(bot_5p, 0, ss_top)
        design.insert_domain(top_5p, 0, ss_bot)
Ejemplo n.º 2
0
def add_toeholds_for_seam_displacement(design: sc.Design) -> None:
    for helix in [2, 17]:
        staples_5p = design.strands_starting_on_helix(helix)

        # remove scaffold
        staples_5p = [st for st in staples_5p if len(st.domains) <= 3]

        staples_5p.sort(key=lambda stap: stap.offset_5p())

        for stap_5p in staples_5p:
            toe_ss = sc.Domain(helix=1 if helix == 2 else 18,
                               forward=helix == 2,
                               start=stap_5p.first_bound_domain().start,
                               end=stap_5p.first_bound_domain().end)
            design.insert_domain(stap_5p, 0, toe_ss)