MOD: Corrected condition in getSon to handle the root of the taxonomy

git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPCR/trunk@422 60f365c0-8329-0410-b2a4-ec073aeeaa1d
This commit is contained in:
Frédéric Boyer
2012-05-16 07:52:28 +00:00
parent e2fe83fcb7
commit 745d50cfa4
2 changed files with 6 additions and 4 deletions

View File

@ -12,7 +12,7 @@
static void printresult(ecotx_t *taxon,econame_t* name,ecotaxonomy_t *taxonomy) static void printresult(ecotx_t *taxon,econame_t* name,ecotaxonomy_t *taxonomy)
{ {
char* rankname; char* rankname;
char* classname; char* classname;
char* matchedname=taxon->name; char* matchedname=taxon->name;
classname="scientific name"; classname="scientific name";
@ -45,6 +45,7 @@ static void printheader(void)
"scientific name"); "scientific name");
} }
/** /**
* display son's list for given taxon * display son's list for given taxon
**/ **/
@ -57,7 +58,8 @@ static void get_son(ecotaxonomy_t *taxonomy, ecotx_t *taxon, int32_t *count, cha
i < taxonomy->taxons->count; i < taxonomy->taxons->count;
i++, current_taxon++) i++, current_taxon++)
{ {
if (taxon->taxid == current_taxon->parent->taxid)
if (taxon != current_taxon && taxon->taxid == current_taxon->parent->taxid)
{ {
if (rankname == NULL || !strcmp(rankname,taxonomy->ranks->label[current_taxon->rank])) if (rankname == NULL || !strcmp(rankname,taxonomy->ranks->label[current_taxon->rank]))
{ {

View File

@ -29,14 +29,14 @@ ecotxidx_t *read_taxonomyidx(const char *filename,const char *filename2)
index->count=count+count2; index->count=count+count2;
fprintf(stderr,"Readind %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 + (int32_t)index->taxon[i].parent; index->taxon[i].parent=index->taxon + (int32_t)index->taxon[i].parent;
} }
if (count2>0) if (count2>0)
fprintf(stderr,"Readind %d local taxa...\n",count2); fprintf(stderr,"Reading %d local taxa...\n",count2);
else else
fprintf(stderr,"No local taxon\n"); fprintf(stderr,"No local taxon\n");