changeset 3:c5e0e05ce58a draft

planemo upload commit 120ca2f78836796630f3116ec95ad0326c6e6b6f
author cpt
date Thu, 08 Aug 2024 03:33:45 +0000
parents 8e34cd137d3e
children 258afe02e34a
files protein_blast_grouping.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/protein_blast_grouping.py	Thu Aug 08 03:02:17 2024 +0000
+++ b/protein_blast_grouping.py	Thu Aug 08 03:33:45 2024 +0000
@@ -42,16 +42,20 @@
         self, num_hits, sort_key="unique_queries", output_file=sys.stdout
     ):
         top_hits = self.get_top_hits(num_hits, sort_key)
-        print(f"# Top {num_hits} Hits")
+        print(f"# Top {num_hits} Hits", file=output_file)
         print(
-            "{:<50} {:<25} {:<25}".format(
-                "# Name", "Unique Query Matches", "Unique Subject Hits"
-            )
+            "{:>4} {:<20} {:>10} {:>10}".format(
+                "Rank", "Phage Name", "Unique Query Matches", "Unique Subject Hits"
+            ),
+            file=output_file,
         )
-        for organism, data in top_hits:
+        for rank, (organism, data) in enumerate(top_hits):
             print(
-                "{:<50} {:<25} {:<25}".format(
-                    organism, len(data["unique_queries"]), len(data["unique_hits"])
+                "{:>4} {:<50} {:<25} {:<25}".format(
+                    rank,
+                    organism,
+                    len(data["unique_queries"]),
+                    len(data["unique_hits"]),
                 ),
                 file=output_file,
             )