added compare function for amplifias
git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPrimers/branches/eric-test@193 60f365c0-8329-0410-b2a4-ec073aeeaa1d
This commit is contained in:
@ -300,6 +300,6 @@ int32_t getrankdbstats(pecodnadb_t seqdb,
|
|||||||
ecotaxonomy_t *taxonomy,
|
ecotaxonomy_t *taxonomy,
|
||||||
poptions_t options);
|
poptions_t options);
|
||||||
float taxonomycoverage(ppair_t pair, poptions_t options);
|
float taxonomycoverage(ppair_t pair, poptions_t options);
|
||||||
|
char ecoComplementChar(char base);
|
||||||
|
|
||||||
#endif /* EPSORT_H_ */
|
#endif /* EPSORT_H_ */
|
||||||
|
@ -201,3 +201,13 @@ uint32_t ecoFindWord(pwordcount_t table,word_t word)
|
|||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char ecoComplementChar(char base)
|
||||||
|
{
|
||||||
|
switch(base){
|
||||||
|
case 'A': return T;
|
||||||
|
case 'C': return G;
|
||||||
|
case 'G': return C;
|
||||||
|
case 'T': return A;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -297,6 +297,7 @@ static void buildPrimerPairsForOneSeq(uint32_t seqid,
|
|||||||
current.asdirect2=bswp;
|
current.asdirect2=bswp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Look for the new pair in already seen pairs
|
// Look for the new pair in already seen pairs
|
||||||
|
|
||||||
pcurrent = insertpair(current,pairs);
|
pcurrent = insertpair(current,pairs);
|
||||||
|
@ -121,3 +121,45 @@ float taxonomycoverage(ppair_t pair, poptions_t options)
|
|||||||
pair->outtaxa=outcount;
|
pair->outtaxa=outcount;
|
||||||
return (float)incount/options->intaxa;
|
return (float)incount/options->intaxa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int cmpamp(const void *ampf1, const void* ampf2)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j = 0;
|
||||||
|
int incr = 1;
|
||||||
|
char cd1;
|
||||||
|
char cd2;
|
||||||
|
int chd = 0;
|
||||||
|
|
||||||
|
pamplifia_t pampf1 = (pamplifia_t) ampf1;
|
||||||
|
pamplifia_t pampf2 = (pamplifia_t) ampf2;
|
||||||
|
|
||||||
|
|
||||||
|
if (pampf1->strand != pampf2->strand)
|
||||||
|
{
|
||||||
|
incr = -1;
|
||||||
|
j = pampf1->length - 1;
|
||||||
|
if (pampf2->strand)
|
||||||
|
{
|
||||||
|
pampf1 = (pamplifia_t) ampf2;
|
||||||
|
pampf2 = (pamplifia_t) ampf1;
|
||||||
|
chd = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < pampf1->length; i++, j += incr;)
|
||||||
|
{
|
||||||
|
cd1 = pampf1->amplifia[i];
|
||||||
|
if (incr == -1)
|
||||||
|
cd2 = ecoComplementChar(pampf2->amplifia[j]);
|
||||||
|
else
|
||||||
|
cd2 = pampf2->amplifia[j];
|
||||||
|
|
||||||
|
if (cd1 < cd2) (chd)? return 1: return -1;
|
||||||
|
if (cd2 < cd1) (chd)? return -1: return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user