This commit is contained in:
2007-06-08 12:53:41 +00:00
parent 6b28897ff5
commit 255ab0c670

View File

@ -8,8 +8,8 @@
#define VERSION "0.1" #define VERSION "0.1"
/* ----------------------------------------------- */ /* ----------------------------------------------- */
/* printout help */ /* ----------------------------------------------- */ /* printout help */
/* ----------------------------------------------- */
#define PP fprintf(stdout, #define PP fprintf(stdout,
static void PrintHelp() static void PrintHelp()
@ -87,7 +87,7 @@ static void PrintHelp()
static void ExitUsage(stat) static void ExitUsage(stat)
int stat; int stat;
{ {
PP "usage: ecoPCR [-1 oligo1] [-2 oligo2] [-l value] [-L value] [-e value] [-r taxid] [-i taxid] [-k] datafile\n"); PP "usage: ecoPCR [-d database] [-l value] [-L value] [-e value] [-r taxid] [-i taxid] [-k] oligo1 oligo2\n");
PP "type \"ecoPCR -h\" for help\n"); PP "type \"ecoPCR -h\" for help\n");
if (stat) if (stat)
@ -270,7 +270,7 @@ int main(int argc, char **argv)
int32_t errflag=0; int32_t errflag=0;
char kingdom_mode=0; char kingdom_mode=0;
char *prefix; char *prefix = NULL;
int32_t checkedSequence = 0; int32_t checkedSequence = 0;
int32_t positiveSequence= 0; int32_t positiveSequence= 0;
@ -300,23 +300,15 @@ int main(int argc, char **argv)
int32_t g=0; int32_t g=0;
while ((carg = getopt(argc, argv, "h1:2:l:L:e:i:r:k")) != -1) { while ((carg = getopt(argc, argv, "hd:l:L:e:i:r:k")) != -1) {
switch (carg) { switch (carg) {
/* -------------------- */ /* -------------------- */
case '1': /* first primer */ case 'd': /* database name */
/* -------------------- */ /* -------------------- */
oligo1 = ECOMALLOC(strlen(optarg)+1, prefix = ECOMALLOC(strlen(optarg)+1,
"Error on oligo 1 allocation"); "Error on prefix allocation");
strcpy(oligo1,optarg); strcpy(prefix,optarg);
break;
/* -------------------- */
case '2': /* second primer */
/* -------------------- */
oligo2 = ECOMALLOC(strlen(optarg)+1,
"Error on oligo 1 allocation");
strcpy(oligo2,optarg);
break; break;
/* -------------------- */ /* -------------------- */
@ -378,7 +370,18 @@ int main(int argc, char **argv)
/** /**
* check the path to the database is given as last argument * check the path to the database is given as last argument
*/ */
if ((argc -= optind) != 1) if ((argc -= optind) == 2)
{
oligo1 = ECOMALLOC(strlen(argv[optind])+1,
"Error on oligo1 allocation");
strcpy(oligo1,argv[optind]);
optind++;
oligo2 = ECOMALLOC(strlen(argv[optind])+1,
"Error on oligo1 allocation");
strcpy(oligo2,argv[optind]);
}
else
errflag++; errflag++;
if (!oligo1 || !oligo2) if (!oligo1 || !oligo2)
@ -387,8 +390,6 @@ int main(int argc, char **argv)
if (errflag) if (errflag)
ExitUsage(errflag); ExitUsage(errflag);
prefix = argv[optind];
o1 = buildPattern(oligo1,error_max); o1 = buildPattern(oligo1,error_max);
o2 = buildPattern(oligo2,error_max); o2 = buildPattern(oligo2,error_max);
@ -426,7 +427,7 @@ int main(int argc, char **argv)
{ {
checkedSequence++; checkedSequence++;
/** /**
* check if current sequence should be ignored * check if current sequence should be included
**/ **/
if ( (r == 0) || if ( (r == 0) ||
(eco_is_taxid_included(taxonomy, (eco_is_taxid_included(taxonomy,