def main(protein): new_object = functions.protein_place(protein) for i in range(50): functions.Visualizer2D(new_object, protein, 0, 'test%s' % (5000 + i)) fold_dir = random.randint(1, 3) fold_num = random.randint(2, len(protein)) print fold_dir, fold_num coor_array = folder_iter.get_coor_array(new_object) fold_protein = folder_dir.folder_direct(coor_array, fold_num, fold_dir) new_object = folder_iter.update_objects(new_object, fold_protein) functions.Visualizer2D(new_object, protein, 0, 'test%s' % (5050 + i)) print 'succesfull fold'
def main(protein): protein_array = copy.deepcopy(protein) for i in range(4, len(protein)): best_score = 0 best_protein = [] for j in range(8): protein_object = functions.protein_place(protein[i]) new_protein = simulated_annealing.anneal(protein_object, i+10*j, 1) print "result:" print i,new_protein[0], new_protein[1] # folder_iter.write_csv(new_protein[2], 'result_anneal%s' %(i+10*j)) if new_protein[0]<best_score: best_score = new_protein[0] best_protein = copy.deepcopy(new_protein[1]) functions.Visualizer2D(new_protein[1], protein[i], new_protein[0], i+10*j + 800) functions.Visualizer2D(best_protein, protein[i], best_score, i+10*j + 900)
def visual_array_result(protein_array, protein, name): best = 0 best_object = [] for item in protein_array: if item[0] < best: best = copy.deepcopy(item[0]) best_object = copy.deepcopy(item[1]) functions.Visualizer2D(best_object, protein, best, name) return [best, best_object]
def main(): # length = 50 # h_concentration = 30 # protein_array = copy.copy(protein_generator.protein_generator(length, h_concentration, 100)) # result_array = [] # for protein in protein_array: # protein_object = functions.protein_place(protein) # print protein_object # configurations = 500 # start_pos = folder_iter.random_sampling(protein_object, configurations, 5) # # folder_iter.write_csv(start_pos, 'random_sampling%s' %protein) # theo = test.theo_score(protein) # score_saver = [protein, configurations] + [0]*(theo[0]+1) # print score_saver # for result in start_pos: # score_saver[abs(result[0])+2] += 1 # high_score = protein_generator.highscorefreq(score_saver) # result_array.append(score_saver) # folder_iter.write_csv(result_array, 'randomsampling_overview%s_%s' %(length, h_concentration)) protein_array = csv_move.make_array() # # csv_name = # f = open('results/final/randomsampling_overview50_20.csv','r') # data = csv.reader(f, delimiter=',') # for row in data: # if row[0] != 'protein': # protein_array.append(row[0]) # print protein_array for j in range(len(protein_array)): protein_object = functions.protein_place(protein_array[j]) print 'protein_object made' for i in range(14): new_protein = simulated_annealing.anneal(protein_object, 'test7%s' % (130 + i), 1) # print 'new_protein made' folder_iter.write_csv( new_protein[2], 'SA_50_20_15/result_anneal%s' % (protein_array[j] + str(i))) # print 'written to csv' functions.Visualizer2D(new_protein[1], protein_array[j], new_protein[0], 'anneal7%s' % (protein_array[j] + str(i))) print 'SA succes'
def main(protein): protein_array = copy.deepcopy(protein) for j in range(len(protein_array)): protein_object = functions.protein_place(protein_array[j]) print 'protein_object made' for i in range(20): new_protein = simulated_annealing.anneal(protein_object, 'test%s' % (130 + i), 1) # print 'new_protein made' folder_iter.write_csv( new_protein[2], 'result_anneal%s' % (protein_array[j] + str(i))) # print 'written to csv' functions.Visualizer2D(new_protein[1], protein_array[j], new_protein[0], 'anneal%s' % (protein_array[j] + str(i))) print 'hillclimber succes'
import classes, functions, cProfile, copy, folder_iter, simulated_annealing, protein_generator, test, csv protein = 'HHHHHHHH' protein_object = functions.protein_place(protein) coor_array = folder_iter.get_coor_array(protein_object) array_new = folder_iter.folder_protein(coor_array, 2, 1) array_new_new = folder_iter.folder_protein(array_new, 3, 1) array_more_new = folder_iter.folder_protein(array_new_new, 5, 1) array_final = folder_iter.folder_protein(array_more_new, 7, 1) new_object = folder_iter.update_objects(protein_object, array_final) functions.Visualizer2D(new_object, protein, 0, 'testvoorpaper')