Created
June 4, 2023 13:26
-
-
Save jamessdixon/59e1f3e34d619cca923405fad928297e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def write_merged_seqs_to_disk(merged_seqs): | |
file_name = 'merged_seqs_.csv' | |
with open(file_name, 'w') as t: | |
header = 'total_score'+ '\t'+ 'pid'+ '\t'+ 'start'+ '\t'+ 'end'+ '\t'+ 'score'+ '\t'+ 'mz'+ '\t' + 'charge'+ '\t'+ 'extensions'+ '\t' + 'seq'+ '\n' | |
t.write(header) | |
for merged_seq in merged_seqs: | |
total_score,b,y= merged_seq | |
b_pid,b_start,b_end,b_score,b_mz,b_charge,b_extensions,b_seq = b | |
item = str(total_score)+ '\t' + str(b_pid)+ '\t' + str(b_start)+ '\t' + str(b_end)+ '\t' + str(b_score) + '\t' + str(b_mz) + '\t' + str(b_charge) + '\t' + str(b_extensions) + '\t' + str(b_seq) + '\n' | |
with open(file_name, 'a') as t: | |
t.write(item) | |
y_pid,y_start,y_end,y_score,y_mz,y_charge,y_extensions,y_seq = y | |
item = str(total_score)+ '\t' + str(y_pid)+ '\t' + str(y_start)+ '\t' + str(y_end)+ '\t' + str(y_score)+ '\t' + str(y_mz) + '\t' + str(y_charge) + '\t' + str(y_extensions) + '\t' + str(y_seq) + '\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