Skip to content

Instantly share code, notes, and snippets.

@jamessdixon
Created May 29, 2023 01:53
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/719a5c0ca95ec6149daee9574b40e376 to your computer and use it in GitHub Desktop.
Save jamessdixon/719a5c0ca95ec6149daee9574b40e376 to your computer and use it in GitHub Desktop.
print out matched_hits
def write_masses_to_disk(matched_masses, flavor):
file_name = 'matched_masses_' + flavor + '.csv'
with open(file_name, 'w') as t:
header = 'precursor_weight'+ '\t'+ 'matched_weight'+ '\t'+ 'start_index'+ '\t'+ 'end_index'+ '\t'+ 'b_ion'+ '\t'+ 'single_charge'+ '\t'+ 'protein_number'+ "\n"
t.write(header)
for key, values in matched_masses.items():
for value in values:
first,second,third,fourth,fifth,sixth = value
item = str(key) + '\t' + str(first)+ '\t' + str(second)+ '\t' + str(third)+ '\t' + str(fourth)+ '\t' + str(fifth)+ '\t' + str(sixth) + "\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