Created
May 29, 2023 01:53
-
-
Save jamessdixon/719a5c0ca95ec6149daee9574b40e376 to your computer and use it in GitHub Desktop.
print out matched_hits
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_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