def add_domains_for_barrel_seam(design: sc.DNADesign): top_staples_5p = design.strands_starting_on_helix(0) top_staples_3p = design.strands_ending_on_helix(0) bot_staples_5p = design.strands_starting_on_helix(15) bot_staples_3p = design.strands_ending_on_helix(15) # 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=0, forward=False, start=top_5p.first_domain().end, end=top_3p.last_domain().start) ss_bot = sc.Domain(helix=15, 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)
def add_toeholds_for_seam_displacement(design: sc.DNADesign): 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_domain().start, end=stap_5p.first_domain().end) design.insert_domain(stap_5p, 0, toe_ss)