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()
|
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 ecotx_t* taxon_p
|
||||||
cdef object taxon_capsule
|
cdef object taxon_capsule
|
||||||
taxon_p = obi_taxo_get_taxon_with_taxid(self.pointer(), taxid)
|
taxon_p = obi_taxo_get_taxon_with_taxid(self.pointer(), taxid)
|
||||||
@ -256,13 +256,13 @@ cdef class Taxonomy(OBIWrapper) :
|
|||||||
cdef Taxon taxon
|
cdef Taxon taxon
|
||||||
try:
|
try:
|
||||||
taxon = self.get_taxon_by_taxid(taxid)
|
taxon = self.get_taxon_by_taxid(taxid)
|
||||||
except: # TODO error handling (related to deleted taxon thing)
|
except:
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
if taxon is not None:
|
if taxon is not None:
|
||||||
while taxon.parent.taxid != 1: # TODO was 0 before?
|
while taxon.taxid != 1:
|
||||||
yield taxon
|
yield taxon
|
||||||
taxon = taxon.parent
|
taxon = taxon.parent
|
||||||
yield self[1]
|
yield taxon
|
||||||
else:
|
else:
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user