Last active
June 7, 2023 18:52
-
-
Save jamessdixon/aab55dfec351307bc3894d0aaeaf0deb 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_sorted_clusters_to_disk(sorted_clusters, flavor): | |
file_name = 'sorted_clusters_' + flavor + '.csv' | |
with open(file_name, 'w') as t: | |
header = 'score'+ '\t'+ 'pid'+ '\t'+ 'start'+ '\t'+ 'end'+ '\t'+ 'mz'+ '\t'+ 'charge'+ '\t'+ 'extensions'+ "\t" + 'seq'+ "\n" | |
t.write(header) | |
for sorted_cluster in sorted_clusters: | |
item = str(sorted_cluster.score)+ '\t' + str(sorted_cluster.pid)+ '\t' + str(sorted_cluster.start)+ '\t' + str(sorted_cluster.end)+ '\t' + str(sorted_cluster.mz)+ '\t' + str(sorted_cluster.charge) + '\t' + str(sorted_cluster.extensions) + '\t' + str(sorted_cluster.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