ws=9 print_logo_threshold=8 input_value="3 3 2 1 1 0 2 12 13 7 10 7 1 2 4 4 3 5 5 5 4 4 2 1 3 1 3 8 13 7 10 7 1 1 4 4 4 4 5 5 4 4 2 1 2 1 2 9 14 8 10 7 1 2 4 4 4 4 5 5 3 3 1 0 2 0 2 11 12 7 10 7 1 1 4 4 4 5 5 7 4 4 2 1 2 1 2 9 13 7 9 7 1 1 4 4 4 5 5 6 4 4 2 0 2 1 3 9 11 7 9 7 1 2 4 4 4 6 5 6 4 4 2 1 2 1 3 10 11 7 8 7 1 1 4 4 4 5 5 6 4 5 2 1 3 1 3 9 12 7 8 7 1 1 4 4 4 5 4 6 5 4 2 1 3 1 3 9 12 7 8 7 1 1 5 4 3 5 4 6 " output=open('motif_logo.txt','w') #input the motif inforamtion here, replace space with "," motif_result=[] for value in input_value.split(): motif_result.append(int(float(value))) motif=[] amino_acid=['V','L','I','M','F','W','Y','G','A','P','S','T','C','H','R','K','Q','E','N','D'] #read in motif info for i in range(ws): motif.append(motif_result[0:20]) motif_result=motif_result[20:] #create output space output_space=[] for i in range(100): aa=[] for j in range(ws): aa.append('.') output_space.append(aa) for i in range(ws): count=0 for j in range(20): if motif[i][j] >= print_logo_threshold: for k in range(motif[i][j]): output_space[count][i]=amino_acid[j] count+=1 for line in range(100): for word in range(ws): output.write(output_space[line][word]) output.write('\n') output.close() print "done!!"