IGEM:Harvard/2006/Container Design 4/Python Code/Oligo Sorting

From OpenWetWare

Jump to: navigation, search
#####
# oligo sorting
#####
#
barrel_core = [0, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15, 16, 18, 19, 20,  22,
24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 44, 45,
46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77] barrel_latch = [21, 27, 43, 60]
barrel_aptamer_out = [2, 7, 17, 23]
barrel_aptamer_in = [1, 11, 36, 47]  
lid_core = [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34]
lid_latch = [2, 29] 

# output all oligos
output_file = file('lid_1_all_oligos.txt', 'w')
for oligo in oligo_ra:
        output_file.write(oligo + '\n')
output_file.close()

if (shape == 1):
        # barrel output

        barrel_oligos_file = file('barrel_oligos_sorted.txt', 'w')
        # output barrel core oligos
        barrel_oligos_file.write('Core Oligos' + '\n')
        barrel_oligos_file.close()
        # to append the file needs to be reopened in append mode.
        barrel_oligos_file = file('barrel_oligos_sorted.txt', 'a')

        for oligo_num in barrel_core:
                barrel_oligos_file.write(str(oligo_num) + ' : ' + oligo_ra[oligo_num] + '\n')
        # out + apts
        barrel_oligos_file.write('\n' + 'Out + Apts' + '\n')
        for oligo_num in barrel_aptamer_out:
                barrel_oligos_file.write(str(oligo_num) + ' : ' + oligo_ra[oligo_num] + '\n')
        # out - apts
        barrel_oligos_file.write('\n' + 'Out - Apts' + '\n')
        for oligo_num in barrel_aptamer_out:
                barrel_oligos_file.write(str(oligo_num) + ' : ' + original_oligo_ra[oligo_num] + '\n')
        
        # in - apts
        barrel_oligos_file.write('\n' + 'In - Apts' + '\n')
        for oligo_num in barrel_aptamer_in:
                barrel_oligos_file.write(str(oligo_num) + ' : ' + original_oligo_ra[oligo_num] + '\n')
        
        # in + apts
        barrel_oligos_file.write('\n' + 'In + Apts' +'\n')
        for oligo_num in barrel_aptamer_in:
                barrel_oligos_file.write(str(oligo_num) + ' : ' + oligo_ra[oligo_num] + '\n')
        
        # barrel oligos with latches - two oligo design
        barrel_oligos_file.write('\n' + 'Oligos with Latches - Design 1' + '\n')
        for oligo_num in barrel_latch:
                barrel_oligos_file.write(str(oligo_num) + ' : ' + oligo_ra[oligo_num] + '\n')
        
        # barrel oligos with latches - four oligo design
        barrel_oligos_file.write('\n' + 'Oligos with Latches - Design 2\n')
        for oligo_num in barrel_latch:
                barrel_oligos_file.write(str(oligo_num) + ' Design 2: ' + latch_2_oligo_ra[oligo_num] + '\n')
        
        # barrel oligos replacing all latches
        barrel_oligos_file.write('\n' + 'Oligos replacing all latches\n')
        for oligo_num in barrel_latch:
                barrel_oligos_file.write(str(oligo_num) + ' : ' + original_oligo_ra[oligo_num] + '\n')
        
                
        barrel_oligos_file.close()

if (shape == 2):
        # lid output
        
        # output lid core oligos
        # we first open the file for writing because we want to clear
        # anything that was there before. Then we close it and reopen it
        # in append mode.
        lid_oligos_file = file('lid1_oligos_sorted.txt', 'w')
        lid_oligos_file.write('Lid Core' + '\n')
        lid_oligos_file.close()
        lid_oligos_file = file('lid1_oligos_sorted.txt', 'a')
        for oligo_num in lid_core:
                lid_oligos_file.write(str(oligo_num) + ' : ' + oligo_ra[oligo_num] + '\n')
        
        # output lid oligos with latches -- 2 oligo design
        lid_oligos_file.write('\nLid Latch Oligos - 2 Oligo Design\n')
        for oligo_num in lid_latch:
                lid_oligos_file.write(str(oligo_num) + ' : ' + oligo_ra[oligo_num] + '\n')
        
        # output lid oligos with latches -- 4 oligo design
        lid_oligos_file.write('\nLid Latch Oligos - 4 Oligo Design\n')
        for oligo_num in lid_latch:
                lid_oligos_file.write(str(oligo_num) + ' Design 2 : ' + latch_2_oligo_ra[oligo_num] + '\n')
        
        # output lid oligos that replace those with latches
        lid_oligos_file.write('\nLid Replacement Oligos - No Latches\n')
        for oligo_num in lid_latch:
                lid_oligos_file.write(str(oligo_num) + ' : ' + original_oligo_ra[oligo_num] + '\n')
        
        lid_oligos_file.close()
<\pre>
Personal tools