Added an iterator to the OBI_Taxonomy cython class

This commit is contained in:
Celine Mercier
2016-11-02 11:08:18 +01:00
parent d8a257e711
commit 2504bf0fa9

View File

@ -6,7 +6,8 @@ from .capi.obitaxonomy cimport obi_read_taxonomy, \
obi_read_taxdump, \ obi_read_taxdump, \
obi_write_taxonomy, \ obi_write_taxonomy, \
obi_close_taxonomy, \ obi_close_taxonomy, \
obi_taxo_get_taxon_with_taxid obi_taxo_get_taxon_with_taxid, \
ecotx_t
from ._obidms cimport OBIDMS from ._obidms cimport OBIDMS
@ -43,19 +44,20 @@ cdef class OBI_Taxonomy :
raise Exception("Not implemented") raise Exception("Not implemented")
# def __iter__(self): def __iter__(self):
#
# cdef ecotx_t* taxa cdef ecotx_t* taxa
# cdef ecotx_t* taxon_p cdef ecotx_t* taxon_p
# cdef object taxon_capsule cdef object taxon_capsule
# cdef int t
# taxa = self._pointer.taxa.taxon
# taxa = self._pointer.taxa.taxon
# # Yield each taxid
# for t in range(self._pointer.taxa.count): # Yield each taxid
# taxon_p = taxa+t # TODO not compiling for mysterious cython reasons for t in range(self._pointer.taxa.count):
# taxon_capsule = PyCapsule_New(taxon_p, NULL, NULL) taxon_p = <ecotx_t*> (taxa+t) # TODO not compiling for mysterious cython reasons
# yield OBI_Taxon(taxon_capsule) taxon_capsule = PyCapsule_New(taxon_p, NULL, NULL)
yield OBI_Taxon(taxon_capsule)
cpdef write(self, str prefix) : cpdef write(self, str prefix) :