From acd8746bda109c24abffc3e924e4374ac38ec06f Mon Sep 17 00:00:00 2001 From: Chris Rosenthal Date: Fri, 31 May 2024 14:44:06 -0700 Subject: [PATCH] Fixed bug when filtering for named/classified tax_ids --- taxtastic/taxonomy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/taxtastic/taxonomy.py b/taxtastic/taxonomy.py index f4ffe9a..eccc4f9 100644 --- a/taxtastic/taxonomy.py +++ b/taxtastic/taxonomy.py @@ -833,8 +833,11 @@ def species_below(self, tax_id): return newc def named(self, no_rank=True): + nodes = self.nodes names = self.names - s = select(names.c.tax_id).where(names.c.is_classified) + s = select(nodes.c.tax_id) + s = s.join(nodes, nodes.c.tax_id == names.c.tax_id) + s = s.where(names.c.is_classified) if not no_rank: - s = s.where(names.c.rank != 'no_rank') + s = s.where(nodes.c.rank != 'no_rank') return [f[0] for f in self.fetchall(s)]