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