Improved taxonomy reading information display
This commit is contained in:
@ -1,5 +1,7 @@
|
|||||||
#cython: language_level=3
|
#cython: language_level=3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
from obitools3.utils cimport str2bytes, bytes2str, tobytes, tostr
|
from obitools3.utils cimport str2bytes, bytes2str, tobytes, tostr
|
||||||
from ..capi.obidms cimport OBIDMS_p, obi_dms_get_full_path
|
from ..capi.obidms cimport OBIDMS_p, obi_dms_get_full_path
|
||||||
|
|
||||||
@ -34,7 +36,7 @@ cdef class Taxonomy(OBIWrapper) :
|
|||||||
return <OBIDMS_taxonomy_p>(self._pointer)
|
return <OBIDMS_taxonomy_p>(self._pointer)
|
||||||
|
|
||||||
cdef fill_name_dict(self):
|
cdef fill_name_dict(self):
|
||||||
print("Indexing taxon names...")
|
print("Indexing taxon names...", file=sys.stderr)
|
||||||
|
|
||||||
cdef OBIDMS_taxonomy_p pointer = self.pointer()
|
cdef OBIDMS_taxonomy_p pointer = self.pointer()
|
||||||
cdef ecotx_t* taxon_p
|
cdef ecotx_t* taxon_p
|
||||||
@ -146,7 +148,9 @@ cdef class Taxonomy(OBIWrapper) :
|
|||||||
taxo._ranks = []
|
taxo._ranks = []
|
||||||
for r in range((<OBIDMS_taxonomy_p>pointer).ranks.count) :
|
for r in range((<OBIDMS_taxonomy_p>pointer).ranks.count) :
|
||||||
taxo._ranks.append(obi_taxo_rank_index_to_label(r, (<OBIDMS_taxonomy_p>pointer).ranks))
|
taxo._ranks.append(obi_taxo_rank_index_to_label(r, (<OBIDMS_taxonomy_p>pointer).ranks))
|
||||||
|
|
||||||
|
print('Read %d taxa' % len(taxo), file=sys.stderr)
|
||||||
|
|
||||||
return taxo
|
return taxo
|
||||||
|
|
||||||
|
|
||||||
@ -304,6 +308,11 @@ cdef class Taxonomy(OBIWrapper) :
|
|||||||
def name(self):
|
def name(self):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
# ranks property getter
|
||||||
|
@property
|
||||||
|
def ranks(self):
|
||||||
|
return self._ranks
|
||||||
|
|
||||||
|
|
||||||
def parental_tree_iterator(self, int taxid):
|
def parental_tree_iterator(self, int taxid):
|
||||||
"""
|
"""
|
||||||
|
@ -873,7 +873,7 @@ static ecotxidx_t* read_taxonomy_idx(const char* taxa_file_name, const char* loc
|
|||||||
taxa_index->buffer_size = taxa_index->count;
|
taxa_index->buffer_size = taxa_index->count;
|
||||||
|
|
||||||
taxa_index->max_taxid = 0;
|
taxa_index->max_taxid = 0;
|
||||||
printf("Reading %d taxa...\n", count_taxa);
|
fprintf(stderr, "Reading %d taxa...\n", count_taxa);
|
||||||
for (i=0; i<count_taxa; i++)
|
for (i=0; i<count_taxa; i++)
|
||||||
{
|
{
|
||||||
readnext_ecotaxon(f_taxa, &(taxa_index->taxon[i]));
|
readnext_ecotaxon(f_taxa, &(taxa_index->taxon[i]));
|
||||||
@ -886,9 +886,9 @@ static ecotxidx_t* read_taxonomy_idx(const char* taxa_file_name, const char* loc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count_local_taxa > 0)
|
if (count_local_taxa > 0)
|
||||||
printf("Reading %d local taxa...\n", count_local_taxa);
|
fprintf(stderr, "Reading %d local taxa...\n", count_local_taxa);
|
||||||
else
|
else
|
||||||
printf("No local taxa\n");
|
fprintf(stderr, "No local taxa\n");
|
||||||
|
|
||||||
count_taxa = taxa_index->count;
|
count_taxa = taxa_index->count;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user