示例#1
0
void gt_output_file_info_register_options(GtOutputFileInfo *ofi,
                                          GtOptionParser *op, GtFile **outfp)
{
  GtOption *opto, *optgzip, *optbzip2, *optforce;
  gt_assert(outfp && ofi);
  ofi->outfp = outfp;
  /* register option -o */
  opto = gt_option_new_filename("o", "redirect output to specified file",
                                ofi->output_filename);
  gt_option_parser_add_option(op, opto);
  /* register option -gzip */
  optgzip = gt_option_new_bool("gzip", "write gzip compressed output file",
                               &ofi->gzip, false);
  gt_option_parser_add_option(op, optgzip);
  /* register option -bzip2 */
  optbzip2 = gt_option_new_bool("bzip2", "write bzip2 compressed output file",
                                &ofi->bzip2, false);
  gt_option_parser_add_option(op, optbzip2);
  /* register option -force */
  optforce = gt_option_new_bool(GT_FORCE_OPT_CSTR,
                                "force writing to output file",
                                &ofi->force, false);
  gt_option_parser_add_option(op, optforce);
  /* options -gzip and -bzip2 exclude each other */
  gt_option_exclude(optgzip, optbzip2);
  /* option implications */
  gt_option_imply(optgzip, opto);
  gt_option_imply(optbzip2, opto);
  gt_option_imply(optforce, opto);
  /* set hook function to determine <outfp> */
  gt_option_parser_register_hook(op, determine_outfp, ofi);
}
示例#2
0
static GtOptionParser* gt_sequniq_option_parser_new(void *tool_arguments)
{
  GtSequniqArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *seqit_option, *verbose_option, *width_option, *rev_option,
           *nofseqs_option;
  gt_assert(arguments);

  op = gt_option_parser_new("[option ...] sequence_file [...] ",
                            "Filter out repeated sequences in given "
                            "sequence files.");

  /* -seqit */
  seqit_option = gt_option_new_bool("seqit", "use sequence iterator",
                                    &arguments->seqit, false);
  gt_option_is_development_option(seqit_option);
  gt_option_parser_add_option(op, seqit_option);

  /* -nofseqs */
  nofseqs_option = gt_option_new_uword("nofseqs", "number of sequences "
      "(improves efficiency)\ndefault: unspecified",
      &arguments->nofseqs, 0);
  gt_option_is_development_option(nofseqs_option);
  gt_option_hide_default(nofseqs_option);
  gt_option_parser_add_option(op, nofseqs_option);

  /* -rev */
  rev_option = gt_option_new_bool("rev", "also filter out sequences whose "
      "reverse complement is identical to a sequence already output",
      &arguments->rev, false);
  gt_option_parser_add_option(op, rev_option);

  /* -v */
  verbose_option = gt_option_new_verbose(&arguments->verbose);
  gt_option_parser_add_option(op, verbose_option);

  /* -width */
  width_option = gt_option_new_width(&arguments->width);
  gt_option_parser_add_option(op, width_option);

  gt_output_file_info_register_options(arguments->ofi, op, &arguments->outfp);

  /* option implications */
  gt_option_imply(verbose_option, seqit_option);

  gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL);
  gt_option_parser_set_min_args(op, 1U);
  return op;
}
示例#3
0
static GtOptionParser* gt_linspace_align_option_parser_new(void *tool_arguments)
{
  GtLinspaceArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *optionstrings, *optionfiles, *optionglobal, *optionlocal,
           *optiondna, *optionprotein, *optioncostmatrix, *optionlinearcosts,
           *optionaffinecosts, *optionoutputfile, *optionshowscore,
           *optionshowsequences, *optiondiagonal, *optiondiagonalbonds,
           *optionsimilarity, *optiontsfactor, *optionspacetime,
           *optionscoreonly, *optionwildcardsymbol;

  gt_assert(arguments);

  /* init */
  op = gt_option_parser_new("[ss|ff] sequence1 sequence2 [dna|protein] "
                            "[global|local] [a|l] costs/scores "
                            "[additional options]",
                            "Apply function to compute alignment.");
  gt_option_parser_set_mail_address(op,
                          "<*****@*****.**>");

  /* -bool */
  optionglobal = gt_option_new_bool("global", "global alignment",
                                    &arguments->global, false);
  gt_option_parser_add_option(op, optionglobal);

  optionlocal = gt_option_new_bool("local", "local alignment",
                                   &arguments->local, false);
  gt_option_parser_add_option(op, optionlocal);

  optiondiagonal = gt_option_new_bool("d", "diagonalband alignment",
                                      &arguments->diagonal, false);
  gt_option_parser_add_option(op, optiondiagonal);

  optiondna = gt_option_new_bool("dna", "type of sequences: DNA",
                                 &arguments->dna, false);
  gt_option_parser_add_option(op, optiondna);

  optionprotein = gt_option_new_bool("protein", "type of sequences: protein",
                                      &arguments->protein, false);
  gt_option_parser_add_option(op, optionprotein);

  optionwildcardsymbol = gt_option_new_bool("wildcard", "show symbol used to "
                                            "represented wildcards in output",
                                            &arguments->wildcardshow, false);
  gt_option_parser_add_option(op, optionwildcardsymbol);

  /* special case, if given matrix includes cost values in place of scores */
  optioncostmatrix = gt_option_new_bool("costmatrix", "describes type of "
                                        "given substituation matrix",
                                        &arguments->has_costmatrix, false);
  gt_option_parser_add_option(op, optioncostmatrix);

  optionshowscore = gt_option_new_bool("showscore", "show score for alignment, "
                                       "please note it will calculate costs "
                                       "for global alignments and scores for "
                                       "local alignemnts always, independtly "
                                       "of input ",
                                       &arguments->showscore, false);
  gt_option_parser_add_option(op, optionshowscore);

  optionshowsequences = gt_option_new_bool("showsequences", "show sequences u "
                                           "and v in front of alignment",
                                       &arguments->showsequences, false);
  gt_option_parser_add_option(op, optionshowsequences);

  optionscoreonly = gt_option_new_bool("showonlyscore", "show only score for "
                                       "generated alignment to compare with "
                                       "other algorithms",
                                       &arguments->scoreonly, false);
  gt_option_parser_add_option(op, optionscoreonly);

  optionspacetime = gt_option_new_bool("spacetime", "write space peak and time"
                                       " overall on stdout",
                                       &arguments->spacetime, false);
  gt_option_parser_add_option(op, optionspacetime);

  /* -str */
  optionstrings = gt_option_new_string_array("ss", "input, use two strings",
                                             arguments->strings);
  gt_option_parser_add_option(op, optionstrings);

  optionfiles = gt_option_new_filename_array("ff", "input, use two files",
                                             arguments->files);
  gt_option_parser_add_option(op, optionfiles);

  optionlinearcosts = gt_option_new_string_array("l", "lineargapcosts, "
                                                 "use match, mismatch and "
                                                 "gapcost, alternatively "
                                                 "substituationmatrix and "
                                                 "gapcost",
                                                 arguments->linearcosts);
  gt_option_parser_add_option(op, optionlinearcosts);

  optionaffinecosts = gt_option_new_string_array("a", "affinegapcosts, "
                                           "use match, mismatch, gap_extension "
                                           "and gap_opening, alternatively "
                                           "substituationmatrix, gap_extension "
                                           "and gap_opening",
                                           arguments->affinecosts);
  gt_option_parser_add_option(op, optionaffinecosts);

  optiondiagonalbonds = gt_option_new_string_array("lr", "specified left and "
                                                   "right shift of diagonal",
                                                   arguments->diagonalbonds);
  gt_option_parser_add_option(op, optiondiagonalbonds);

  optionoutputfile = gt_option_new_string("o", "print alignment, "
                                          "use outputfile",
                                          arguments->outputfile, "stdout");
  gt_option_parser_add_option(op, optionoutputfile);

  /* -ulong */
  optiontsfactor = gt_option_new_ulong("t", "timesquarefactor to organize "
                                       "time and space",
                                       &arguments->timesquarefactor,1);
  gt_option_parser_add_option(op, optiontsfactor);

  /* -double */
  optionsimilarity = gt_option_new_probability("similarity", "specified left "
                                               "and right shift of diagonal by "
                                               "similarity of sequences, "
                                               "0 <= similarty <= 1",
                                               &arguments->similarity, 0);
  gt_option_parser_add_option(op, optionsimilarity);

  /* dependencies */
  gt_option_is_mandatory_either(optionstrings, optionfiles);
  gt_option_is_mandatory_either(optiondna, optionprotein);
  gt_option_exclude(optionlocal, optionglobal);
  gt_option_exclude(optionlinearcosts, optionaffinecosts);
  gt_option_exclude(optiondna, optionprotein);
  gt_option_exclude(optionshowsequences, optionscoreonly);
  gt_option_exclude(optionsimilarity, optiondiagonalbonds);
  gt_option_imply_either_2(optionfiles, optionglobal, optionlocal);
  gt_option_imply_either_2(optiondna, optionstrings, optionfiles);
  gt_option_imply_either_2(optionstrings, optionglobal, optionlocal);
  gt_option_imply_either_2(optionprotein, optionstrings, optionfiles);
  gt_option_imply_either_2(optionlocal, optionlinearcosts, optionaffinecosts);
  gt_option_imply_either_2(optionglobal, optionlinearcosts, optionaffinecosts);
  gt_option_imply_either_2(optionshowscore,optionlinearcosts,optionaffinecosts);
  gt_option_imply_either_2(optionshowsequences, optionstrings, optionfiles);
  gt_option_imply_either_2(optionscoreonly,optionlinearcosts,optionaffinecosts);
  gt_option_imply(optiondiagonal, optionglobal);
  gt_option_imply(optiondiagonalbonds, optiondiagonal);
  gt_option_imply(optionsimilarity, optiondiagonal);
  gt_option_imply(optioncostmatrix, optionprotein);

  /* extended options */
  gt_option_is_extended_option(optiontsfactor);
  gt_option_is_extended_option(optionshowscore);
  gt_option_is_extended_option(optionwildcardsymbol);
  gt_option_is_extended_option(optioncostmatrix);

  /* development option(s) */
  gt_option_is_development_option(optionspacetime);
  gt_option_is_development_option(optionscoreonly);/*only useful to test*/

  return op;
}
static GtOptionParser* gt_readjoiner_assembly_option_parser_new(
    void *tool_arguments)
{
  GtReadjoinerAssemblyArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *option, *errors_option, *deadend_option, *v_option,
           *q_option, *bubble_option, *deadend_depth_option;
  gt_assert(arguments);

  /* init */
  op = gt_option_parser_new("[option ...]",
      "Construct string graph and output contigs.");

  /* -readset */
  option = gt_option_new_string("readset", "specify the readset name",
      arguments->readset, NULL);
  gt_option_parser_add_option(op, option);
  gt_option_is_mandatory(option);

  /* -spmfiles */
  option = gt_option_new_uint_min("spmfiles", "number of SPM files to read\n"
      "this must be equal to the value of -j for the overlap phase",
      &arguments->nspmfiles, 1U, 1U);
  gt_option_is_extended_option(option);
  gt_option_parser_add_option(op, option);

  /* -l */
  option = gt_option_new_uint_min("l", "specify the minimum SPM length",
      &arguments->minmatchlength, 0, 2U);
  gt_option_is_extended_option(option);
  gt_option_parser_add_option(op, option);

  /* -depthcutoff */
  option = gt_option_new_uint_min("depthcutoff", "specify the minimal "
      "number of nodes in a contig",
      &arguments->depthcutoff, 3U, 1U);
  gt_option_is_extended_option(option);
  gt_option_parser_add_option(op, option);

  /* -lengthcutoff */
  option = gt_option_new_uint_min("lengthcutoff", "specify the minimal "
      "length of a contig",
      &arguments->lengthcutoff, 100U, 1U);
  gt_option_is_extended_option(option);
  gt_option_parser_add_option(op, option);

  /* -redtrans */
  option = gt_option_new_bool("redtrans", "reduce transitive edges",
      &arguments->redtrans, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -errors */
  errors_option = gt_option_new_bool("errors", "search graph features which "
      "may originate from sequencing errors and remove them",
      &arguments->errors, false);
  gt_option_is_extended_option(errors_option);
  gt_option_parser_add_option(op, errors_option);

  /* -bubble */
  bubble_option = gt_option_new_uint("bubble", "number of rounds of p-bubble "
      "removal to perform", &arguments->bubble, 3U);
  gt_option_is_extended_option(bubble_option);
  gt_option_imply(bubble_option, errors_option);
  gt_option_parser_add_option(op, bubble_option);

  /* -deadend */
  deadend_option = gt_option_new_uint("deadend", "number of rounds of "
      "dead end removal to perform a dead end",
      &arguments->deadend, 10U);
  gt_option_is_extended_option(deadend_option);
  gt_option_imply(deadend_option, errors_option);
  gt_option_parser_add_option(op, deadend_option);

  /* -deadend-depth */
  deadend_depth_option = gt_option_new_uint_min("deadend-depth", "specify the "
      "maximal depth of a path to an end-vertex by which the path shall be "
      "considered a dead end",
      &arguments->deadend_depth, 10U, 1U);
  gt_option_is_extended_option(deadend_depth_option);
  gt_option_imply(deadend_depth_option, errors_option);
  gt_option_parser_add_option(op, deadend_depth_option);

  /* -paths2seq */
  option = gt_option_new_bool("paths2seq", "read <indexname>"
      GT_READJOINER_SUFFIX_CONTIG_PATHS " and write "
      "<indexname>" GT_READJOINER_SUFFIX_CONTIGS,
      &arguments->paths2seq, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -buffersize */
  option = gt_option_new_string("buffersize", "specify size for read buffer"
      " of paths2seq phase (in bytes, the keywords 'MB' and 'GB' are allowed)",
                       arguments->buffersizearg, NULL);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);
  arguments->refoptionbuffersize = gt_option_ref(option);

  /* -vd */
  option = gt_option_new_bool("vd", "use verbose descriptions for contigs",
      &arguments->vd, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -astat */
  option = gt_option_new_bool("astat", "calculate A-statistics for each contig",
      &arguments->astat, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -cov */
  option = gt_option_new_double("cov", "average coverage value to use for the "
      "A-statistics calculation", &arguments->coverage, (double)0);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -copynum */
  option = gt_option_new_bool("copynum", "load reads copy numbers list from "
      "file for the A-statistics calculation",
      &arguments->copynum, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -v */
  v_option = gt_option_new_verbose(&arguments->verbose);
  gt_option_parser_add_option(op, v_option);

  /* -q */
  q_option = gt_option_new_bool("q", "suppress standard output messages",
      &arguments->quiet, false);
  gt_option_parser_add_option(op, q_option);
  gt_option_exclude(q_option, v_option);

  /* -load */
  option = gt_option_new_bool("load", "save the string graph from file",
      &arguments->load, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -save */
  option = gt_option_new_bool("save", "save the string graph to file",
      &arguments->save, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -show_contigs_info */
  option = gt_option_new_bool("cinfo", "output additional files required "
      "for contigs graph construction (eqlen only)",
      &arguments->show_contigs_info, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  gt_option_parser_set_version_func(op, gt_readjoiner_show_version);
  gt_option_parser_set_max_args(op, 0);

  return op;
}
示例#5
0
static GtOptionParser* gt_gff3_option_parser_new(void *tool_arguments)
{
  GFF3Arguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *sort_option, *load_option, *strict_option, *tidy_option,
           *mergefeat_option, *addintrons_option, *offset_option,
           *offsetfile_option, *setsource_option, *option;
  gt_assert(arguments);

  /* init */
  op = gt_option_parser_new("[option ...] [GFF3_file ...]", "Parse, possibly "
                            "transform, and output GFF3 files.");

  /* -sort */
  sort_option = gt_option_new_bool("sort", "sort the GFF3 features (memory "
                                   "consumption is proportional to the input "
                                   "file size(s))",
                                   &arguments->sort, false);
  gt_option_parser_add_option(op, sort_option);

  /* -strict */
  strict_option = gt_option_new_bool("strict", "be very strict during GFF3 "
                                     "parsing (stricter than the specification "
                                     "requires)", &arguments->strict, false);
  gt_option_is_development_option(strict_option);
  gt_option_parser_add_option(op, strict_option);

  /* -tidy */
  tidy_option = gt_option_new_bool("tidy", "try to tidy the GFF3 files up "
                                   "during parsing", &arguments->tidy, false);
  gt_option_parser_add_option(op, tidy_option);
  gt_option_exclude(strict_option, tidy_option);

  /* -retainids */
  option = gt_option_new_bool("retainids",
                              "when available, use the original IDs provided "
                              "in the source file\n"
                              "(memory consumption is proportional to the "
                              "input file size(s))", &arguments->retainids,
                              false);
  gt_option_parser_add_option(op, option);

  /* -checkids */
  option = gt_option_new_bool("checkids",
                              "make sure the ID attributes are unique "
                              "within the scope of each GFF3_file, as required "
                              "by GFF3 specification\n"
                              "(memory consumption is proportional to the "
                              "input file size(s))", &arguments->checkids,
                              false);
  gt_option_parser_add_option(op, option);

  /* -addids */
  option = gt_option_new_bool("addids", "add missing \""
                              GT_GFF_SEQUENCE_REGION"\" lines automatically",
                              &arguments->addids, true);
  gt_option_parser_add_option(op, option);

  /* -fixregionboundaries */
  option = gt_option_new_bool("fixregionboundaries", "automatically adjust \""
                              GT_GFF_SEQUENCE_REGION"\" lines to contain all "
                              "their features (memory consumption is "
                              "proportional to the input file size(s))",
                              &arguments->fixboundaries, false);
  gt_option_parser_add_option(op, option);

  /* -mergefeat */
  mergefeat_option = gt_option_new_bool("mergefeat",
                                        "merge adjacent features of the same "
                                        "type", &arguments->mergefeat, false);
  gt_option_is_development_option(mergefeat_option);
  gt_option_imply(mergefeat_option, sort_option);
  gt_option_parser_add_option(op, mergefeat_option);

  /* -load */
  load_option = gt_option_new_bool("load", "load the GFF3 features into memory "
                                   "(requires space proportional to the input "
                                   "file size(s))",
                                   &arguments->load, false);
  gt_option_is_development_option(load_option);
  gt_option_parser_add_option(op, load_option);

  /* -addintrons */
  addintrons_option = gt_option_new_bool("addintrons", "add intron features "
                                         "between existing exon features",
                                         &arguments->addintrons, false);
  gt_option_parser_add_option(op, addintrons_option);

  /* -offset */
  offset_option = gt_option_new_word("offset", "transform all features by the "
                                     "given offset", &arguments->offset,
                                     GT_UNDEF_WORD);
  gt_option_parser_add_option(op, offset_option);

  /* -offsetfile */
  offsetfile_option = gt_option_new_filename("offsetfile", "transform all "
                                             "features by the offsets given in "
                                             "file", arguments->offsetfile);
  gt_option_parser_add_option(op, offsetfile_option);
  gt_option_exclude(offset_option, offsetfile_option);

  /* -setsource */
  setsource_option = gt_option_new_string("setsource", "set the 'source' "
                                          "value (2nd column) of each feature",
                                          arguments->newsource, NULL);
  gt_option_parser_add_option(op, setsource_option);

  /* typecheck options */
  gt_typecheck_info_register_options(arguments->tci, op);

  /* -show */
  option = gt_option_new_bool("show", "show GFF3 output", &arguments->show,
                              true);
  gt_option_parser_add_option(op, option);

  /* -v */
  option = gt_option_new_verbose(&arguments->verbose);
  gt_option_parser_add_option(op, option);

  /* -width */
  option = gt_option_new_width(&arguments->width);
  gt_option_parser_add_option(op, option);

  /* output file options */
  gt_output_file_info_register_options(arguments->ofi, op, &arguments->outfp);

  /* set comment function */
  gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL);

  return op;
}
示例#6
0
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;
}
示例#7
0
static GtOPrval parse_options(int *parsed_args,
                              Cmppairwiseopt *pw,
                              int argc, const char **argv, GtError *err)
{
  GtOptionParser *op;
  GtOption *optionstrings,
         *optionfiles,
         *optioncharlistlen,
         *optiontext,
         *optionshowedist;
  GtStrArray *charlistlen;
  GtOPrval oprval;

  gt_error_check(err);
  charlistlen = gt_str_array_new();
  pw->strings = gt_str_array_new();
  pw->files = gt_str_array_new();
  pw->text = gt_str_new();
  pw->charlistlen = NULL;
  pw->showedist = false;
  op = gt_option_parser_new("options", "Apply function to pairs of strings.");
  gt_option_parser_set_mail_address(op, "<*****@*****.**>");

  optionstrings = gt_option_new_string_array("ss", "use two strings",
                                             pw->strings);
  gt_option_parser_add_option(op, optionstrings);

  optionfiles = gt_option_new_filename_array("ff", "use two files",
                                             pw->files);
  gt_option_parser_add_option(op, optionfiles);

  optioncharlistlen = gt_option_new_string_array("a",
                                             "use character list and length",
                                             charlistlen);
  gt_option_parser_add_option(op, optioncharlistlen);

  optiontext = gt_option_new_string("t", "use text", pw->text, NULL);
  gt_option_parser_add_option(op, optiontext);

  optionshowedist = gt_option_new_bool("e", "output unit edit distance",
                      &pw->showedist, false);
  gt_option_parser_add_option(op, optionshowedist);

  gt_option_exclude(optionstrings, optionfiles);
  gt_option_exclude(optionstrings, optioncharlistlen);
  gt_option_exclude(optionstrings, optiontext);
  gt_option_exclude(optionfiles, optioncharlistlen);
  gt_option_exclude(optionfiles, optiontext);
  gt_option_exclude(optioncharlistlen, optiontext);
  gt_option_imply(optionshowedist, optionstrings);

  oprval = gt_option_parser_parse(op, parsed_args, argc, argv, gt_versionfunc,
                                  err);
  if (oprval == GT_OPTION_PARSER_OK)
  {
    if (gt_option_is_set(optionstrings))
    {
      if (gt_str_array_size(pw->strings) != 2UL)
      {
        gt_error_set(err, "option -ss requires two string arguments");
        oprval = GT_OPTION_PARSER_ERROR;
      }
    } else
    {
      if (gt_option_is_set(optionfiles))
      {
        if (gt_str_array_size(pw->files) != 2UL)
        {
          gt_error_set(err, "option -ff requires two filename arguments");
          oprval = GT_OPTION_PARSER_ERROR;
        }
      } else
      {
        if (gt_option_is_set(optioncharlistlen))
        {
          GtWord readint;

          if (gt_str_array_size(charlistlen) != 2UL)
          {
            gt_error_set(err,
                         "option -a requires charlist and length argument");
            oprval = GT_OPTION_PARSER_ERROR;
          }
          pw->charlistlen = gt_malloc(sizeof *pw->charlistlen);
          pw->charlistlen->charlist =
            gt_str_ref(gt_str_array_get_str(charlistlen,
                                                                  0));
          if (sscanf(gt_str_array_get(charlistlen,1UL), GT_WD, &readint) != 1 ||
              readint < 1L)
          {
            gt_error_set(err,
                         "option -a requires charlist and length argument");
            oprval = GT_OPTION_PARSER_ERROR;
          }
          pw->charlistlen->len = (GtUword) readint;
        } else
        {
          if (!gt_option_is_set(optiontext))
          {
            gt_error_set(err,
                         "use exactly one of the options -ss, -ff, -a, -t");
            oprval = GT_OPTION_PARSER_ERROR;
          }
        }
      }
    }
  }
  gt_option_parser_delete(op);
  if (oprval == GT_OPTION_PARSER_OK && *parsed_args != argc)
  {
    gt_error_set(err, "superfluous program parameters");
    oprval = GT_OPTION_PARSER_ERROR;
  }
  gt_str_array_delete(charlistlen);
  return oprval;
}
示例#8
0
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_kmer_database_option_parser_new(void *tool_arguments)
{
  GtKmerDatabaseArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *option,
           *option_verbose,
           *option_use_cutoff,
           *option_hash,
           *option_mean_cutoff;
  gt_assert(arguments);

  /* init */
  op = gt_option_parser_new("[option ...] [file]",
                            "Makes a GtKmerDatabase from the input file.");

  /* -kmersize */
  option = gt_option_new_uint_min_max("kmersize", "kmersize used",
                                  &arguments->kmersize, 3U, 1U, 10U);
  gt_option_parser_add_option(op, option);

  /* -verbose */
  option_verbose = gt_option_new_bool("verbose", "prints out results of "
                                      "merging",
                                      &arguments->verbose, false);
  gt_option_parser_add_option(op, option_verbose);

  /* -merge_only */
  option = gt_option_new_bool("merge_only", "only uses merge to build DB, "
                              "doesn_t build two DBs to compare merge with a "
                              "different method (much faster). It also allows "
                              "for random intervals which are biffer than the "
                              "maximum buffer size (will be split internally).",
                              &arguments->merge_only, false);
  gt_option_parser_add_option(op, option);

  /* -use_cutoff */
  option_use_cutoff = gt_option_new_bool("use_cutoff", "uses a cutoff. see "
                                         "-set_cutoff description. Only works "
                                         "with merge_only",
                                         &arguments->cutoff, false);
  gt_option_parser_add_option(op, option_use_cutoff);
  gt_option_imply(option_use_cutoff, option);

  /* -set_cutoff */
  option = gt_option_new_uword_min("set_cutoff", "kmers occuring more often "
                                   "than this value won't be saved",
                                   &arguments->cutoff_value, (GtUword) 30,
                                   (GtUword) 1);
  gt_option_parser_add_option(op, option);
  gt_option_imply(option, option_use_cutoff);

  /* -mean_cutoff */
  option_mean_cutoff = gt_option_new_bool("mean_cutoff", "2*mean of kmer "
                                          "occurrence will be"
                                          " used as cutoff value",
                                          &arguments->mean_cutoff, false);
  gt_option_parser_add_option(op, option_mean_cutoff);
  gt_option_imply(option_mean_cutoff, option_use_cutoff);
  gt_option_exclude(option_mean_cutoff, option);

  /* -disable_prune */
  option = gt_option_new_bool("disable_prune", "disables the removel of kmers, "
                              "which occure more often than the cutoff.",
                              &arguments->prune, false);
  gt_option_parser_add_option(op, option);
  gt_option_imply(option, option_use_cutoff);

  /* -use_hash */
  option_hash = gt_option_new_bool("use_hash", "saves each kmer in kdb and "
                                   "also in a hash. afterwards both will be "
                                   "accessed and time for saving and "
                                   "accessing will be shown.",
                                   &arguments->use_hash, false);
  gt_option_parser_add_option(op, option_hash);
  gt_option_exclude(option_hash, option_use_cutoff);
  gt_option_exclude(option_hash, option_verbose);

  /* -benchmark */
  option = gt_option_new_bool("benchmark", "measures the time the tool takes to"
                              " fill the database. Doesn't test for consistency"
                              " though!", &arguments->bench, false);
  gt_option_parser_add_option(op, option);

  /* -bsize */
  option = gt_option_new_uword_min("bsize", "size of the buffer",
                                   &arguments->sb_size, (GtUword) 100000,
                                   (GtUword) 2);
  gt_option_parser_add_option(op, option);
  gt_option_exclude(option, option_hash);

  /* -outfile */
  option = gt_option_new_string("outfile", "specifies file for verbose output",
                                arguments->print_filename, NULL);
  gt_option_parser_add_option(op, option);

  return op;
}
示例#10
0
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 */
           *optionhmms,
           *optionevalcutoff,
           *optionpdomcutoff,
           *optionmaxgap;
  static const char *overlaps[] = {
    "best", /* default */
    "no",
    "all",
    NULL
  };
  static const char *cutoffs[] = {
    "NONE",
    "GA",
    "TC",
    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_uword_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_uword_min_max("mintirlen",
                                                "specify minimum length for "
                                                "each TIR",
                                                &arguments->min_TIR_length,
                                                27UL, 1UL, GT_UNDEF_UWORD);
  gt_option_parser_add_option(op, optionminlentir);

  /* -maxlentir */
  optionmaxlentir = gt_option_new_uword_min_max("maxtirlen",
                                                "specify maximum length for "
                                                "each TIR",
                                                &arguments->max_TIR_length,
                                                1000UL, 1UL, GT_UNDEF_UWORD);
  gt_option_parser_add_option(op, optionmaxlentir);

  /* -mindisttir */
  optionmindisttir = gt_option_new_uword_min_max("mintirdist",
                                                 "specify minimum distance of "
                                                 "TIRs",
                                                 &arguments->min_TIR_distance,
                                                 100UL, 1UL, GT_UNDEF_UWORD);
  gt_option_parser_add_option(op, optionmindisttir);

  /* -maxdisttir */
  optionmaxdisttir = gt_option_new_uword_min_max("maxtirdist",
                                                 "specify maximum distance of "
                                                 "TIRs",
                                                 &arguments->max_TIR_distance,
                                                 10000UL, 1UL, GT_UNDEF_UWORD);
  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_uword_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_uword_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_uword_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);

  optionhmms = 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, optionhmms);

  optionevalcutoff = 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, optionevalcutoff);
  gt_option_hide_default(optionevalcutoff);
  gt_option_imply(optionevalcutoff, optionhmms);

  optionpdomcutoff = gt_option_new_choice("pdomcutoff",
                                       "model-specific score cutoff\n"
                                       "choose from TC (trusted cutoff) | "
                                       "GA (gathering cutoff) | "
                                       "NONE (no cutoffs)",
                             arguments->cutoffs, cutoffs[1], cutoffs);
  gt_option_parser_add_option(op, optionpdomcutoff);
  gt_option_imply(optionpdomcutoff, optionhmms);

  /* XXX: make -pdomcutoff and -pdomevalcutoff mutually exclusive */

  optionmaxgap = 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, optionmaxgap);
  gt_option_is_extended_option(optionmaxgap);
  gt_option_imply(optionmaxgap, optionhmms);

  return op;
}
示例#11
0
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;
}
示例#12
0
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;
}
示例#13
0
static GtOptionParser *gt_tyr_mkindex_option_parser_new(void *tool_arguments)
{
  GtOptionParser *op;
  GtOption *option,
           *optionminocc,
           *optionmaxocc,
           *optionpl,
           *optionstoreindex,
           *optionstorecounts,
           *optionscan,
           *optionesa;
  Tyr_mkindex_options *arguments = tool_arguments;

  op = gt_option_parser_new("[options] -esa suffixerator-index [options]",
                            "Count and index k-mers in the given enhanced "
                            "suffix array for a fixed value of k.");
  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);

  option = gt_option_new_ulong("mersize",
                               "Specify the mer size.",
                               &arguments->mersize,
                               20UL);
  gt_option_parser_add_option(op, option);

  optionminocc
    = gt_option_new_ulong("minocc",
                          "Specify the minimum occurrence number for "
                          "the mers to output/index",
                          &arguments->userdefinedminocc,
                          0);
  gt_option_parser_add_option(op, optionminocc);

  optionmaxocc
    = gt_option_new_ulong("maxocc",
                          "Specify the maximum occurrence number for "
                          "the mers to output/index",
                          &arguments->userdefinedmaxocc,
                          0);
  gt_option_parser_add_option(op, optionmaxocc);

  optionpl = gt_option_new_uint_min("pl",
                 "specify prefix length for bucket boundary construction\n"
                 "recommendation: use without argument;\n"
                 "then a reasonable prefix length is automatically determined",
                 &arguments->userdefinedprefixlength,
                 0,
                 1U);
  gt_option_argument_is_optional(optionpl);
  gt_option_parser_add_option(op, optionpl);
  arguments->refoptionpl = gt_option_ref(optionpl);

  optionstoreindex = gt_option_new_string("indexname",
                                          "store the mers specified by options "
                                          "-maxocc and -minocc in an index",
                                          arguments->str_storeindex, NULL);
  gt_option_parser_add_option(op, optionstoreindex);

  optionstorecounts = gt_option_new_bool("counts", "store counts of the mers",
                                         &arguments->storecounts,false);
  gt_option_parser_add_option(op, optionstorecounts);

  option = gt_option_new_bool("test", "perform tests to verify program "
                                      "correctness", &arguments->performtest,
                                      false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  optionscan = gt_option_new_bool("scan",
                                  "read enhanced suffix array sequentially "
                                  "instead of mapping it to memory",
                                  &arguments->scanfile,
                                  false);
  gt_option_parser_add_option(op, optionscan);

  option = gt_option_new_verbose(&arguments->verbose);
  gt_option_parser_add_option(op, option);

  gt_option_imply(optionpl, optionstoreindex);
  gt_option_imply(optionstorecounts, optionstoreindex);
  gt_option_imply_either_2(optionstoreindex,optionminocc,optionmaxocc);
  return op;
}
示例#14
0
文件: gtr.c 项目: yesimon/genometools
static GtOptionParser* gtr_option_parser_new(GtR *gtr)
{
  GtOptionParser *op;
  GtOption *o, *only_option, *debug_option, *debugfp_option;
  gt_assert(gtr);
  op = gt_option_parser_new("[option ...] [tool | script] [argument ...]",
                            "The GenomeTools genome analysis system.");
  gt_option_parser_set_comment_func(op, show_gtr_help, gtr->tools);
  o = gt_option_new_bool("i",
                         "enter interactive mode after executing 'tool' or "
                         "'script'", &gtr->interactive, false);
  gt_option_hide_default(o);
  gt_option_parser_add_option(op, o);
  o = gt_option_new_bool("q", "suppress warnings", &gtr->quiet, false);
  gt_option_hide_default(o);
  gt_option_parser_add_option(op, o);
  o = gt_option_new_uint_min("j", "set number of parallel threads used at once",
                             &gt_jobs, 1, 1);
  gt_option_is_development_option(o);
  gt_option_parser_add_option(op, o);
  o = gt_option_new_bool("test", "perform unit tests and exit", &gtr->test,
                         false);
  gt_option_hide_default(o);
  gt_option_parser_add_option(op, o);
  only_option = gt_option_new_string("only", "perform single unit test "
                                     "(requires -test)", gtr->test_only, "");
  gt_option_imply(only_option, o);
  gt_option_is_development_option(only_option);
  gt_option_hide_default(only_option);
  gt_option_parser_add_option(op, only_option);
  debug_option = gt_option_new_debug(&gtr->debug);
  gt_option_parser_add_option(op, debug_option);
  debugfp_option = gt_option_new_string("debugfp",
                                     "set file pointer for debugging output\n"
                                     "use ``stdout'' for standard output\n"
                                     "use ``stderr'' for standard error\n"
                                     "or any other string to use the "
                                     "corresponding file (will be overwritten "
                                     "without warning!)", gtr->debugfp,
                                     "stderr");
  gt_option_is_development_option(debugfp_option);
  gt_option_parser_add_option(op, debugfp_option);
  gt_option_imply(debugfp_option, debug_option);
  o = gt_option_new_uint("seed",
                         "set seed for random number generator manually.\n"
                         "0 generates a seed from current time and process id",
                         &gtr->seed, gtr->seed);
  gt_option_hide_default(o);
  gt_option_parser_add_option(op, o);
  o = gt_option_new_bool("64bit", "exit with code 0 if this is a 64bit binary, "
                         "with 1 otherwise", &gtr->check64bit, false);
  gt_option_is_development_option(o);
  gt_option_parser_add_option(op, o);
  o = gt_option_new_bool("list", "list all tools and exit", &gtr->list, false);
  gt_option_is_development_option(o);
  gt_option_hide_default(o);
  gt_option_parser_add_option(op, o);
  o = gt_option_new_filename("testspacepeak", "alloc 64 MB and mmap the given "
                             "file", gtr->testspacepeak);
  gt_option_is_development_option(o);
  gt_option_parser_add_option(op, o);

  o = gt_option_new_string("createman", "create man page sources in directory",
                           gtr->manoutdir, "");
  gt_option_is_development_option(o);
  gt_option_parser_add_option(op, o);
  return op;
}
static GtOptionParser* gt_show_seedext_option_parser_new(void *tool_arguments)
{
  GtShowSeedextArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *option, *op_ali, *option_filename, *op_relax_polish,
           *op_seed_extend, *op_sortmatches, *op_showeoplist;

  gt_assert(arguments);
  /* init */
  op = gt_option_parser_new("[options] -f <matchfilename>",
                            "Parse output of a seed extension and show/verify "
                            "the alignment.");

  /* -a */
  op_ali = gt_option_new_bool("a",
                              "show alignment",
                              &arguments->show_alignment,
                              false);
  gt_option_parser_add_option(op, op_ali);

  /* -seed-display */
  option = gt_option_new_bool("seed-display",
                              "Display seeds in #-line and by "
                              "character + (instead of |) in middle "
                              "row of alignment column",
                              &arguments->seed_display,
                              false);
  gt_option_parser_add_option(op, option);

  /* -seed-extend */
  op_seed_extend = gt_option_new_bool("seed-extend",
                              "read the seeds from the # seed: -lines and "
                              "extend them; match lines are ignored; "
                              "match coordindates are displayed",
                              &arguments->seed_extend,
                              false);
  gt_option_parser_add_option(op, op_seed_extend);

  /* -relax-polish */
  op_relax_polish = gt_option_new_bool("relax-polish",
                                       "do not force alignments to have "
                                       "polished ends",
                                       &arguments->relax_polish,false);
  gt_option_parser_add_option(op, op_relax_polish);
  gt_option_is_development_option(op_relax_polish);
  gt_option_imply(op_relax_polish, op_ali);

  /* -sort */
  op_sortmatches = gt_option_new_bool("sort","sort matches in ascending order "
                                             "of their end positon on the "
                                             "query",
                                      &arguments->sortmatches,false);
  gt_option_parser_add_option(op, op_sortmatches);

  /* -e */
  op_showeoplist = gt_option_new_bool("e","show list of edit operations",
                                      &arguments->showeoplist,false);
  gt_option_parser_add_option(op, op_showeoplist);

  /* -f */
  option_filename = gt_option_new_filename("f",
                                          "path to file with match coordinates",
                                          arguments->matchfilename);
  gt_option_is_mandatory(option_filename);
  gt_option_parser_add_option(op, option_filename);

  gt_option_exclude(op_seed_extend, op_sortmatches);
  gt_option_exclude(op_relax_polish, op_seed_extend);
  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;
}
示例#17
0
static GtIndexOptions*
gt_index_options_register_generic_output(GtOptionParser *op,
                                         GtIndexOptions *idxo,
                                         GtStr *indexname,
                                         GtEncseqOptions *encopts)
{
  gt_assert(idxo != NULL);
  gt_assert(op != NULL && idxo->type != GT_INDEX_OPTIONS_UNDEFINED &&
            encopts != NULL);
  idxo->encopts = encopts;
  idxo->indexname = indexname != NULL ? gt_str_ref(indexname) : NULL;
  idxo->optionkys = gt_option_new_string("kys",
                                   "output/sort according to keys of the form "
                                   "|key| in fasta header",
                                   idxo->kysargumentstring,
                                   "nosort");
  gt_option_argument_is_optional(idxo->optionkys);
  gt_option_imply(idxo->optionkys, gt_encseq_options_sds_option(idxo->encopts));
  gt_option_parser_add_option(op, idxo->optionkys);

  gt_encseq_options_add_readmode_option(op, idxo->dir);

  if (idxo->type == GT_INDEX_OPTIONS_ESA)
  {
    idxo->optionoutsuftab = gt_option_new_bool("suf",
                                   "output suffix array (suftab) to file",
                                   &idxo->outsuftab,
                                   false);
    gt_option_parser_add_option(op, idxo->optionoutsuftab);

    idxo->optionoutlcptab = gt_option_new_bool("lcp",
                                   "output lcp table (lcptab) to file",
                                   &idxo->outlcptab,
                                   false);
    gt_option_parser_add_option(op, idxo->optionoutlcptab);

    idxo->option = gt_option_new_bool("lcpdist",
                              "output distributions of values in lcptab",
                              &idxo->lcpdist,
                              false);
    gt_option_is_extended_option(idxo->option);
    gt_option_imply(idxo->option, idxo->optionoutlcptab);
    gt_option_parser_add_option(op, idxo->option);

    idxo->option = gt_option_new_bool("swallow-tail",
                              "swallow the tail of the suffix array and lcptab",
                              &idxo->swallow_tail,
                              false);
    gt_option_is_development_option(idxo->option);
    gt_option_parser_add_option(op, idxo->option);

    idxo->optionoutbwttab = gt_option_new_bool("bwt",
                                   "output Burrows-Wheeler Transformation "
                                   "(bwttab) to file",
                                   &idxo->outbwttab,
                                   false);
    gt_option_exclude(idxo->optionspmopt, idxo->optionoutbwttab);
    gt_option_parser_add_option(op, idxo->optionoutbwttab);

    idxo->optionoutbcktab = gt_option_new_bool("bck",
                                "output bucket table to file",
                                &idxo->outbcktab,
                                false);
    gt_option_parser_add_option(op, idxo->optionoutbcktab);
  } else {
    idxo->optionoutsuftab
      = idxo->optionoutlcptab = idxo->optionoutbwttab = NULL;
    idxo->sfxstrategy.spmopt_minlength = 0;
#ifndef S_SPLINT_S
    gt_registerPackedIndexOptions(op,
                                  &idxo->bwtIdxParams,
                                  BWTDEFOPT_CONSTRUCTION,
                                  idxo->indexname);
#endif
  }

  gt_option_parser_register_hook(op, gt_index_options_check_set_out_opts, idxo);

  return idxo;
}
示例#18
0
static GtOptionParser* gt_sketch_option_parser_new(void *tool_arguments)
{
  GtSketchArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *option, *option2;
  static const char *formats[] = { "png",
#ifdef CAIRO_HAS_PDF_SURFACE
    "pdf",
#endif
#ifdef CAIRO_HAS_SVG_SURFACE
    "svg",
#endif
#ifdef CAIRO_HAS_PS_SURFACE
    "ps",
#endif
    NULL
  };
  static const char *inputs[] = {
    "gff",
    "bed",
    "gtf",
    NULL
  };
  gt_assert(arguments);

  /* init */
  op = gt_option_parser_new("[option ...] image_file [GFF3_file ...]",
                            "Create graphical representation of GFF3 "
                            "annotation files.");

  /* -pipe */
  option = gt_option_new_bool("pipe", "use pipe mode (i.e., show all gff3 "
                              "features on stdout)", &arguments->pipe, false);
  gt_option_parser_add_option(op, option);

  /* -flattenfiles */
  option = gt_option_new_bool("flattenfiles", "do not group tracks by source "
                              "file name and remove file names from track "
                              "description", &arguments->flattenfiles, false);
  gt_option_parser_add_option(op, option);

  /* -seqid */
  option = gt_option_new_string("seqid", "sequence region identifier\n"
                                      "default: first one in file",
                            arguments->seqid, NULL);
  gt_option_parser_add_option(op, option);
  gt_option_hide_default(option);

  /* -start */
  option = gt_option_new_uword_min("start", "start position\n"
                                         "default: first region start",
                            &arguments->start, GT_UNDEF_UWORD, 1);
  gt_option_parser_add_option(op, option);
  gt_option_hide_default(option);

  /* -end */
  option2 = gt_option_new_uword("end", "end position\ndefault: last region end",
                            &arguments->end, GT_UNDEF_UWORD);
  gt_option_parser_add_option(op, option2);
  /* -start and -end must be given together */
  gt_option_imply(option, option2);
  gt_option_imply(option2, option);
  gt_option_hide_default(option2);

  /* -width */
  option = gt_option_new_uint_min("width", "target image width (in pixel)",
                                  &arguments->width,
                                  800, 1);
  gt_option_parser_add_option(op, option);

  /* -style */
  option = gt_option_new_string("style", "style file to use",
                                arguments->stylefile,
                                gt_str_get(arguments->stylefile));
  gt_option_parser_add_option(op, option);

  /* -format */
  option = gt_option_new_choice("format", "output graphics format\n"
                                       "choose from png"
#ifdef CAIRO_HAS_PDF_SURFACE
                                       "|pdf"
#endif
#ifdef CAIRO_HAS_SVG_SURFACE
                                       "|svg"
#endif
#ifdef CAIRO_HAS_PS_SURFACE
                                       "|ps"
#endif
                                       "",
                             arguments->format, formats[0], formats);
  gt_option_parser_add_option(op, option);

  /* -input */
  option = gt_option_new_choice("input", "input data format\n"
                                       "choose from gff|bed|gtf",
                             arguments->input, inputs[0], inputs);
  gt_option_parser_add_option(op, option);

  /* -addintrons */
  option = gt_option_new_bool("addintrons", "add intron features between "
                              "existing exon features (before drawing)",
                              &arguments->addintrons, false);
  gt_option_parser_add_option(op, option);

    /* -unsafe */
  option = gt_option_new_bool("unsafe", "enable unsafe mode for style file",
                              &arguments->unsafe, false);
  gt_option_parser_add_option(op, option);

  /* -showrecmaps */
  option = gt_option_new_bool("showrecmaps",
                              "show RecMaps after image creation",
                              &arguments->showrecmaps, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -streams */
  option = gt_option_new_bool("streams", "use streams to write data to file",
                              &arguments->use_streams, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -v */
  option = gt_option_new_verbose(&arguments->verbose);
  gt_option_parser_add_option(op, option);

  /* -force */
  option = gt_option_new_bool(GT_FORCE_OPT_CSTR, "force writing to output file",
                              &arguments->force, false);
  gt_option_parser_add_option(op, option);

  gt_option_parser_set_min_args(op, 1);

  return op;
}
示例#19
0
static GtOptionParser* gt_seed_extend_option_parser_new(void *tool_arguments)
{
  GtSeedExtendArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *option, *op_gre, *op_xdr, *op_cam, *op_his, *op_dif, *op_pmh,
    *op_len, *op_err, *op_xbe, *op_sup, *op_frq, *op_mem, *op_ali, *op_bia;
  gt_assert(arguments != NULL);

  /* init */
  op = gt_option_parser_new("[option ...] encseq_basename [encseq_basename]",
                            "Calculate local alignments using the seed and "
                            "extend algorithm.");

  /* DIAGBANDSEED OPTIONS */

  /* -ii */
  option = gt_option_new_string("ii",
                                "Input index for encseq encoded sequences",
                                arguments->dbs_indexname,
                                "");
  gt_option_is_mandatory(option);
  gt_option_parser_add_option(op, option);

  /* -qii */
  option = gt_option_new_string("qii",
                                "Query input index (encseq)",
                                arguments->dbs_queryname,
                                "");
  gt_option_parser_add_option(op, option);

  /* -seedlength */
  op_len = gt_option_new_uint_min_max("seedlength",
                                      "Minimum length of a seed",
                                      &arguments->dbs_seedlength,
                                      14UL, 1UL, 32UL);
  gt_option_parser_add_option(op, op_len);

  /* -diagbandwidth */
  option = gt_option_new_uword("diagbandwidth",
                               "Logarithm of diagonal band width (for filter)",
                               &arguments->dbs_logdiagbandwidth,
                               6UL);
  gt_option_parser_add_option(op, option);

  /* -mincoverage */
  option = gt_option_new_uword("mincoverage",
                               "Minimum coverage in two neighbouring diagonal "
                               "bands (for filter)",
                               &arguments->dbs_mincoverage,
                               35UL);
  gt_option_parser_add_option(op, option);

  /* -maxfreq */
  op_frq = gt_option_new_uword_min("maxfreq",
                                   "Maximum frequency of a k-mer (for filter)",
                                   &arguments->dbs_maxfreq,
                                   GT_UWORD_MAX, 1UL);
  gt_option_parser_add_option(op, op_frq);

  /* -t */
  op_sup = gt_option_new_uword_min("t",
                                   "Suppress k-mers occurring at least t times "
                                   "(for filter)",
                                   &arguments->dbs_suppress,
                                   GT_UWORD_MAX, 2UL);
  gt_option_exclude(op_sup, op_frq);
  gt_option_is_development_option(op_sup);
  gt_option_parser_add_option(op, op_sup);

  /* -memlimit */
  op_mem = gt_option_new_string("memlimit",
                                "Maximum memory usage to determine the maximum "
                                "frequency of a k-mer (for filter)",
                                arguments->dbs_memlimit_str,
                                "");
  gt_option_parser_add_option(op, op_mem);

  /* -debug-kmer */
  option = gt_option_new_bool("debug-kmer",
                              "Output KmerPos lists",
                              &arguments->dbs_debug_kmer,
                              false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -debug-seedpair */
  option = gt_option_new_bool("debug-seedpair",
                              "Output SeedPair lists",
                              &arguments->dbs_debug_seedpair,
                              false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -verify */
  option = gt_option_new_bool("verify",
                              "Check that k-mer seeds occur in the sequences",
                              &arguments->dbs_verify,
                              false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* SEED EXTENSION OPTIONS */

  /* -extendxdrop */
  op_xdr = gt_option_new_uword_min_max("extendxdrop",
                                       "Extend seed to both sides using xdrop "
                                       "algorithm, optional parameter "
                                       "specifies sensitivity",
                                       &arguments->se_extendxdrop,
                                       97UL, 90UL, 100UL);
  gt_option_argument_is_optional(op_xdr);
  gt_option_parser_add_option(op, op_xdr);
  arguments->se_option_xdrop = gt_option_ref(op_xdr);

  /* -xdropbelow */
  op_xbe = gt_option_new_word("xdropbelow",
                              "Specify xdrop cutoff score (0 means "
                              "automatically defined depending on minidentity)",
                              &arguments->se_xdropbelowscore,
                              0L);
  gt_option_imply(op_xbe, op_xdr);
  gt_option_parser_add_option(op, op_xbe);

  /* -extendgreedy */
  op_gre = gt_option_new_uword_min_max("extendgreedy",
                                       "Extend seed to both sides using greedy "
                                       "algorithm, optional parameter "
                                       "specifies sensitivity",
                                       &arguments->se_extendgreedy,
                                       97UL, 90UL, 100UL);
  gt_option_argument_is_optional(op_gre);
  gt_option_exclude(op_gre, op_xdr);
  gt_option_parser_add_option(op, op_gre);
  arguments->se_option_greedy = gt_option_ref(op_gre);

  /* -history */
  op_his = gt_option_new_uword_min_max("history",
                                       "Size of (mis)match history in range [1"
                                       "..64] (trimming for greedy extension)",
                                       &arguments->se_historysize,
                                       60UL, 1UL, 64UL);
  gt_option_imply(op_his, op_gre);
  gt_option_parser_add_option(op, op_his);

  /* -maxalilendiff */
  op_dif = gt_option_new_uword("maxalilendiff",
                               "Maximum difference of alignment length "
                               "(trimming for greedy extension)",
                               &arguments->se_maxalilendiff, 0UL);
  gt_option_imply(op_dif, op_gre);
  gt_option_is_development_option(op_dif);
  gt_option_parser_add_option(op, op_dif);

  /* -percmathistory */
  op_pmh = gt_option_new_uword_min_max("percmathistory",
                                       "percentage of matches required in "
                                       "history (for greedy extension)",
                                       &arguments->se_perc_match_hist,
                                       0UL, 1UL, 100UL);
  gt_option_imply(op_pmh, op_gre);
  gt_option_is_development_option(op_pmh);
  gt_option_parser_add_option(op, op_pmh);

  /* -bias-parameters */
  op_bia = gt_option_new_bool("bias-parameters",
                              "Use -maxalilendiff 30 and let percmathistory "
                              "depend on minidentiy and DNA base distribution",
                              &arguments->bias_parameters,
                              false);
  gt_option_imply(op_bia, op_gre);
  gt_option_exclude(op_bia, op_pmh);
  gt_option_exclude(op_bia, op_dif);
  gt_option_is_development_option(op_bia);
  gt_option_parser_add_option(op, op_bia);

  /* -cam */
  op_cam = gt_option_new_string("cam",
                                gt_cam_extendgreedy_comment(),
                                arguments->se_char_access_mode,
                                "");
  gt_option_is_development_option(op_cam);
  gt_option_parser_add_option(op, op_cam);

  /* -l */
  op_len = gt_option_new_uword_min("l",
                                   "Minimum alignment length "
                                   "(for seed extension)",
                                   &arguments->se_alignlength,
                                   20UL, 1UL);
  gt_option_imply_either_2(op_len, op_xdr, op_gre);
  gt_option_parser_add_option(op, op_len);

  /* -minidentity */
  op_err = gt_option_new_uword_min_max("minidentity",
                                       "Minimum identity of matches "
                                       "(for seed extension)",
                                       &arguments->se_minidentity,
                                       80UL, GT_EXTEND_MIN_IDENTITY_PERCENTAGE,
                                       99UL);
  gt_option_imply_either_2(op_err, op_xdr, op_gre);
  gt_option_parser_add_option(op, op_err);

  /* -a */
  op_ali = gt_option_new_uword_min("a",
                                   "show alignments/sequences (optional "
                                   "argument is number of columns per line)",
                                   &arguments->se_alignmentwidth,
                                   70, 20);
  gt_option_argument_is_optional(op_ali);
  gt_option_parser_add_option(op, op_ali);
  arguments->se_option_withali = gt_option_ref(op_ali);

  /* -mirror */
  option = gt_option_new_bool("mirror",
                              "Add reverse complement reads",
                              &arguments->mirror,
                              false);
  gt_option_parser_add_option(op, option);

  /* -overlappingseeds */
  option = gt_option_new_bool("overlappingseeds",
                              "Allow overlapping SeedPairs",
                              &arguments->overlappingseeds,
                              false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -benchmark */
  option = gt_option_new_bool("benchmark",
                              "Measure total running time and be silent",
                              &arguments->benchmark,
                              false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -seed-display */
  option = gt_option_new_bool("seed-display",
                              "Display seeds in #-line",
                              &arguments->seed_display,
                              false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -v */
  option = gt_option_new_verbose(&arguments->verbose);
  gt_option_parser_add_option(op, option);

  return op;
}
示例#20
0
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;
}
示例#21
0
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;
}
示例#22
0
static GtOptionParser* gt_eval_option_parser_new(void *tool_arguments)
{
  EvalArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *option, *ltroption, *ltrdeltaoption;
  gt_assert(arguments);

  op = gt_option_parser_new("reference_file prediction_file ",
                            "Compare annotation files and show "
                            "accuracy measures (prediction vs. reference).");

  /* -exondiff */
  option = gt_option_new_bool("exondiff", "show a diff for the exons",
                              &arguments->exondiff, false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -exondiffcollapsed */
  option = gt_option_new_bool("exondiffcollapsed", "show a diff for the "
                              "collapsed exons", &arguments->exondiffcollapsed,
                              false);
  gt_option_is_development_option(option);
  gt_option_parser_add_option(op, option);

  /* -nuc */
  option = gt_option_new_bool("nuc",
                              "evaluate nucleotide level (memory consumption "
                              "is proportional to the input file sizes)",
                              &arguments->nuceval, true);
  gt_option_parser_add_option(op, option);

  /* -ltr */
  ltroption = gt_option_new_bool("ltr", "evaluate a LTR retrotransposon "
                                 "prediction instead of a gene prediction\n"
                                 "(all LTR_retrotransposon elements are "
                                 "considered to have an undetermined strand)",
                                 &arguments->evalLTR, false);
  gt_option_parser_add_option(op, ltroption);

  /* -ltrdelta */
  ltrdeltaoption = gt_option_new_uword("ltrdelta", "set allowed delta for LTR "
                                       "borders to be considered equal",
                                       &arguments->LTRdelta, 20);
  gt_option_parser_add_option(op, ltrdeltaoption);

  /* -v */
  option = gt_option_new_verbose(&arguments->verbose);
  gt_option_parser_add_option(op, option);

  /* output file options */
  gt_output_file_info_register_options(arguments->ofi, op, &arguments->outfp);

  /* option implications */
  gt_option_imply(ltrdeltaoption, ltroption);

  /* set comment function */
  gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL);

  /* set minimum and maximum number of arguments */
  gt_option_parser_set_min_max_args(op, 2, 2);

  return op;
}