Actualiser src/libecoPCR/ecotax.c
This commit is contained in:
@ -32,7 +32,7 @@ ecotxidx_t *read_taxonomyidx(const char *filename,const char *filename2)
|
|||||||
fprintf(stderr,"Reading %d taxa...\n",count);
|
fprintf(stderr,"Reading %d taxa...\n",count);
|
||||||
for (i=0; i < count; i++){
|
for (i=0; i < count; i++){
|
||||||
readnext_ecotaxon(f,&(index->taxon[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)
|
if (count2>0)
|
||||||
@ -42,7 +42,7 @@ ecotxidx_t *read_taxonomyidx(const char *filename,const char *filename2)
|
|||||||
|
|
||||||
for (i=0; i < count2; i++){
|
for (i=0; i < count2; i++){
|
||||||
readnext_ecotaxon(f2,&(index->taxon[count+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;
|
return index;
|
||||||
@ -112,7 +112,7 @@ ecotx_t *readnext_ecotaxon(FILE *f,ecotx_t *taxon)
|
|||||||
raw->taxid = swap_int32_t(raw->taxid);
|
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->taxid = raw->taxid;
|
||||||
taxon->rank = raw->rank;
|
taxon->rank = raw->rank;
|
||||||
|
|
||||||
@ -133,14 +133,14 @@ ecotaxonomy_t *read_taxonomy(const char *prefix,int32_t readAlternativeName)
|
|||||||
int buffsize;
|
int buffsize;
|
||||||
|
|
||||||
tax = ECOMALLOC(sizeof(ecotaxonomy_t),
|
tax = ECOMALLOC(sizeof(ecotaxonomy_t),
|
||||||
"Allocate taxonomy structure");
|
"Allocate taxonomy structure");
|
||||||
|
|
||||||
buffsize = strlen(prefix)+10;
|
buffsize = strlen(prefix)+10;
|
||||||
|
|
||||||
filename = ECOMALLOC(buffsize,
|
filename = ECOMALLOC(buffsize,
|
||||||
"Allocate filename");
|
"Allocate filename");
|
||||||
filename2= ECOMALLOC(buffsize,
|
filename2= ECOMALLOC(buffsize,
|
||||||
"Allocate filename");
|
"Allocate filename");
|
||||||
|
|
||||||
snprintf(filename,buffsize,"%s.rdx",prefix);
|
snprintf(filename,buffsize,"%s.rdx",prefix);
|
||||||
|
|
||||||
@ -153,12 +153,13 @@ ecotaxonomy_t *read_taxonomy(const char *prefix,int32_t readAlternativeName)
|
|||||||
|
|
||||||
if (readAlternativeName)
|
if (readAlternativeName)
|
||||||
{
|
{
|
||||||
snprintf(filename,buffsize,"%s.ndx",prefix);
|
snprintf(filename,buffsize,"%s.ndx",prefix);
|
||||||
tax->names=read_nameidx(filename,tax);
|
tax->names=read_nameidx(filename,tax);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tax->names=NULL;
|
tax->names=NULL;
|
||||||
return tax;
|
return tax;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -340,6 +341,9 @@ ecotx_t *eco_getsuperkingdom(ecotx_t *taxon,
|
|||||||
if (taxonomy && tax!=taxonomy)
|
if (taxonomy && tax!=taxonomy)
|
||||||
{
|
{
|
||||||
rankindex = rank_index("superkingdom",taxonomy->ranks);
|
rankindex = rank_index("superkingdom",taxonomy->ranks);
|
||||||
|
if (rankindex < 0) {
|
||||||
|
rankindex = rank_index("domain",taxonomy->ranks);
|
||||||
|
}
|
||||||
tax=taxonomy;
|
tax=taxonomy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user