#pairwise sequence alignment results results = main_algorithm(df_encoded, gap, T, s, 0) #reset indexes df_encoded = df_encoded.reset_index() #convert similarity matrix into distance matrix results['score'] = convert_to_distance_matrix(results['score']) #exception when all the scores are the same, in this case we continue with the next value of gap if ((results['score'] == 0).all()): print('entrei') continue else: #hierarchical clustering Z = hierarchical_clustering(results['score'], method, gap) #validation chosen = validation(M, df_encoded, results, Z, method, min_K, max_K + 1) chosen_k = chosen[2] df_avgs = chosen[0] df_stds = chosen[1] chosen_results = df_avgs.loc[chosen_k] chosen_results['gap'] = gap concat_for_final_decision.append(chosen_results) df_final_decision = pd.concat(concat_for_final_decision, axis=1).T final_k_results = final_decision(df_final_decision)
#reset indexes df_encoded = df_encoded.reset_index() #convert similarity matrix into distance matrix results['score'] = convert_to_distance_matrix(results['score']) #exception when all the scores are the same, in this case we continue with the next value of gap if((results['score']== 0).all()): #print('entrei') continue else: #hierarchical clustering Z = hierarchical_clustering(results['score'],method,gap,T,args.automatic,pp) #validation chosen = validation(M,df_encoded,results,Z,method,min_K,max_K+1,args.automatic,pp,gap,T) chosen_k = chosen[2] df_avgs = chosen[0] df_stds = chosen[1] chosen_results = df_avgs.loc[chosen_k] chosen_results['gap'] = gap concat_for_final_decision.append(chosen_results) ############################################################################ # RESULTS ############################################################################ #close pdf pp.close() if(args.automatic==1): df_final_decision = pd.concat(concat_for_final_decision,axis=1).T