Skip to content

Commit 1206da5

Browse files
authored
Small bug fix in kaiju parser assuming 20 phylums
1 parent 82dcd03 commit 1206da5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎anvio/parsers/kaiju.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@ def process(self):
148148

149149

150150
self.progress.end()
151-
152-
random_phylum_names = set([taxonomy_dict[e]['t_phylum'] for e in random.sample(list(taxonomy_dict.keys()), 20)])
151+
152+
sample_size = min(20, len(taxonomy_dict)) # Handle fewer than 20 phylums
153+
random_phylum_names = set([taxonomy_dict[e]['t_phylum'] for e in random.sample(list(taxonomy_dict.keys()), sample_size)])
153154

154155
self.run.warning("Good news: anvi'o finished parsing kaiju taxonomy output. Bad news: it has no idea whether "
155156
"it did well or not. Because the user can ask kaiju to report certain taxonomic levels, but "

0 commit comments

Comments
 (0)