1

Somewhat similar to this thread:

How can I get taxonomic rank names from taxid?

I have a taxID for a genus and I want to pull all taxIDs or accession numbers below that genus. Can anyone advise?

1 Answers1

4

ETE toolkit can help here too. The "getting descendant taxa" section of ETEtoolkit tutorial is what you need. See link for more details. Relevant code below.

For example genus taxID 171 (leptospira)

from ete3 import NCBITaxa
ncbi = NCBITaxa()
descendants = ncbi.get_descendant_taxa(171)
# to print names of the taxIDs in the descendants
print(ncbi.translate_to_names(descendants))
nsarode
  • 41
  • 4