Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: taxonomy.getAncestry('taxid') does not redirect old taxid to new node with pruned taxonomy #13

Open
AndrazMarinc opened this issue Jul 23, 2024 · 0 comments

Comments

@AndrazMarinc
Copy link

AndrazMarinc commented Jul 23, 2024

First, thank you for this great toolkit, it's super convenient.

I think I might be dealing with a bug.
Version used: 3.1.1

Steps to reproduce:

  1. download taxdump
  2. Run code:
import taxidTools as txd

TAXDUMP = 'path_to_taxdump/'

tax = txd.read_taxdump(
    f'{TAXDUMP}nodes.dmp',
    f'{TAXDUMP}rankedlineage.dmp',
    f'{TAXDUMP}merged.dmp'
)

# Prune to only keep embryophyta to avoid ambiguity.
tax_pruned = tax.copy() 
tax_pruned.prune(3193)

# Get ancestry of "Liliaceae" from pruned taxonomy. Throws an error. 
tax_id_pruned = tax_pruned.getTaxid('Liliaceae')
tax_pruned.getAncestry(tax_id_pruned)  # Throws an error.

# Get ancestry of "Liliaceae" from original taxonomy. Works fine.
tax_id = tax.getTaxid('Liliaceae')
tax.getAncestry(tax_id)   # Works fine.

#  Both taxonomy ids are the same.
tax_id == tax_id_pruned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant