Cython API, taxonomy: fixed parental tree iterator (skipped second to
last taxon, in OBI1 too)
This commit is contained in:
@ -113,7 +113,7 @@ cdef class Taxonomy(OBIWrapper) :
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
cpdef Taxon get_taxon_by_taxid(self, int taxid): # TODO check deleted taxon behavior (403122)
|
||||
cpdef Taxon get_taxon_by_taxid(self, int taxid):
|
||||
cdef ecotx_t* taxon_p
|
||||
cdef object taxon_capsule
|
||||
taxon_p = obi_taxo_get_taxon_with_taxid(self.pointer(), taxid)
|
||||
@ -256,13 +256,13 @@ cdef class Taxonomy(OBIWrapper) :
|
||||
cdef Taxon taxon
|
||||
try:
|
||||
taxon = self.get_taxon_by_taxid(taxid)
|
||||
except: # TODO error handling (related to deleted taxon thing)
|
||||
except:
|
||||
raise StopIteration
|
||||
if taxon is not None:
|
||||
while taxon.parent.taxid != 1: # TODO was 0 before?
|
||||
while taxon.taxid != 1:
|
||||
yield taxon
|
||||
taxon = taxon.parent
|
||||
yield self[1]
|
||||
yield taxon
|
||||
else:
|
||||
raise StopIteration
|
||||
|
||||
|
Reference in New Issue
Block a user