Mercurial > repos > cpt > cpt_protein_blast_grouping
comparison protein_blast_grouping.py @ 5:11701cc63084 draft default tip
planemo upload commit 12a58961f0eb41803c1954ac8c2543ed7c56186f
author | cpt |
---|---|
date | Thu, 08 Aug 2024 04:04:26 +0000 |
parents | 258afe02e34a |
children |
comparison
equal
deleted
inserted
replaced
4:258afe02e34a | 5:11701cc63084 |
---|---|
40 | 40 |
41 def print_results( | 41 def print_results( |
42 self, num_hits, sort_key="unique_queries", output_file=sys.stdout | 42 self, num_hits, sort_key="unique_queries", output_file=sys.stdout |
43 ): | 43 ): |
44 top_hits = self.get_top_hits(num_hits, sort_key) | 44 top_hits = self.get_top_hits(num_hits, sort_key) |
45 print(f"# Top {num_hits} Hits", file=output_file) | |
46 print( | 45 print( |
47 "Rank\tPhage Name\tUnique Query Matches\tUnique Subject Hits", | 46 "Rank\tPhage Name\tUnique Query Matches\tUnique Subject Hits", |
48 file=output_file, | 47 file=output_file, |
49 ) | 48 ) |
50 for rank, (organism, data) in enumerate(top_hits): | 49 for r, (organism, data) in enumerate(top_hits): |
50 rank = r + 1 # 1-based ranking | |
51 print( | 51 print( |
52 f"{rank}\t{organism}\t{len(data['unique_queries'])}\t{len(data['unique_hits'])}", | 52 f"{rank}\t{organism}\t{len(data['unique_queries'])}\t{len(data['unique_hits'])}", |
53 file=output_file, | 53 file=output_file, |
54 ) | 54 ) |
55 | 55 |