Mercurial > repos > cpt > cpt_protein_blast_grouping
comparison protein_blast_grouping.py @ 4:258afe02e34a draft
planemo upload commit 1098c37fcd6cf35d77748a08aa8b3ee9093c5aea
author | cpt |
---|---|
date | Thu, 08 Aug 2024 03:52:37 +0000 |
parents | c5e0e05ce58a |
children | 11701cc63084 |
comparison
equal
deleted
inserted
replaced
3:c5e0e05ce58a | 4:258afe02e34a |
---|---|
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) | 45 print(f"# Top {num_hits} Hits", file=output_file) |
46 print( | 46 print( |
47 "{:>4} {:<20} {:>10} {:>10}".format( | 47 "Rank\tPhage Name\tUnique Query Matches\tUnique Subject Hits", |
48 "Rank", "Phage Name", "Unique Query Matches", "Unique Subject Hits" | |
49 ), | |
50 file=output_file, | 48 file=output_file, |
51 ) | 49 ) |
52 for rank, (organism, data) in enumerate(top_hits): | 50 for rank, (organism, data) in enumerate(top_hits): |
53 print( | 51 print( |
54 "{:>4} {:<50} {:<25} {:<25}".format( | 52 f"{rank}\t{organism}\t{len(data['unique_queries'])}\t{len(data['unique_hits'])}", |
55 rank, | |
56 organism, | |
57 len(data["unique_queries"]), | |
58 len(data["unique_hits"]), | |
59 ), | |
60 file=output_file, | 53 file=output_file, |
61 ) | 54 ) |
62 | 55 |
63 | 56 |
64 def main(): | 57 def main(): |