def precursor_staples(design: sc.Design): #2D design has to be topologically a circle # helices = [sc.Helix(max_offset=int(block*cmax)) for _ in range(maxhelix)] staples = [] for helix in range(len(img)): if (1 in img[helix]): for dom in range(len(img[helix])): if (img[helix][dom] == 1) and (img[helix][dom - 1] == 0): start = block * dom if (img[helix][dom] == 0) and (img[helix][dom - 1] == 1): end = block * dom staples.append( sc.Strand([ sc.Domain(helix=2 * helix, forward=((2 * helix) % 2 == 1), start=start, end=end) ])) staples.append( sc.Strand([ sc.Domain(helix=(2 * helix) + 1, forward=((2 * helix + 1) % 2 == 1), start=start, end=end) ])) for staple in staples: design.add_strand(staple)
def add_staple_precursors(design: sc.Design) -> None: staples = [ sc.Strand( [sc.Domain(helix=helix, forward=helix % 2 == 1, start=0, end=288)]) # noqa for helix in range(24) ] for staple in staples: design.add_strand(staple)
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)
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)
def add_tiles_and_assign_dna(design: sc.Design) -> None: # left tiles left_left = 11 left_right = 32 for top_helix, seq in zip(range(2, 18, 2), tile_dna_seqs): bot_helix = top_helix + 1 ss_top = sc.Domain(helix=top_helix, forward=True, start=left_left, end=left_right) ss_bot = sc.Domain(helix=bot_helix, forward=False, start=left_left, end=left_right) idt = sc.IDTFields(name=f'tile-left-{top_helix}-{bot_helix}', scale='25nm', purification='STD') tile = sc.Strand(domains=[ss_bot, ss_top], color=sc.Color(0, 0, 0), idt=idt) design.add_strand(tile) design.assign_dna(tile, seq) # right tiles right_left = 480 right_right = 501 for top_helix, seq in zip(range(2, 18, 2), tile_dna_seqs): bot_helix = top_helix + 1 ss_top = sc.Domain(helix=top_helix, forward=True, start=right_left, end=right_right) ss_bot = sc.Domain(helix=bot_helix, forward=False, start=right_left, end=right_right) idt = sc.IDTFields(name=f'tile-right-{top_helix}-{bot_helix}', scale='25nm', purification='STD') tile = sc.Strand(domains=[ss_bot, ss_top], color=sc.Color(0, 0, 0), idt=idt) design.add_strand(tile) design.assign_dna(tile, seq)
def add_adapters(design: sc.Design) -> None: # 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)
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)