Skip to content

Commit

Permalink
putting taxa in list, not set
Browse files Browse the repository at this point in the history
  • Loading branch information
rvosa committed Aug 19, 2024
1 parent d41c1c3 commit 4fcab17
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions barcode_validator/taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,14 @@ def collect_higher_taxa(taxids, tree):

# Iterate over the collected tips to find their lineages to build a set
# of distinct higher taxa with the specified rank
taxa = set()
taxa = []
for tip in tips:
for node in tree.root.get_path(tip):
logging.debug(f'Traversing {node} from lineage {tip}')
if node.taxonomic_rank == str(config.get('level')).lower():
taxa.add(node)
logging.info(f"Found ancestor '{node}' for '{tip}'")
if node not in taxa: # Check for uniqueness
taxa.append(node)
logging.info(f"Found ancestor '{node}' for '{tip}'")
logging.info(f'Collected {len(taxa)} higher taxa')
return list(taxa)

Expand Down

0 comments on commit 4fcab17

Please sign in to comment.