Skip to content

Instantly share code, notes, and snippets.

@jamessdixon
Created June 4, 2023 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamessdixon/80753ee11c72d0e18ab94c7c23162747 to your computer and use it in GitHub Desktop.
Save jamessdixon/80753ee11c72d0e18ab94c7c23162747 to your computer and use it in GitHub Desktop.
file_name = 'postprocessed_alignments.csv'
with open(file_name, 'w') as t:
header = 'label'+ '\t'+ 'left_protein'+ '\t'+ 'right_protein'+ '\t'+ 'sequence' + '\t'+ 'b_score' + '\t'+ 'y_score' + '\t'+ 'total_score' + '\t'+ 'precursor_distance' + '\t'+ 'extended_sequence' + '\t'+ 'alignment' + '\n'
t.write(header)
for postprocessed_alignment in postprocessed_alignments:
label, left_protein, right_protein, sequence, b_score, y_score, total_score, precursor_distance, extended_sequence, alignment = postprocessed_alignment
item = str(label)+ '\t' + str(left_protein)+ '\t' + str(right_protein)+ '\t' + str(sequence)+ str(b_score)+ '\t' + str(y_score)+ '\t' + str(total_score)+ '\t' + str(precursor_distance)+ '\t' + str(extended_sequence)+ '\t' + str(alignment)+ '\t' +'\n'
with open(file_name, 'a') as t:
t.write(item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment