def gen_plate_layout(cols): pp=[] for col in range(1, cols + 1): for row in ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']: pp.append(row + str(col)) return pp set_list = gen_plate_layout(12) your_list = ['b1', 'b2', 'b3', 'h3', 'a4', 'b4', 'c4', 'd4', 'e4', 'f4', 'g4', 'h4', 'a5', 'b5', 'c5'] your_list = [i.upper() for i in your_list] #seq2: Deepwell_Mix Destination list_index = range(len(your_list)) deepwell_mx_dest = [] for i in list_index: deepwell_mx_dest.append(set_list[i]) #seq3: miRNA Template Source set_index = [] plate1 = [] plate2 = [] plate3 = [] cDNA = [] cDNA.append(plate1) cDNA.append(plate2) cDNA.append(plate3) for i in list_index: set_index.append(set_list.index(your_list[i])) print set_index for i in set_index: w = i % 8 + 48 * (i >= 8) #print i, w if 0 <= i < 16 and i < 8: for x in range(1,7): #print w plate1.append((set_list[w])) w = w + 8 elif 0 <= i < 16 and i >= 8: for x in range(1,7): #print w plate1.append((set_list[w])) w = w + 8 elif 16 <= i < 31 and i % 2 == 0: for x in set_index: x = (x-16) + 8 plate2.append((set_list[x])) elif 16 <= i < 31 and i % 2 != 0: for x in set_index: x = (x -16) + 8 plate2.append((set_list[x])) elif 32 <= i < 47 and i % 2 == 0: for x in set_index: x = (x -32) + 8 plate3.append((set_list[x])) elif 32 <= i < 47 and i % 2 != 0: for x in set_index: x = (x -32) + 8 plate3.append((set_list[x])) else: break print i, plate1, plate2, plate3 print plate3
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question