static GtOptionParser* gt_compreads_compress_option_parser_new(void *tool_arguments) { GtCsrHcrEncodeArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *option; static const char *methods[] = { "page", "regular", "none" }; gt_assert(arguments); /* init */ op = gt_option_parser_new("[option ...] (-files file [...])", "Generates compact encoding for fastq data."); option = gt_option_new_bool("descs","encode descriptions", &arguments->descs, false); gt_option_parser_add_option(op, option); option = gt_option_new_filename_array("files", "File(s) containing reads.", arguments->files); gt_option_parser_add_option(op, option); option = gt_option_new_string("name", "specify base name for HCR to be" " generated. Only mandatory, if more than one" " file was given.", arguments->name, NULL); gt_option_parser_add_option(op, option); option = gt_option_new_string("smap", "file containing alphabet description." " If \"-smap\" is not set, dna alphabet is" " used.", arguments->smap, NULL); gt_option_parser_add_option(op, option); option = gt_option_new_range("qrange", "specify range of quality values." " All values smaller or equal to the lower bound" " will be converted to the lower bound. All" " values equal or larger than the upper bound" " will be converted to the upper bound.", &arguments->arg_range, NULL); gt_option_parser_add_option(op, option); option = gt_option_new_uword("srate", "sampling rate, set to sensible default" " depending on sampling method", &arguments->srate, GT_UNDEF_UWORD); gt_option_parser_add_option(op, option); option = gt_option_new_choice("stype", "type of sampling\n" "one of regular - page - none", arguments->method, "page", methods); gt_option_parser_add_option(op, option); gt_option_parser_set_min_max_args(op, 0U, 0U); return op; }
static GtOptionParser* gt_compreads_decompress_option_parser_new(void *tool_arguments) { GtCsrHcrDecodeArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *option; gt_assert(arguments); /* init */ op = gt_option_parser_new("[option ...] (-file file)", "Decodes a file of compressed reads."); option = gt_option_new_bool("v", "be verbose", &arguments->verbose, false); gt_option_parser_add_option(op, option); option = gt_option_new_bool("descs","enable description decoding", &arguments->descs, false); gt_option_parser_add_option(op, option); option = gt_option_new_string("file", "specify base name of files containing" " HCR.", arguments->file, NULL); gt_option_is_mandatory(option); gt_option_parser_add_option(op, option); option = gt_option_new_string("name", "specify base name for decoded hcr" " (suffix will be \".fastq\")", arguments->name, NULL); gt_option_parser_add_option(op, option); option = gt_option_new_string("smap", "specify file containing alphabet" "description (file must be an .al1 file)." " If \"-smap\" is not set, dna alphabet is" " used.", arguments->smap, NULL); gt_option_parser_add_option(op, option); option = gt_option_new_range("range", "decode multiple consecutive reads." " If range is not specified, the " " entire file will be decoded.", &arguments->rng, NULL); gt_option_parser_add_option(op, option); option = gt_option_new_ulong("benchmark", "decode given number random reads " "and report the time to do this", &arguments->bench, 0); gt_option_is_development_option(option); gt_option_parser_add_option(op, option); gt_option_parser_set_min_max_args(op, 0U, 0U); return op; }
static GtOptionParser* gt_condenser_extract_option_parser_new(void *tool_arguments) { GtCondenserExtractArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *option; gt_assert(arguments); /* init */ /*TODO soll das nur zu fasta sein oder kann man auch raw sequence extracten?*/ op = gt_option_parser_new("[option ...] [archive]", "Decompresses a condenser archive to fasta."); /* -original */ option = gt_option_new_filename("original", "uncompressed encseq, needs to be present " "for development reasons.", arguments->original); gt_option_is_mandatory(option); gt_option_parser_add_option(op, option); /* -range */ option = gt_option_new_range("range", "Range of positions to extract" ". If no " "range is given, whole sequence " "collection is extracted.", &arguments->range, NULL); gt_option_parser_add_option(op, option); /* -verbose */ option = gt_option_new_bool("verbose", "Print out verbose output to stderr.", &arguments->verbose, false); gt_option_parser_add_option(op, option); return op; }
static GtOptionParser* gt_encseq_decode_option_parser_new(void *tool_arguments) { GtOptionParser *op; GtOption *option, *optionsep, *optionseq, *optionseqrange, *optionmode; GtEncseqDecodeArguments *arguments = (GtEncseqDecodeArguments*) tool_arguments; static const char *modes[] = {"fasta", "concat", NULL}; /* init */ op = gt_option_parser_new("(sequence_file|indexname)", "Decode/extract encoded sequences."); /* encseq options */ arguments->eopts = gt_encseq_options_register_loading(op, NULL); gt_encseq_options_add_readmode_option(op, arguments->dir); /* -singlechars */ option = gt_option_new_bool("singlechars", "do not use a GtEncseqReader but access each " "sequence character separately", &arguments->singlechars, false); gt_option_is_extended_option(option); gt_option_parser_add_option(op, option); /* -seq */ optionseq = gt_option_new_uword("seq", "extract sequence identified by its number", &arguments->seq, GT_UNDEF_UWORD); gt_option_parser_add_option(op, optionseq); /* -seqrange */ optionseqrange = gt_option_new_range("seqrange", "extract multiple consecutive sequences", &arguments->seqrng, NULL); gt_option_parser_add_option(op, optionseqrange); gt_option_exclude(optionseqrange, optionseq); /* -output */ optionmode = gt_option_new_choice("output", "specify output format " "(choose from fasta|concat)", arguments->mode, modes[0], modes); gt_option_parser_add_option(op, optionmode); /* -range */ option = gt_option_new_range("range", "concatenated range to extract " "(implies '-output concat')", &arguments->rng, NULL); gt_option_parser_add_option(op, option); gt_option_imply(option, optionmode); /* -sepchar */ optionsep = gt_option_new_string("sepchar", "specify character to print as SEPARATOR", arguments->sepchar, "|"); gt_option_parser_add_option(op, optionsep); gt_option_imply(optionsep, optionmode); gt_option_parser_set_min_max_args(op, 1, 1); return op; }
static GtOptionParser* gt_condenseq_extract_option_parser_new(void *tool_arguments) { GtCondenserExtractArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *option, *optionrange, *optionseq, *optionseqrange, *optionmode; static const char *modes[] = {"fasta", "concat", NULL}; gt_assert(arguments); /* init */ op = gt_option_parser_new("[options] archive", "Decompresses condenseq archive."); /* -seq */ optionseq = gt_option_new_uword("seq", "only extract sequence identified by its " "number", &arguments->seq, GT_UNDEF_UWORD); gt_option_parser_add_option(op, optionseq); /* -seqrange */ optionseqrange = gt_option_new_range("seqrange", "only extract (inclusive) range of " "consecutive sequences identified by " "their zero based index numbers", &arguments->seqrange, NULL); gt_option_parser_add_option(op, optionseqrange); gt_option_exclude(optionseq, optionseqrange); /* -range */ optionrange = gt_option_new_range("range", "only extract (inclusive) range of zero " "based positions " "(implies option -output concat)", &arguments->range, NULL); gt_option_parser_add_option(op, optionrange); gt_option_exclude(optionseq, optionrange); gt_option_exclude(optionseqrange, optionrange); /* -output */ optionmode = gt_option_new_choice("output", "specify output format " "(choose from fasta|concat)", arguments->mode, modes[0], modes); gt_option_parser_add_option(op, optionmode); gt_option_imply(optionrange, optionmode); /* -sepchar */ option = gt_option_new_string("sepchar", "specify character to print as SEPARATOR " "(implies option -output concat", arguments->sepchar, "|"); gt_option_parser_add_option(op, option); gt_option_imply(option, optionmode); arguments->sepchar_opt = gt_option_ref(option); gt_output_file_info_register_options(arguments->ofi, op, &arguments->outfp); /* -width */ option = gt_option_new_width(&arguments->width); gt_option_parser_add_option(op, option); /* -verbose */ option = gt_option_new_bool("verbose", "Print out verbose output to stderr.", &arguments->verbose, false); gt_option_parser_add_option(op, option); 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_ltrdigest_option_parser_new(void *tool_arguments) { GtLTRdigestOptions *arguments = tool_arguments; GtOptionParser *op; GtOption *o, *ot, *oto; GtOption *oh, *oc, *oeval; static const char *cutoffs[] = {"NONE", "GA", "TC", NULL}; static GtRange pptlen_defaults = { 8UL, 30UL}, uboxlen_defaults = { 3UL, 30UL}, pbsalilen_defaults = {11UL, 30UL}, pbsoffsetlen_defaults = { 0UL, 5UL}, pbstrnaoffsetlen_defaults = { 0UL, 5UL}; gt_assert(arguments); /* init */ op = gt_option_parser_new("[option ...] gff3_file", "Identifies and annotates sequence features in LTR " "retrotransposon candidates."); /* Output files */ oto = gt_option_new_string("outfileprefix", "prefix for output files (e.g. 'foo' will create " "files called 'foo_*.csv' and 'foo_*.fas')\n" "Omit this option for GFF3 output only.", arguments->prefix, NULL); gt_option_parser_add_option(op, oto); gt_option_hide_default(oto); o = gt_option_new_bool("metadata", "output metadata (run conditions) to separate file", &arguments->print_metadata, true); gt_option_parser_add_option(op, o); gt_option_imply(o, oto); o = gt_option_new_uint("seqnamelen", "set maximal length of sequence names in FASTA headers" " (e.g. for clustalw or similar tools)", &arguments->seqnamelen, 20U); gt_option_parser_add_option(op, o); /* PPT search options */ o = gt_option_new_range("pptlen", "required PPT length range", &arguments->ppt_len, &pptlen_defaults); gt_option_parser_add_option(op, o); o = gt_option_new_range("uboxlen", "required U-box length range", &arguments->ubox_len, &uboxlen_defaults); gt_option_parser_add_option(op, o); o = gt_option_new_uint("uboxdist", "allowed U-box distance range from PPT", &arguments->max_ubox_dist, 0); gt_option_parser_add_option(op, o); o = gt_option_new_uint("pptradius", "radius around beginning of 3' LTR " "to search for PPT", &arguments->ppt_radius, 30U); gt_option_parser_add_option(op, o); o = gt_option_new_probability("pptrprob", "purine emission probability inside PPT", &arguments->ppt_purine_prob, PPT_PURINE_PROB); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); o = gt_option_new_probability("pptyprob", "pyrimidine emission probability inside PPT", &arguments->ppt_pyrimidine_prob, PPT_PYRIMIDINE_PROB); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); o = gt_option_new_probability("pptgprob", "background G emission probability outside PPT", &arguments->bkg_g_prob, BKG_G_PROB); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); o = gt_option_new_probability("pptcprob", "background C emission probability outside PPT", &arguments->bkg_c_prob, BKG_C_PROB); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); o = gt_option_new_probability("pptaprob", "background A emission probability outside PPT", &arguments->bkg_a_prob, BKG_A_PROB); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); o = gt_option_new_probability("ppttprob", "background T emission probability outside PPT", &arguments->bkg_t_prob, BKG_T_PROB); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); o = gt_option_new_probability("pptuprob", "U/T emission probability inside U-box", &arguments->ubox_u_prob, UBOX_U_PROB); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); /* PBS search options */ ot = gt_option_new_filename("trnas", "tRNA library in multiple FASTA format for PBS " "detection\n" "Omit this option to disable PBS search.", arguments->trna_lib); gt_option_parser_add_option(op, ot); gt_option_hide_default(ot); o = gt_option_new_range("pbsalilen", "required PBS/tRNA alignment length range", &arguments->alilen, &pbsalilen_defaults); gt_option_parser_add_option(op, o); gt_option_imply(o, ot); o = gt_option_new_range("pbsoffset", "allowed PBS offset from LTR boundary range", &arguments->offsetlen, &pbsoffsetlen_defaults); gt_option_parser_add_option(op, o); gt_option_imply(o, ot); o = gt_option_new_range("pbstrnaoffset", "allowed PBS/tRNA 3' end alignment offset range", &arguments->trnaoffsetlen, &pbstrnaoffsetlen_defaults); gt_option_parser_add_option(op, o); gt_option_imply(o, ot); o = gt_option_new_uint("pbsmaxedist", "maximal allowed PBS/tRNA alignment unit " "edit distance", &arguments->max_edist, 1U); gt_option_parser_add_option(op, o); gt_option_imply(o, ot); o = gt_option_new_uint("pbsradius", "radius around end of 5' LTR " "to search for PBS", &arguments->pbs_radius, 30U); gt_option_parser_add_option(op, o); gt_option_imply(o, ot); /* Protein domain search options */ oh = gt_option_new_filename_array("hmms", "profile HMM models for domain detection " "(separate by spaces, finish with --) in " "HMMER3 format\n" "Omit this option to disable pHMM search.", arguments->hmm_files); gt_option_parser_add_option(op, oh); oeval = gt_option_new_probability("pdomevalcutoff", "global E-value cutoff for pHMM search\n" "default 1E-6", &arguments->evalue_cutoff, 0.000001); gt_option_parser_add_option(op, oeval); gt_option_is_extended_option(oeval); gt_option_hide_default(oeval); gt_option_imply(oeval, oh); oc = gt_option_new_choice("pdomcutoff", "model-specific score cutoff\n" "choose from TC (trusted cutoff) | " "GA (gathering cutoff) | " "NONE (no cutoffs)", arguments->cutoffs, cutoffs[0], cutoffs); gt_option_parser_add_option(op, oc); gt_option_is_extended_option(oeval); gt_option_imply(oeval, oh); o = gt_option_new_bool("aliout", "output pHMM to amino acid sequence alignments", &arguments->write_alignments, false); gt_option_parser_add_option(op, o); gt_option_imply(o, oh); gt_option_imply(o, oto); o = gt_option_new_bool("aaout", "output amino acid sequences for protein domain " "hits", &arguments->write_aaseqs, false); gt_option_parser_add_option(op, o); gt_option_imply(o, oh); gt_option_imply(o, oto); o = gt_option_new_bool("allchains", "output features from all chains and unchained " "features, labeled with chain numbers", &arguments->output_all_chains, false); gt_option_parser_add_option(op, o); gt_option_imply(o, oh); o = gt_option_new_uint("maxgaplen", "maximal allowed gap size between fragments (in amino " "acids) when chaining pHMM hits for a protein domain", &arguments->chain_max_gap_length, 50U); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); gt_option_imply(o, oh); o = gt_option_new_uword("threads", "DEPRECATED, only included for compatibility reasons!" " Use the -j parameter of the 'gt' call instead.", &arguments->nthreads, 0); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); /* Extended PBS options */ o = gt_option_new_int("pbsmatchscore", "match score for PBS/tRNA alignments", &arguments->ali_score_match, 5); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); gt_option_imply(o, ot); o = gt_option_new_int("pbsmismatchscore", "mismatch score for PBS/tRNA alignments", &arguments->ali_score_mismatch, -10); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); gt_option_imply(o, ot); o = gt_option_new_int("pbsinsertionscore", "insertion score for PBS/tRNA alignments", &arguments->ali_score_insertion, -20); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); gt_option_imply(o, ot); o = gt_option_new_int("pbsdeletionscore", "deletion score for PBS/tRNA alignments", &arguments->ali_score_deletion, -20); gt_option_parser_add_option(op, o); gt_option_is_extended_option(o); gt_option_imply(o, ot); /* verbosity */ o = gt_option_new_verbose(&arguments->verbose); gt_option_parser_add_option(op, o); /* output file options */ gt_output_file_info_register_options(arguments->ofi, op, &arguments->outfp); /* region mapping and sequence source options */ gt_seqid2file_register_options_ext(op, arguments->s2fi, false, false); 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_select_option_parser_new(void *tool_arguments) { SelectArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *option, *contain_option, *overlap_option, *minaveragessp_option, *singleintron_option, *optiondroppedfile; gt_assert(arguments); static const char *filter_logic[] = { "AND", "OR", NULL }; /* init */ op = gt_option_parser_new("[option ...] [GFF3_file ...]", "Select certain features (specified by the used " "options) from given GFF3 file(s)."); /* -seqid */ option = gt_option_new_string("seqid", "select feature with the given " "sequence ID (all comments are selected). ", arguments->seqid, NULL); gt_option_parser_add_option(op, option); /* -source */ option = gt_option_new_string("source", "select feature with the given " "source (the source is column 2 in regular " "GFF3 lines)" , arguments->source, NULL); gt_option_parser_add_option(op, option); /* -contain */ contain_option = gt_option_new_range("contain", "select all features which " "are contained in the given range", &arguments->contain_range, NULL); gt_option_parser_add_option(op, contain_option); /* -overlap */ overlap_option = gt_option_new_range("overlap", "select all features which " "do overlap with the given range", &arguments->overlap_range, NULL); gt_option_parser_add_option(op, overlap_option); /* -strand */ option = gt_option_new_string(GT_STRAND_OPT, "select all top-level features" "(i.e., features without parents) whose strand " "equals the given one (must be one of '" GT_STRAND_CHARS"')", arguments->gt_strand_char, NULL); gt_option_parser_add_option(op, option); /* -targetstrand */ option = gt_option_new_string(TARGETGT_STRAND_OPT, "select all top-level " "features (i.e., features without parents) " "which have exactly one target attribute whose " "strand equals the given one (must be one of '" GT_STRAND_CHARS"')", arguments->targetgt_strand_char, NULL); gt_option_parser_add_option(op, option); /* -targetbest */ option = gt_option_new_bool("targetbest", "if multiple top-level features " "(i.e., features without parents) with exactly " "one target attribute have the same target_id, " "keep only the feature with the best score. If " "-"TARGETGT_STRAND_OPT" is used at the same time, " "this option is applied after " "-"TARGETGT_STRAND_OPT".\n" "Memory consumption is proportional to the input " "file size(s).", &arguments->targetbest, false); gt_option_parser_add_option(op, option); /* -hascds */ option = gt_option_new_bool("hascds", "select all top-level features which " "do have a CDS child", &arguments->has_CDS, false); gt_option_parser_add_option(op, option); /* -maxgenelength */ option = gt_option_new_uword_min("maxgenelength", "select genes up to the " "given maximum length", &arguments->max_gene_length, GT_UNDEF_UWORD, 1); gt_option_parser_add_option(op, option); /* -maxgenenum */ option = gt_option_new_uword("maxgenenum", "select the first genes up to the " "given maximum number", &arguments->max_gene_num, GT_UNDEF_UWORD); gt_option_parser_add_option(op, option); /* -mingenescore */ option = gt_option_new_double("mingenescore", "select genes with the given " "minimum score", &arguments->min_gene_score, GT_UNDEF_DOUBLE); gt_option_parser_add_option(op, option); /* -maxgenescore */ option = gt_option_new_double("maxgenescore", "select genes with the given " "maximum score", &arguments->max_gene_score, GT_UNDEF_DOUBLE); gt_option_parser_add_option(op, option); /* -minaveragessp */ minaveragessp_option = gt_option_new_probability("minaveragessp", "set the minimum average splice site probability", &arguments->min_average_splice_site_prob, GT_UNDEF_DOUBLE); gt_option_parser_add_option(op, minaveragessp_option); /* -singleintronfactor */ singleintron_option = gt_option_new_double_min("singleintronfactor", "factor to multiplicate the average splice site " "probability with for single introns before " "comparing it to the minimum average splice site " "probability", &arguments->single_intron_factor, 1.0, 1.0); gt_option_is_development_option(singleintron_option); gt_option_parser_add_option(op, singleintron_option); /* -featurenum */ option = gt_option_new_uword_min("featurenum", "select feature tree occurring " "at given position in input", &arguments->feature_num, GT_UNDEF_UWORD, 1); gt_option_is_development_option(option); gt_option_parser_add_option(op, option); /* -filter_files */ option = gt_option_new_filename_array("rule_files", "specify Lua files to be used " "for selection", arguments->filter_files); gt_option_parser_add_option(op, option); /* -filter_logic */ option = gt_option_new_choice("rule_logic", "select how multiple Lua " "files should be combined\nchoose from AND|OR", arguments->filter_logic, filter_logic[0], filter_logic); gt_option_parser_add_option(op, option); /* -nh_file */ optiondroppedfile = gt_option_new_filename("dropped_file", "save non-selected features to " "file", arguments->dropped_file); gt_option_parser_add_option(op, optiondroppedfile); /* -v */ option = gt_option_new_verbose(&arguments->verbose); gt_option_parser_add_option(op, option); /* option exclusions */ gt_option_exclude(contain_option, overlap_option); /* option implications */ gt_option_imply(singleintron_option, minaveragessp_option); /* output file options */ gt_output_file_info_register_options(arguments->ofi, op, &arguments->outfp); gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL); return op; }