Actualiser src/libecoPCR/ecotax.c

This commit is contained in:
2025-06-12 13:33:51 +00:00
parent 1e3f82bb51
commit 791aeb0ef9

View File

@ -32,7 +32,7 @@ ecotxidx_t *read_taxonomyidx(const char *filename,const char *filename2)
fprintf(stderr,"Reading %d taxa...\n",count);
for (i=0; i < count; i++){
readnext_ecotaxon(f,&(index->taxon[i]));
index->taxon[i].parent=index->taxon + (int64_t)index->taxon[i].parent;
index->taxon[i].parent=index->taxon + (int32_t)index->taxon[i].parent;
}
if (count2>0)
@ -42,7 +42,7 @@ ecotxidx_t *read_taxonomyidx(const char *filename,const char *filename2)
for (i=0; i < count2; i++){
readnext_ecotaxon(f2,&(index->taxon[count+i]));
index->taxon[count+i].parent=index->taxon + (int64_t)index->taxon[count+i].parent;
index->taxon[count+i].parent=index->taxon + (int32_t)index->taxon[count+i].parent;
}
return index;
@ -112,7 +112,7 @@ ecotx_t *readnext_ecotaxon(FILE *f,ecotx_t *taxon)
raw->taxid = swap_int32_t(raw->taxid);
}
taxon->parent = (ecotx_t*)(size_t)raw->parent;
taxon->parent = (ecotx_t*)raw->parent;
taxon->taxid = raw->taxid;
taxon->rank = raw->rank;
@ -133,14 +133,14 @@ ecotaxonomy_t *read_taxonomy(const char *prefix,int32_t readAlternativeName)
int buffsize;
tax = ECOMALLOC(sizeof(ecotaxonomy_t),
"Allocate taxonomy structure");
"Allocate taxonomy structure");
buffsize = strlen(prefix)+10;
filename = ECOMALLOC(buffsize,
"Allocate filename");
"Allocate filename");
filename2= ECOMALLOC(buffsize,
"Allocate filename");
"Allocate filename");
snprintf(filename,buffsize,"%s.rdx",prefix);
@ -153,12 +153,13 @@ ecotaxonomy_t *read_taxonomy(const char *prefix,int32_t readAlternativeName)
if (readAlternativeName)
{
snprintf(filename,buffsize,"%s.ndx",prefix);
snprintf(filename,buffsize,"%s.ndx",prefix);
tax->names=read_nameidx(filename,tax);
}
else
tax->names=NULL;
return tax;
}
@ -340,6 +341,9 @@ ecotx_t *eco_getsuperkingdom(ecotx_t *taxon,
if (taxonomy && tax!=taxonomy)
{
rankindex = rank_index("superkingdom",taxonomy->ranks);
if (rankindex < 0) {
rankindex = rank_index("domain",taxonomy->ranks);
}
tax=taxonomy;
}