add a -k option to the ecoPCR binary to substitute superkingdom column by a kingdom column
git-svn-id: https://www.grenoble.prabi.fr/svn/LECASofts/ecoPCR/trunk@11 60f365c0-8329-0410-b2a4-ec073aeeaa1d
This commit is contained in:
19
src/ecopcr.c
19
src/ecopcr.c
@ -135,6 +135,7 @@ static void ExitUsage(stat)
|
||||
void printRepeat(ecoseq_t *seq,
|
||||
PatternPtr o1, PatternPtr o2,
|
||||
char strand,
|
||||
char kingdom,
|
||||
int32_t pos1, int32_t pos2,
|
||||
int32_t err1, int32_t err2,
|
||||
ecotaxonomy_t *taxonomy)
|
||||
@ -204,7 +205,11 @@ void printRepeat(ecoseq_t *seq,
|
||||
family_name = "###";
|
||||
}
|
||||
|
||||
taxon = eco_getsuperkingdom((taxon) ? taxon:main_taxon,taxonomy);
|
||||
if (kingdom)
|
||||
taxon = eco_getkingdom((taxon) ? taxon:main_taxon,taxonomy);
|
||||
else
|
||||
taxon = eco_getsuperkingdom((taxon) ? taxon:main_taxon,taxonomy);
|
||||
|
||||
if (taxon)
|
||||
{
|
||||
superkingdom_taxid = taxon->taxid;
|
||||
@ -299,6 +304,7 @@ int main(int argc, char **argv)
|
||||
int32_t lmax=0;
|
||||
int32_t error_max=0;
|
||||
int32_t errflag=0;
|
||||
char kingdom_mode=0;
|
||||
|
||||
char *prefix;
|
||||
|
||||
@ -325,7 +331,7 @@ int main(int argc, char **argv)
|
||||
int32_t errj;
|
||||
|
||||
|
||||
while ((carg = getopt(argc, argv, "h1:2:l:L:e:")) != -1) {
|
||||
while ((carg = getopt(argc, argv, "h1:2:l:L:e:k")) != -1) {
|
||||
|
||||
switch (carg) {
|
||||
/* -------------------- */
|
||||
@ -368,6 +374,11 @@ int main(int argc, char **argv)
|
||||
case 'e': /* error max */
|
||||
/* -------------------- */
|
||||
sscanf(optarg,"%d",&error_max);
|
||||
break;
|
||||
|
||||
case 'k': /* error max */
|
||||
/* -------------------- */
|
||||
kingdom_mode = 1;
|
||||
break;
|
||||
|
||||
/* -------------------- */
|
||||
@ -462,7 +473,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if ((!lmin || (length >= lmin)) &&
|
||||
(!lmax || (length <= lmax)))
|
||||
printRepeat(seq,o1,o2c,'D',posi,posj,erri,errj,taxonomy);
|
||||
printRepeat(seq,o1,o2c,'D',kingdom_mode,posi,posj,erri,errj,taxonomy);
|
||||
//printf("%s\tD\t%s...%s (%d)\t%d\t%d\t%d\t%d\t%s\n",seq->AC,head,tail,seq->SQ_length,o1Hits,o2cHits,posi,posj,scname);
|
||||
}
|
||||
}
|
||||
@ -495,7 +506,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if ((!lmin || (length >= lmin)) &&
|
||||
(!lmax || (length <= lmax)))
|
||||
printRepeat(seq,o2,o1c,'R',posi,posj,erri,errj,taxonomy);
|
||||
printRepeat(seq,o2,o1c,'R',kingdom_mode,posi,posj,erri,errj,taxonomy);
|
||||
//printf("%s\tR\t%s...%s (%d)\t%d\t%d\t%d\t%d\t%s\n",seq->AC,head,tail,seq->SQ_length,o2Hits,o1cHits,posi,posj,scname);
|
||||
}
|
||||
}
|
||||
|
@ -224,6 +224,7 @@ char *getSubSequence(char* nucAcSeq,int32_t begin,int32_t end);
|
||||
ecotx_t *eco_getspecies(ecotx_t *taxon,ecotaxonomy_t *taxonomy);
|
||||
ecotx_t *eco_getgenus(ecotx_t *taxon,ecotaxonomy_t *taxonomy);
|
||||
ecotx_t *eco_getfamily(ecotx_t *taxon,ecotaxonomy_t *taxonomy);
|
||||
ecotx_t *eco_getkingdom(ecotx_t *taxon,ecotaxonomy_t *taxonomy);
|
||||
ecotx_t *eco_getsuperkingdom(ecotx_t *taxon,ecotaxonomy_t *taxonomy);
|
||||
|
||||
#endif /*ECOPCR_H_*/
|
||||
|
@ -215,6 +215,24 @@ ecotx_t *eco_getfamily(ecotx_t *taxon,
|
||||
return eco_findtaxonatrank(taxon,rankindex,tax);
|
||||
}
|
||||
|
||||
ecotx_t *eco_getkingdom(ecotx_t *taxon,
|
||||
ecotaxonomy_t *taxonomy)
|
||||
{
|
||||
static ecotaxonomy_t *tax=NULL;
|
||||
static int32_t rankindex=-1;
|
||||
|
||||
if (taxonomy && tax!=taxonomy)
|
||||
{
|
||||
rankindex = rank_index("kingdom",taxonomy->ranks);
|
||||
tax=taxonomy;
|
||||
}
|
||||
|
||||
if (!tax || rankindex < 0)
|
||||
ECOERROR(ECO_ASSERT_ERROR,"No taxonomy defined");
|
||||
|
||||
return eco_findtaxonatrank(taxon,rankindex,tax);
|
||||
}
|
||||
|
||||
ecotx_t *eco_getsuperkingdom(ecotx_t *taxon,
|
||||
ecotaxonomy_t *taxonomy)
|
||||
{
|
||||
|
Reference in New Issue
Block a user