git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPrimers/branches/eric-test@186 60f365c0-8329-0410-b2a4-ec073aeeaa1d
47 lines
738 B
C
47 lines
738 B
C
/*
|
|
* taxstats.c
|
|
*
|
|
* Created on: 12 mars 2009
|
|
* Author: coissac
|
|
*/
|
|
|
|
#include <search.h>
|
|
|
|
static int cmptaxon(void *t1, void* t2);
|
|
|
|
|
|
static int cmptaxon(void *t1, void* t2)
|
|
{
|
|
if (*t1 < *t2)
|
|
return -1;
|
|
if (*t1 > *t2)
|
|
return +1;
|
|
return 0;
|
|
}
|
|
|
|
float taxonomycoverage(ppair_t pair, poptions_t options)
|
|
{
|
|
int32_t seqcount;
|
|
int32_t *taxon;
|
|
int32_t i;
|
|
void **taxontree;
|
|
ppair_t *inserted;
|
|
int32_t taxoncount;
|
|
|
|
|
|
seqcount=pair->pcr.ampcount;
|
|
taxon = ECOMALLOC(seqcount * sizeof(int32_t));
|
|
|
|
taxoncount=0;
|
|
taxontree=NULL;
|
|
|
|
for (i=0; i < seqcount; i++)
|
|
if (pair->pcr.amplifias[i].sequence->isexample)
|
|
{
|
|
inserted = tsearch(pair->pcr.amplifias[i].sequence->ranktaxonid,
|
|
taxontree,
|
|
cmptaxon);
|
|
}
|
|
|
|
}
|