git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPCR/branches/refactoring@28 60f365c0-8329-0410-b2a4-ec073aeeaa1d
This commit is contained in:
@ -103,7 +103,7 @@ ecotx_t *readnext_ecotaxon(FILE *f,ecotx_t *taxon)
|
|||||||
"Allocate taxon scientific name");
|
"Allocate taxon scientific name");
|
||||||
|
|
||||||
strncpy(taxon->name,raw->name,raw->namelength);
|
strncpy(taxon->name,raw->name,raw->namelength);
|
||||||
|
|
||||||
return taxon;
|
return taxon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +176,51 @@ ecotx_t *eco_findtaxonatrank(ecotx_t *taxon,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ecotx_t *eco_findtaxonbytaxid(ecotaxonomy_t *taxonomy,
|
||||||
|
int32_t taxid)
|
||||||
|
{
|
||||||
|
ecotx_t *current_taxon;
|
||||||
|
int32_t taxoncount;
|
||||||
|
int32_t i;
|
||||||
|
|
||||||
|
taxoncount=taxonomy->taxons->count;
|
||||||
|
|
||||||
|
for (current_taxon=taxonomy->taxons->taxon,
|
||||||
|
i=0;
|
||||||
|
i < taxoncount;
|
||||||
|
i++,
|
||||||
|
current_taxon++)
|
||||||
|
if (current_taxon->taxid==taxid)
|
||||||
|
return current_taxon;
|
||||||
|
|
||||||
|
return (ecotx_t*)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out if taxon is son of other taxon's taxid
|
||||||
|
* @param *taxon son taxon
|
||||||
|
* @param parent_taxid taxonomic id of the other taxon
|
||||||
|
*
|
||||||
|
* @return 1 is the other taxid math a parent taxid, else 0
|
||||||
|
**/
|
||||||
|
int eco_isundertaxon(ecotx_t *taxon,
|
||||||
|
int other_taxid)
|
||||||
|
{
|
||||||
|
ecotx_t *next_parent;
|
||||||
|
|
||||||
|
next_parent = taxon->parent;
|
||||||
|
|
||||||
|
while ( (other_taxid != next_parent->taxid) && (next_parent!=0) )
|
||||||
|
{
|
||||||
|
next_parent = next_parent->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (other_taxid == next_parent->taxid)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ecotx_t *eco_getspecies(ecotx_t *taxon,
|
ecotx_t *eco_getspecies(ecotx_t *taxon,
|
||||||
ecotaxonomy_t *taxonomy)
|
ecotaxonomy_t *taxonomy)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user