static GtOptionParser* gt_shredder_option_parser_new(void *tool_arguments) { GtShredderArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *o; gt_assert(arguments); op = gt_option_parser_new("[option ...] [sequence_file ...]", "GtShredder sequence_file into consecutive pieces of " "random length."); o = gt_option_new_ulong_min("coverage", "set the number of times the " "sequence_file is shreddered", &arguments->coverage, 1, 1); gt_option_parser_add_option(op, o); o = gt_option_new_ulong("minlength", "set the minimum length of the shreddered " "fragments", &arguments->minlength, 300); gt_option_parser_add_option(op, o); o = gt_option_new_ulong("maxlength", "set the maximum length of the shreddered " "fragments", &arguments->maxlength, 700); gt_option_parser_add_option(op, o); o = gt_option_new_ulong("overlap", "set the overlap between consecutive " "pieces", &arguments->overlap, 0); gt_option_parser_add_option(op, o); o = gt_option_new_probability("sample", "take samples of the generated " "sequences pieces with the given probability", &arguments->sample_probability, 1.0); gt_option_parser_add_option(op, o); gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL); return op; }
static GtOptionParser* gt_splitfasta_option_parser_new(void *tool_arguments) { SplitfastaArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *targetsize_option, *splitdesc_option, *o, *numfiles_option; gt_assert(arguments); op = gt_option_parser_new("[option ...] fastafile","Split the supplied fasta " "file."); numfiles_option = gt_option_new_uint_min("numfiles", "set the number of target files " "", &arguments->num_files, 0, 1); gt_option_parser_add_option(op, numfiles_option); targetsize_option = gt_option_new_ulong_min("targetsize", "set the target file " "size in MB", &arguments->max_filesize_in_MB, 50, 1); gt_option_parser_add_option(op, targetsize_option); splitdesc_option = gt_option_new_string("splitdesc", "put every fasta entry in " "a separate file named by its " "description in the given directory", arguments->splitdesc, NULL); gt_option_parser_add_option(op, splitdesc_option); gt_option_exclude(targetsize_option, splitdesc_option); gt_option_exclude(numfiles_option, splitdesc_option); gt_option_exclude(numfiles_option, targetsize_option); o = gt_option_new_width(&arguments->width); gt_option_parser_add_option(op, o); o = gt_option_new_bool(GT_FORCE_OPT_CSTR, "force writing to output file", &arguments->force, false); gt_option_parser_add_option(op, o); gt_option_parser_set_min_max_args(op, 1, 1); return op; }
static GtOptionParser* gt_extractseq_option_parser_new(void *tool_arguments) { ExtractSeqArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *frompos_option, *topos_option, *match_option, *width_option, *fastakeyfile_option; gt_assert(arguments); /* init */ op = gt_option_parser_new("[option ...] [sequence_file(s)] | fastaindex", "Extract sequences from given sequence file(s) or " "fastaindex."); /* -frompos */ frompos_option = gt_option_new_ulong_min(FROMPOS_OPTION_STR, "extract sequence from this position\n" "counting from 1 on", &arguments->frompos, 0, 1UL); gt_option_parser_add_option(op, frompos_option); /* -topos */ topos_option = gt_option_new_ulong_min(TOPOS_OPTION_STR, "extract sequence up to this position\n" "counting from 1 on", &arguments->topos, 0, 1UL); gt_option_parser_add_option(op, topos_option); /* -match */ match_option = gt_option_new_string("match", "extract all sequences whose " "description matches the given pattern.\n" "The given pattern must be a valid extended " "regular expression.", arguments->pattern, NULL); gt_option_parser_add_option(op, match_option); /* -keys */ fastakeyfile_option = gt_option_new_filename("keys", "extract substrings for keys " "in specified file", arguments->fastakeyfile); gt_option_parser_add_option(op, fastakeyfile_option); /* -width */ width_option = gt_option_new_width(&arguments->width); gt_option_parser_add_option(op, width_option); /* output file options */ gt_outputfile_register_options(op, &arguments->outfp, arguments->ofi); /* option implications */ gt_option_imply(frompos_option, topos_option); gt_option_imply(topos_option, frompos_option); /* option exclusions */ gt_option_exclude(frompos_option, match_option); gt_option_exclude(topos_option, match_option); gt_option_exclude(frompos_option, fastakeyfile_option); gt_option_exclude(match_option, fastakeyfile_option); gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL); return op; }
static GtOptionParser *gt_repfind_option_parser_new(void *tool_arguments) { GtOptionParser *op; GtOption *option, *reverseoption, *queryoption, *extendseedoption, *scanoption, *sampleoption, *forwardoption, *spmoption; Maxpairsoptions *arguments = tool_arguments; op = gt_option_parser_new("[options] -ii indexname", "Compute maximal repeats."); gt_option_parser_set_mail_address(op,"<*****@*****.**>"); option = gt_option_new_uint_min("l","Specify minimum length of repeats", &arguments->userdefinedleastlength, 20U, 1U); gt_option_parser_add_option(op, option); forwardoption = gt_option_new_bool("f","Compute maximal forward repeats", &arguments->forward, true); gt_option_parser_add_option(op, forwardoption); arguments->refforwardoption = gt_option_ref(forwardoption); reverseoption = gt_option_new_bool("r","Compute maximal reverse matches", &arguments->reverse, false); gt_option_parser_add_option(op, reverseoption); sampleoption = gt_option_new_ulong_min("samples","Specify number of samples", &arguments->samples, 0, 1UL); gt_option_is_development_option(sampleoption); gt_option_parser_add_option(op, sampleoption); spmoption = gt_option_new_bool("spm","Search for suffix prefix matches", &arguments->searchspm, false); gt_option_is_development_option(spmoption); gt_option_parser_add_option(op, spmoption); extendseedoption = gt_option_new_bool("extend","Extend seed to both sides", &arguments->extendseed, false); gt_option_is_development_option(extendseedoption); gt_option_parser_add_option(op, extendseedoption); scanoption = gt_option_new_bool("scan","scan index rather than mapping " "it to main memory", &arguments->scanfile, false); gt_option_parser_add_option(op, scanoption); option = gt_option_new_string("ii", "Specify input index", arguments->indexname, NULL); gt_option_parser_add_option(op, option); gt_option_is_mandatory(option); queryoption = gt_option_new_filename_array("q", "Specify query files", arguments->queryfiles); gt_option_is_development_option(queryoption); gt_option_parser_add_option(op, queryoption); option = gt_option_new_bool("v", "be verbose ", &arguments->beverbose, false); gt_option_parser_add_option(op, option); gt_option_exclude(queryoption,sampleoption); gt_option_exclude(queryoption,scanoption); gt_option_exclude(queryoption,reverseoption); gt_option_exclude(queryoption,spmoption); gt_option_exclude(reverseoption,spmoption); gt_option_exclude(queryoption,spmoption); gt_option_exclude(sampleoption,spmoption); return op; }
static GtOptionParser* gt_sketch_page_option_parser_new(void *tool_arguments) { SketchPageArguments *arguments = tool_arguments; GtOptionParser *op; static const char *formats[] = { #ifdef CAIRO_HAS_PDF_SURFACE "pdf", #endif #ifdef CAIRO_HAS_PS_SURFACE "ps", #endif NULL }; GtOption *o; op = gt_option_parser_new("outfile annotationfile", "Draw a multi-page PDF/PS representation of " "an annotation file."); o = gt_option_new_string("seqid", "sequence region to draw\n" "default: first in file", arguments->seqid, NULL); gt_option_parser_add_option(op, o); gt_option_hide_default(o); o = gt_option_new_string("text", "text to show in header\n" "default: file name", arguments->text, NULL); gt_option_parser_add_option(op, o); gt_option_hide_default(o); o = gt_option_new_double("fontsize", "header and footer font size " "(in points)", &arguments->theight, 10.0); gt_option_parser_add_option(op, o); o = gt_option_new_range("range", "range to draw (e.g. 100 10000)\n" "default: full range", &arguments->range, NULL); gt_option_parser_add_option(op, o); gt_option_hide_default(o); o = gt_option_new_ulong_min("linewidth", "base width of a single " "repeated unit", &arguments->width, 2000, 1000); gt_option_is_mandatory(o); gt_option_parser_add_option(op, o); o = gt_option_new_double("width", "page width in millimeters " "(default: DIN A4)", &arguments->pwidth, 210.0); gt_option_parser_add_option(op, o); o = gt_option_new_double("height", "page height in millimeters " "(default: DIN A4)", &arguments->pheight, 297.0); gt_option_parser_add_option(op, o); o = gt_option_new_choice("format", "output format\n" "choose from: " #ifdef CAIRO_HAS_PDF_SURFACE "pdf" #ifdef CAIRO_HAS_PS_SURFACE "|" #endif #endif #ifdef CAIRO_HAS_PS_SURFACE "ps" #endif "", arguments->format, formats[0], formats ); gt_option_parser_add_option(op, o); o = gt_option_new_string("style", "style file to use\n" "default: gtdata/sketch/default.style", arguments->stylefile, gt_str_get(arguments->stylefile)); gt_option_parser_add_option(op, o); gt_option_hide_default(o); o = gt_option_new_filename("seqfile", "sequence file for GC content view", arguments->seqfile); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); gt_option_parser_set_min_max_args(op, 2, 2); return op; }
static GtOptionParser* gt_tir_option_parser_new(void *tool_arguments) { GtTirArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *optionindex, /* index */ *optionseed, /* minseedlength */ *optionminlentir, /* minimal length of TIR */ *optionmaxlentir, /* maximal length of TIR */ *optionmindisttir, /* minimal distance of TIRs */ *optionmaxdisttir, /* maximal distance of TIRs */ *optionmat, /* arbitrary scores */ *optionmis, *optionins, *optiondel, *optionxdrop, /* xdropbelowscore for extension alignment */ *optionsimilar, /* similarity threshold */ *optionoverlaps, /* for overlaps */ *optionmintsd, /* minimal length for Target Site Duplication */ *optionmaxtsd, /* maximal length for Target Site Duplication */ *optionvicinity; /* vicinity around TIRs to be searched for TSDs */ static const char *overlaps[] = { "best", /* default */ "no", "all", NULL }; gt_assert(arguments); /* init */ op = gt_option_parser_new("[option ...] -index INDEXNAME", "Identify Terminal Inverted Repeat (TIR) elements," "such as DNA transposons."); /* -index */ optionindex = gt_option_new_string("index", "specify the name of the enhanced suffix " "array index (mandatory)", arguments->str_indexname, NULL); gt_option_is_mandatory(optionindex); gt_option_parser_add_option(op, optionindex); /* -seed */ optionseed = gt_option_new_ulong_min("seed", "specify minimum seed length for " "exact repeats", &arguments->min_seed_length, 20UL, 2UL); gt_option_parser_add_option(op, optionseed); /* -minlentir */ optionminlentir = gt_option_new_ulong_min_max("mintirlen", "specify minimum length for " "each TIR", &arguments->min_TIR_length, 27UL, 1UL, GT_UNDEF_ULONG); gt_option_parser_add_option(op, optionminlentir); /* -maxlentir */ optionmaxlentir = gt_option_new_ulong_min_max("maxtirlen", "specify maximum length for " "each TIR", &arguments->max_TIR_length, 1000UL, 1UL, GT_UNDEF_ULONG); gt_option_parser_add_option(op, optionmaxlentir); /* -mindisttir */ optionmindisttir = gt_option_new_ulong_min_max("mintirdist", "specify minimum distance of " "TIRs", &arguments->min_TIR_distance, 100UL, 1UL, GT_UNDEF_ULONG); gt_option_parser_add_option(op, optionmindisttir); /* -maxdisttir */ optionmaxdisttir = gt_option_new_ulong_min_max("maxtirdist", "specify maximum distance of " "TIRs", &arguments->max_TIR_distance, 10000UL, 1UL, GT_UNDEF_ULONG); gt_option_parser_add_option(op, optionmaxdisttir); optionmat = gt_option_new_int_min("mat", "specify matchscore for " "extension-alignment", &arguments->arbit_scores.mat, 2, 1); gt_option_parser_add_option(op, optionmat); /* -mis */ optionmis = gt_option_new_int_max("mis", "specify mismatchscore for " "extension-alignment", &arguments->arbit_scores.mis, -2, -1); gt_option_parser_add_option(op, optionmis); /* -ins */ optionins = gt_option_new_int_max("ins", "specify insertionscore for " "extension-alignment", &arguments->arbit_scores.ins, -3, -1); gt_option_parser_add_option(op, optionins); /* -del */ optiondel = gt_option_new_int_max("del", "specify deletionscore for " "extension-alignment", &arguments->arbit_scores.del, -3, -1); gt_option_parser_add_option(op, optiondel); /* -xdrop */ optionxdrop = gt_option_new_int_min("xdrop", "specify xdropbelowscore for " "extension-alignment", &arguments->xdrop_belowscore, (int) 5, (int) 0); gt_option_parser_add_option(op, optionxdrop); /* -similar */ optionsimilar = gt_option_new_double_min_max("similar", "specify similaritythreshold in " "range [1..100%]", &arguments->similarity_threshold, (double) 85.0, (double) 0.0, 100.0); gt_option_parser_add_option(op, optionsimilar); /* -overlaps */ optionoverlaps = gt_option_new_choice("overlaps", "specify no|best|all", arguments->str_overlaps, overlaps[0], overlaps); gt_option_parser_add_option(op, optionoverlaps); arguments->optionoverlaps = gt_option_ref(optionoverlaps); /* -mintsd */ optionmintsd = gt_option_new_ulong_min_max("mintsd", "specify minimum length for each " "TSD", &arguments->min_TSD_length, 2U, 0, GT_UNDEF_UINT); gt_option_parser_add_option(op, optionmintsd); /* -maxtsd */ optionmaxtsd = gt_option_new_ulong_min_max("maxtsd", "specify maximum length for each " "TSD", &arguments->max_TSD_length, 11U, 0, GT_UNDEF_UINT); gt_option_parser_add_option(op, optionmaxtsd); gt_option_imply(optionmaxtsd, optionmintsd); /* -vicinity */ optionvicinity = gt_option_new_ulong_min_max("vic", "specify the number of " "nucleotides (to the left and " "to the right) that will be " "searched for TSDs around 5' " "and 3' boundary of predicted " "TIRs", &arguments->vicinity, 60U, 1U, 500U); gt_option_parser_add_option(op, optionvicinity); return op; }
static GtOptionParser *gt_idxlocali_option_parser_new (void *tool_arguments) { IdxlocaliOptions *arguments = tool_arguments; GtOptionParser *op; GtOption *option, *optionesaindex, *optionpckindex, *optiononline, *optioncmp; gt_assert (arguments != NULL); arguments->indexname = gt_str_new (); arguments->queryfiles = gt_str_array_new (); op = gt_option_parser_new ("[options] -q query-file-names [-esa|-pck] indexname", "Find all local alignments using suffix tree."); gt_option_parser_set_mailaddress (op, "<*****@*****.**>"); option = gt_option_new_filenamearray ("q","Specify files containing the " "query sequences", arguments->queryfiles); gt_option_parser_add_option (op, option); option = gt_option_new_long ("match", "Specify match score", &arguments->matchscore, 1L); gt_option_parser_add_option (op, option); option = gt_option_new_long ("mismatch", "Specify mismatch score", &arguments->mismatchscore, -3L); gt_option_parser_add_option (op, option); option = gt_option_new_long ("gapstart", "Specify gap start score", &arguments->gapstart, -5L); gt_option_parser_add_option (op, option); option = gt_option_new_long ("gapextend", "Specify gap extension score", &arguments->gapextend, -2L); gt_option_parser_add_option (op, option); option = gt_option_new_ulong_min ("th", "Specify the threshold", &arguments->threshold, 0, 1UL); gt_option_parser_add_option (op, option); gt_option_is_mandatory (option); optionesaindex = gt_option_new_string ("esa", "Specify index " "(enhanced suffix array)", arguments->indexname, NULL); gt_option_parser_add_option (op, optionesaindex); arguments->refoptionesaindex = gt_option_ref (optionesaindex); optionpckindex = gt_option_new_string ("pck", "Specify index (packed index)", arguments->indexname, NULL); gt_option_parser_add_option (op, optionpckindex); arguments->refoptionpckindex = gt_option_ref (optionpckindex); gt_option_exclude (optionesaindex, optionpckindex); gt_option_is_mandatory_either (optionesaindex, optionpckindex); optiononline = gt_option_new_bool("online","Perform online searches", &arguments->doonline, false); gt_option_parser_add_option(op, optiononline); gt_option_is_development_option(optiononline); optioncmp = gt_option_new_bool("cmp","Compare results of offline and online " "searches", &arguments->docompare, false); gt_option_parser_add_option(op,optioncmp); gt_option_exclude(optiononline,optioncmp); option = gt_option_new_bool("s", "Show alignments", &arguments->showalignment, false); gt_option_parser_add_option (op, option); option = gt_option_new_verbose(&arguments->verbose); gt_option_parser_add_option(op, option); return op; }
static GtOptionParser* gt_matstat_option_parser_new(void *tool_arguments) { Gfmsubcallinfo *arguments = tool_arguments; GtOptionParser *op; gt_assert(arguments); op = gt_option_parser_new("[options ...] -query queryfile [...]", arguments->doms ? "Compute matching statistics." : "Compute length of minimum unique prefixes."); gt_option_parser_set_mail_address(op,"<*****@*****.**>"); arguments->optionfmindex = gt_option_new_string("fmi", "specify fmindex", arguments->indexname,NULL); gt_option_parser_add_option(op, arguments->optionfmindex); arguments->optionesaindex = gt_option_new_string("esa", "specify suffix array", arguments->indexname,NULL); gt_option_parser_add_option(op, arguments->optionesaindex); arguments->optionpckindex = gt_option_new_string("pck", "specify packed index", arguments->indexname,NULL); gt_option_parser_add_option(op, arguments->optionpckindex); gt_option_exclude(arguments->optionfmindex,arguments->optionesaindex); gt_option_exclude(arguments->optionpckindex,arguments->optionesaindex); gt_option_exclude(arguments->optionpckindex,arguments->optionfmindex); arguments->optionquery = gt_option_new_filename_array("query", "specify queryfiles", arguments->queryfilenames); gt_option_is_mandatory(arguments->optionquery); gt_option_parser_add_option(op, arguments->optionquery); arguments->optionmin = gt_option_new_ulong_min("min", "only output length " "if >= given minimum length", &arguments->minlength. valueunsignedlong, 0,(unsigned long) 1); gt_option_parser_add_option(op, arguments->optionmin); arguments->optionmax = gt_option_new_ulong_min("max", "only output length " "if <= given maximum length", &arguments->maxlength. valueunsignedlong, 0,(unsigned long) 1); gt_option_parser_add_option(op, arguments->optionmax); arguments->optionoutput = gt_option_new_string_array("output", arguments->doms ? "set output flags (sequence, querypos, subjectpos)" : "set output flags (sequence, querypos)", arguments->flagsoutputoption); gt_option_parser_add_option(op, arguments->optionoutput); if (arguments->doms) { arguments->optionverify = gt_option_new_bool("verify", "verify witness positions", &arguments->verifywitnesspos, false); gt_option_is_development_option(arguments->optionverify); gt_option_parser_add_option(op, arguments->optionverify); } else { arguments->verifywitnesspos = false; } gt_option_parser_refer_to_manual(op); return op; }
static OPrval parse_options(int *parsed_args, LTRharvestoptions *lo, int argc, const char **argv, GtError *err) { GtOptionParser *op; GtOption *optionindex, *optionltrsearchseqrange, *optionseed, *optionminlenltr, *optionmaxlenltr, *optionmindistltr, *optionmaxdistltr, *optionmintsd, *optionmaxtsd, *optionsimilar, *optionmotif, *optionmotifmis, *optionvic, *optionoverlaps, *optionxdrop, *optionmat, *optionmis, *optionins, *optiondel, *optionv, *optionoffset, *optionlongoutput, *optionout, *optionoutinner, *optiongff3; OPrval oprval; GtRange default_ltrsearchseqrange = {0,0}; unsigned int vicinityforcorrectboundaries; static const char *overlaps[] = { "best", /* the default */ "no", "all", NULL }; gt_error_check(err); op = gt_option_parser_new("[option ...] -index filenameindex", "Predict LTR retrotransposons."); /* -index */ lo->str_indexname = gt_str_new(); optionindex = gt_option_new_string("index", "specify the name of the enhanced suffix " "array index (mandatory)", lo->str_indexname, NULL); gt_option_is_mandatory(optionindex); gt_option_parser_add_option(op, optionindex); /* -range */ optionltrsearchseqrange = gt_option_new_range("range", "specify sequence range in which LTRs are searched", &lo->repeatinfo.ltrsearchseqrange, &default_ltrsearchseqrange); gt_option_parser_add_option(op, optionltrsearchseqrange); /* -seed */ optionseed = gt_option_new_ulong_min("seed", "specify minimum seed length for" " exact repeats", &lo->minseedlength, 30UL, 1UL); gt_option_parser_add_option(op, optionseed); /* -minlenltr */ optionminlenltr = gt_option_new_ulong_min_max("minlenltr", "specify minimum length for each LTR", &lo->repeatinfo.lmin, 100UL, 1UL, GT_UNDEF_ULONG); gt_option_parser_add_option(op, optionminlenltr); /* -maxlenltr */ optionmaxlenltr = gt_option_new_ulong_min_max("maxlenltr", "specify maximum length for each LTR", &lo->repeatinfo.lmax, 1000UL, 1UL, GT_UNDEF_ULONG); gt_option_parser_add_option(op, optionmaxlenltr); /* -mindistltr */ optionmindistltr = gt_option_new_ulong_min_max("mindistltr", "specify minimum distance of " "LTR startpositions", &lo->repeatinfo.dmin, 1000UL, 1UL, GT_UNDEF_ULONG); gt_option_parser_add_option(op, optionmindistltr); /* -maxdistltr */ optionmaxdistltr = gt_option_new_ulong_min_max("maxdistltr", "specify maximum distance of " "LTR startpositions", &lo->repeatinfo.dmax, 15000UL, 1UL, GT_UNDEF_ULONG); gt_option_parser_add_option(op, optionmaxdistltr); /* -similar */ optionsimilar = gt_option_new_double_min_max("similar", "specify similaritythreshold in " "range [1..100%]", &lo->similaritythreshold, (double) 85.0, (double) 0.0, 100.0); gt_option_parser_add_option(op, optionsimilar); /* -mintsd */ optionmintsd = gt_option_new_uint_min_max("mintsd", "specify minimum length for each TSD", &lo->minlengthTSD, 4U, 0, GT_UNDEF_UINT); gt_option_parser_add_option(op, optionmintsd); /* -maxtsd */ optionmaxtsd = gt_option_new_uint_min_max("maxtsd", "specify maximum length for each TSD", &lo->maxlengthTSD, 20U, 0, GT_UNDEF_UINT); gt_option_parser_add_option(op, optionmaxtsd); /* -motif */ /* characters will be tranformed later into characters from virtualtree alphabet */ lo->motif.firstleft = (GtUchar) 't'; lo->motif.secondleft = (GtUchar) 'g'; lo->motif.firstright = (GtUchar) 'c'; lo->motif.secondright = (GtUchar) 'a'; lo->motif.str_motif = gt_str_new(); optionmotif = gt_option_new_string("motif", "specify 2 nucleotides startmotif + " "2 nucleotides endmotif: ****", lo->motif.str_motif, NULL); gt_option_parser_add_option(op, optionmotif); /* -motifmis */ optionmotifmis = gt_option_new_uint_min_max("motifmis", "specify maximum number of " "mismatches in motif [0,3]", &lo->motif.allowedmismatches, 4U, 0, 3U); gt_option_parser_add_option(op, optionmotifmis); /* -vic */ optionvic = gt_option_new_uint_min_max("vic", "specify the number of nucleotides (to the left and " "to the right) that will be searched " "for TSDs and/or motifs around 5' and 3' boundary " "of predicted LTR retrotransposons", &vicinityforcorrectboundaries, 60U, 1U, 500U); gt_option_parser_add_option(op, optionvic); /* -overlaps */ lo->str_overlaps = gt_str_new(); optionoverlaps = gt_option_new_choice("overlaps", "specify no|best|all", lo->str_overlaps, overlaps[0], overlaps); gt_option_parser_add_option(op, optionoverlaps); /* -xdrop */ optionxdrop = gt_option_new_int_min("xdrop", "specify xdropbelowscore for extension-alignment", &lo->xdropbelowscore, (int)5, (int)0); gt_option_parser_add_option(op, optionxdrop); /* -mat */ lo->arbitscores.gcd = 1; /* set only for initialization, do not change! */ optionmat = gt_option_new_int_min("mat", "specify matchscore for extension-alignment", &lo->arbitscores.mat, 2, 1); gt_option_parser_add_option(op, optionmat); /* -mis */ optionmis = gt_option_new_int_max("mis", "specify mismatchscore for extension-alignment", &lo->arbitscores.mis, -2, -1); gt_option_parser_add_option(op, optionmis); /* -ins */ optionins = gt_option_new_int_max("ins", "specify insertionscore for extension-alignment", &lo->arbitscores.ins, -3, -1); gt_option_parser_add_option(op, optionins); /* -del */ optiondel = gt_option_new_int_max("del", "specify deletionscore for extension-alignment", &lo->arbitscores.del, -3, -1); gt_option_parser_add_option(op, optiondel); /* -v */ optionv = gt_option_new_bool("v", "verbose mode", &lo->verbosemode, false); gt_option_parser_add_option(op, optionv); /* -longoutput */ optionlongoutput = gt_option_new_bool("longoutput", "additional motif/TSD output", &lo->longoutput, false); gt_option_parser_add_option(op, optionlongoutput); /* -out */ lo->fastaoutput = false; /* by default no FASTA output */ lo->str_fastaoutputfilename = gt_str_new(); optionout = gt_option_new_string("out", "specify FASTA outputfilename", lo->str_fastaoutputfilename, NULL); gt_option_parser_add_option(op, optionout); /* -outinner */ lo->fastaoutputinnerregion = false; lo->str_fastaoutputfilenameinnerregion = gt_str_new(); optionoutinner = gt_option_new_string("outinner", "specify FASTA outputfilename for inner regions", lo->str_fastaoutputfilenameinnerregion, NULL); gt_option_parser_add_option(op, optionoutinner); /* -gff3 */ lo->gff3output = false; /* by default no gff3 output */ lo->str_gff3filename = gt_str_new(); optiongff3 = gt_option_new_string("gff3", "specify GFF3 outputfilename", lo->str_gff3filename, NULL); gt_option_parser_add_option(op, optiongff3); /* -offset */ optionoffset = gt_option_new_ulong("offset", "offset added to GFF3 coordinates", &lo->offset, 0UL); gt_option_parser_add_option(op, optionoffset); gt_option_is_extended_option(optionoffset); /* implications */ gt_option_imply(optionmaxtsd, optionmintsd); gt_option_imply(optionmotifmis, optionmotif); gt_option_imply_either_2(optionlongoutput, optionmintsd, optionmotif); gt_option_parser_refer_to_manual(op); oprval = gt_option_parser_parse(op, parsed_args, argc, argv, gt_versionfunc, err); lo->vicinityforcorrectboundaries = (Seqpos) vicinityforcorrectboundaries; if (oprval == OPTIONPARSER_OK) { if (lo->repeatinfo.lmin > lo->repeatinfo.lmax) { gt_error_set(err,"argument of -minlenltr is greater than argument of" " -maxlenltr"); oprval = OPTIONPARSER_ERROR; } if (lo->repeatinfo.dmin > lo->repeatinfo.dmax) { gt_error_set(err, "argument of -mindistltr is greater than argument of -maxdistltr"); oprval = OPTIONPARSER_ERROR; } if (lo->repeatinfo.lmax > lo->repeatinfo.dmin) { gt_error_set(err,"argument of -maxlenltr is greater than argument of" " -mindistltr"); oprval = OPTIONPARSER_ERROR; } if (lo->minlengthTSD > lo->maxlengthTSD) { gt_error_set(err, "argument of -mintsd is greater than argument of -maxtsd"); oprval = OPTIONPARSER_ERROR; } /* If option motif is set, store characters, transform them later */ if (gt_option_is_set(optionmotif)) { if (gt_str_length(lo->motif.str_motif) != 4UL) { gt_error_set(err, "argument of -motif has not exactly 4 characters"); oprval = OPTIONPARSER_ERROR; } lo->motif.firstleft = (GtUchar) gt_str_get(lo->motif.str_motif)[0]; lo->motif.secondleft = (GtUchar) gt_str_get(lo->motif.str_motif)[1]; lo->motif.firstright = (GtUchar) gt_str_get(lo->motif.str_motif)[2]; lo->motif.secondright = (GtUchar) gt_str_get(lo->motif.str_motif)[3]; /* default if motif specified */ if (!gt_option_is_set(optionmotifmis)) { lo->motif.allowedmismatches = 0; } } /* If option overlaps is set */ if (gt_option_is_set(optionoverlaps)) { if (strcmp(gt_str_get(lo->str_overlaps), "no") == 0) { lo->bestofoverlap = false; lo->nooverlapallowed = true; } else if (strcmp(gt_str_get(lo->str_overlaps), "best") == 0 ) { lo->bestofoverlap = true; lo->nooverlapallowed = false; } else if (strcmp(gt_str_get(lo->str_overlaps), "all") == 0 ) { lo->bestofoverlap = false; lo->nooverlapallowed = false; } else { gt_assert(0); /* cannot happen */ } } else { /* default is "best" */ lo->bestofoverlap = true; /* take best prediction if overlap occurs, default */ lo->nooverlapallowed = false; /* overlapping predictions (not)allowed*/ } /* if FASTA output is set */ if (gt_option_is_set(optionout)) { lo->fastaoutput = true; } /* if FASTA output inner region is set */ if (gt_option_is_set(optionoutinner)) { lo->fastaoutputinnerregion = true; } /* if GFF3 output is set */ if (gt_option_is_set(optiongff3)) { lo->gff3output = true; } if (gt_option_is_set(optionltrsearchseqrange)) { if (lo->repeatinfo.ltrsearchseqrange.start > lo->repeatinfo.ltrsearchseqrange.end) { gt_error_set(err, "arguments of -range: first arg must be <= than second arg"); oprval = OPTIONPARSER_ERROR; } } } gt_option_parser_delete(op); return oprval; }
static GtOptionParser *gt_tyr_occratio_option_parser_new(void *tool_arguments) { GtOptionParser *op; GtOption *optionmersizes, *optionesa, *optionminmersize, *optionmaxmersize, *optionstep, *optionoutput, *option; Tyr_occratio_options *arguments = tool_arguments; op = gt_option_parser_new("[options] -esa suffixerator-index [options]", "Compute occurrence ratio for a set of sequences " "represented by an enhanced suffix array."); gt_option_parser_set_mailaddress(op,"<*****@*****.**>"); optionesa = gt_option_new_string("esa","specify suffixerator-index\n" "(mandatory option)", arguments->str_inputindex, NULL); gt_option_is_mandatory(optionesa); gt_option_parser_add_option(op, optionesa); optionminmersize = gt_option_new_ulong_min("minmersize", "specify minimum mer size for which " "to compute the occurrence distribution", &arguments->minmersize,0,1UL); gt_option_parser_add_option(op, optionminmersize); optionmaxmersize = gt_option_new_ulong_min("maxmersize", "specify maximum mer size for which " "to compute the occurrence distribution", &arguments->maxmersize,0,1UL); gt_option_parser_add_option(op, optionmaxmersize); optionstep = gt_option_new_ulong_min("step", "specify step size when specifying mer sizes", &arguments->stepmersize,1UL,1UL); gt_option_parser_add_option(op, optionstep); optionmersizes = gt_option_new_stringarray( "mersizes", "specify mer sizes as non-empty sequence of " "non decreasing positive integers", arguments->mersizesstrings); arguments->refoptionmersizes = gt_option_ref(optionmersizes); gt_option_parser_add_option(op, optionmersizes); optionoutput = gt_option_new_stringarray( "output", "use combination of the following keywords: " "unique nonunique nonuniquemulti relative total " "to specify kind of output", arguments->outputspec); gt_option_parser_add_option(op, optionoutput); option = gt_option_new_bool("scan", "read suffixerator-index sequentially " "instead of mapping it to memory", &arguments->scanfile, false); gt_option_parser_add_option(op, option); option = gt_option_new_verbose(&arguments->verbose); gt_option_parser_add_option(op, option); gt_option_exclude(optionmersizes,optionminmersize); gt_option_exclude(optionmersizes,optionmaxmersize); gt_option_exclude(optionmersizes,optionstep); return op; }