#Open the files you just created with the gapless sequences and read in the sequences. fp_natural = open(natural_pdb_file_title) natural_data_arr = fp_natural.readlines() fp_natural.close() fp_designed = open(duncan_designed_sequence_path + designed_pdb_file_title) designed_data_arr = fp_designed.readlines() fp_designed.close() #filepointer for the partial result fpW_natural = open("results_array_natural_" + pdb_id + "_" + chain_id + ".csv","w") fpW_designed = open("results_array_" + pdb_id + "_" + chain_id + "_" + method + ".csv","w") #write the RSA values: fpW_natural.write(af.dump_csv_line(RSA)) fpW_designed.write(af.dump_csv_line(RSA)) if(len(RSA) != len(natural_data_arr[0].strip())): print "Error !!!!!!!!!" #print data_arr[0].strip() bad_list.append(natural_pdb_file_title) if(len(RSA) != len(natural_data_arr[0].strip())): print "Error !!!!!!!!!" print "Length of rsa values {:0}".format(len(RSA)) print "Length of sequence {:0}".format(len(natural_data_arr[0].strip())) #Re-format sequences for line in natural_data_arr: fpW_natural.write(af.dump_csv_line(line.strip()))
#Get all the RSA values using DSSP seq_data = af.get_noah_RSA_values(pdb_id, chain_id) RSA = seq_data[1] #Get the RSA values RSA_dict = seq_data[2] #Get the dict mapping positions to RSA new_RSA = af.get_cut_RSA_values(pdb_id, RSA, RSA_dict) index = 0 #Arrays full of the designed and natural sequences natural_data_arr = cut_natural_sequences designed_data_arr = af.get_cut_designed_sequences(designed_file) fpW_natural = open("results_array_natural_" + pdb_id + "_" + chain_id + ".csv","w") fpW_designed = open("results_array_" + pdb_id + "_" + chain_id + "_" + "soft" + ".csv","w") #write the RSA values: fpW_natural.write(af.dump_csv_line(new_RSA)) fpW_designed.write(af.dump_csv_line(new_RSA)) if(len(new_RSA) != len(natural_data_arr[0].strip())): print "Error !!!!!!!!!" #print data_arr[0].strip() bad_list.append(natural_pdb_file_title) if(len(new_RSA) != len(natural_data_arr[0].strip())): print "Error !!!!!!!!!" print "Length of rsa values {:0}".format(len(RSA)) print "Length of sequence {:0}".format(len(natural_data_arr[0].strip())) print "Length of designed sequence {:0}".format(len(designed_data_arr[0].strip())) #Re-format sequences for line in natural_data_arr:
RSAValues = [] RSA = seq_data[1] print len(RSA) index = 0 #Open the files you just created with the gapless sequences fp_natural = open(natural_pdb_file_title) natural_data_arr = fp_natural.readlines() fp_natural.close() #filepointer for the partial result fpW_natural = open( "results_array_natural_" + pdb_id + "_" + chain_id + ".csv", "w") #write the RSA values: fpW_natural.write(af.dump_csv_line(RSA)) [natural_sample1, natural_sample2] = af.split_natural_sequences( natural_data_arr) #Splits the sequences into two samples #filepointer for the partial result fpW_natural_sample1 = open( "results_array_natural_sample1_" + pdb_id + "_" + chain_id + ".csv", "w") fpW_natural_sample2 = open( "results_array_natural_sample2_" + pdb_id + "_" + chain_id + ".csv", "w") #write the RSA values: fpW_natural_sample1.write(af.dump_csv_line(RSA)) fpW_natural_sample2.write(af.dump_csv_line(RSA))
seq_data = af.get_values(pdb_id, chain_id) RSAValues = [] RSA = seq_data[1] print "RSA Length from dssp script: " + str(len(RSA)) index = 0 #Open the files you just created with the gapless sequences fp_natural = open(natural_pdb_file_title) natural_data_arr = fp_natural.readlines() fp_natural.close() #filepointer for the partial result fpW_natural = open("results_array_natural_" + pdb_id + "_" + chain_id + ".csv","w") #write the RSA values: fpW_natural.write(af.dump_csv_line(RSA)) [natural_sample1, natural_sample2] = af.split_natural_sequences(natural_data_arr) #Samples #filepointer for the partial result fpW_natural_sample1 = open("results_array_natural_sample1_" + pdb_id + "_" + chain_id + ".csv","w") fpW_natural_sample2 = open("results_array_natural_sample2_" + pdb_id + "_" + chain_id + ".csv","w") #write the RSA values: fpW_natural_sample1.write(af.dump_csv_line(RSA)) fpW_natural_sample2.write(af.dump_csv_line(RSA)) if(len(RSA) != len(natural_data_arr[0].strip())): print "Error !!!!!!!!!" #print data_arr[0].strip() bad_list.append(natural_pdb_file_title)