From 1324f6656928f2810ca1de51fb9c3bb47e5f54ce Mon Sep 17 00:00:00 2001 From: dengzq1234 Date: Sun, 29 Mar 2020 19:04:14 +0200 Subject: [PATCH] read synonyms table in get_descendant_taxa() if taxid deprecated #436 --- ete3/ncbi_taxonomy/ncbiquery.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ete3/ncbi_taxonomy/ncbiquery.py b/ete3/ncbi_taxonomy/ncbiquery.py index df0627cc6..75287d2bd 100644 --- a/ete3/ncbi_taxonomy/ncbiquery.py +++ b/ete3/ncbi_taxonomy/ncbiquery.py @@ -342,6 +342,11 @@ def get_descendant_taxa(self, parent, intermediate_nodes=False, rank_limit=None, except KeyError: raise ValueError('%s not found!' %parent) + # checks if taxid is a deprecated one, and converts into the right one. + _, conversion = self._translate_merged([taxid]) #try to find taxid in synonyms table + if conversion: + taxid = conversion[taxid] + with open(self.dbfile+".traverse.pkl", "rb") as CACHED_TRAVERSE: prepostorder = pickle.load(CACHED_TRAVERSE) descendants = {}