From 8752eed0d4025a18682a94ebfaf1bbb299e7c3dd Mon Sep 17 00:00:00 2001 From: Chris Rosenthal Date: Fri, 31 May 2024 14:47:29 -0700 Subject: [PATCH] reorganizing named/classified fetching code so it is more efficient --- taxtastic/taxonomy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/taxtastic/taxonomy.py b/taxtastic/taxonomy.py index eccc4f9..4fdd62f 100644 --- a/taxtastic/taxonomy.py +++ b/taxtastic/taxonomy.py @@ -833,11 +833,11 @@ def species_below(self, tax_id): return newc def named(self, no_rank=True): - nodes = self.nodes names = self.names - s = select(nodes.c.tax_id) - s = s.join(nodes, nodes.c.tax_id == names.c.tax_id) + s = select(names.c.tax_id) s = s.where(names.c.is_classified) if not no_rank: + nodes = self.nodes + s = s.join(nodes, nodes.c.tax_id == names.c.tax_id) s = s.where(nodes.c.rank != 'no_rank') return [f[0] for f in self.fetchall(s)]