Example #1
0
def add_fringe(design, fringe_seqs, left_right):
    """Given the design, and fringe sequence, adds the fringe to the design"""
    fringe_num = len(fringe_seqs)
    if left_right == 'left':
        helix_st = 1
    else:
        helix_st = 0

    for i in range(fringe_num):
        print(helix_st)
        if helix_st == 11:
            helix2 = 0 
        else:
            helix2 = helix_st + 1

        forward = sc_general.forward_strand(helix_st, 'staple')
        forward2 = sc_general.forward_strand(helix2, 'staple')

        if forward:
            helix = helix_st
        else:
            helix, helix2 = helix2, helix_st
            forward, forward2 = forward2, forward

        staple = sc.Strand([sc.Domain(helix = helix, forward = forward, start = 0, end = 16), sc.Domain(helix = helix2, forward = forward2, start = 0, end = 16)], dna_sequence= fringe_seqs[i])
        design.add_strand(staple)

        helix_st += 2
def add_crossovers(design: sc.Design, crossover_list, scaffold_or_staple):
    """Adds crossovers"""
    crossovers = []

    for helix in range(len(crossover_list)):
        if crossover_list[helix] == 'no crossover':
            continue
        else:
            for crossover in crossover_list[helix]:
                helix2 = crossover[1]
                offset = crossover[2]
                offset2 = crossover[3]
                forward = sc_general.forward_strand(helix, scaffold_or_staple)
                forward2 = sc_general.forward_strand(helix2, scaffold_or_staple)
                crossovers.append(sc.Crossover(helix = helix, helix2 = helix2, offset = offset, offset2 = offset2, forward = forward, forward2 = forward2, half = True))
    
    design.add_crossovers(crossovers)
def add_scaffold_nicks(design: sc.Design, seam_locations):
    """Adds nicks to the precursor scaffold"""
    for helix in range(len(seam_locations)):
        if seam_locations[helix] == 'no seam':
            continue
        else:
            nick_offsets = seam_locations[helix]
            for nick_offset in nick_offsets:
                if nick_offset != 'no seam':
                    forward = sc_general.forward_strand(helix, 'scaffold')
                    design.add_nick(helix = helix, offset = nick_offset, forward = forward)
Example #4
0
def add_adaptor_crossovers(design):
    """Given a adaptor design, adds the crossovers"""
    crossovers = []
    croosover_locations = [16, 36, 37]
    for helix in range(1, 12, 2):
        if helix == 11:
            helix2 = 0
        else:
            helix2 = helix + 1
        forward = sc_general.forward_strand(helix, 'staple')
        forward2 = sc_general.forward_strand(helix2, 'staple')
        for offset in croosover_locations:
            crossovers.append(
                sc.Crossover(helix=helix,
                             helix2=helix2,
                             offset=offset,
                             offset2=offset,
                             forward=forward,
                             forward2=forward2,
                             half=True))

    design.add_crossovers(crossovers)
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_staple_nicks(design: sc.Design, nick_locations):
    """Adds nicks ot the precursor staple strands"""
    for helix in range(len(nick_locations)):
        forward = sc_general.forward_strand(helix, 'staple')
        for nick in nick_locations[helix]:
            design.add_nick(helix = helix, offset = nick, forward = forward)
Example #8
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)
Example #9
0
            seq = seq + sc_adaptor.tile_adapt_seq(helix)
        else:
            seq = sc_adaptor.tile_adapt_seq(helix) + seq
        staple_seq.append(seq)

    #scaffold
    design = sc_create.create_helices(lattice_domain, lattice, grid_type)
    not_fixed_scaf_seq = sc_adaptor.outside_adaptor_seq(sticky_seq)
    scaf_seq = []
    for helix in range(len(not_fixed_scaf_seq)):
        seq = not_fixed_scaf_seq[helix]
        if helix % 2 == 1:
            seq = seq[5:]
        scaf_seq.append(seq)
    sc_create.add_precursor_scaffolds(design,
                                      scaffold_domain,
                                      dna_seq=scaf_seq)

    #staples
    sc_create.add_precursor_staples(design, staple_domain, dna_seq=staple_seq)
    for helix in range(1, 12, 2):
        forward = sc_general.forward_strand(helix, 'staple')
        design.add_nick(helix=helix, offset=24, forward=forward)
    for helix in range(12):
        forward = sc_general.forward_strand(helix, 'staple')
        design.add_nick(helix=helix, offset=37, forward=forward)

    sc_adaptor.add_adaptor_crossovers(design)

    design.write_scadnano_file()