示例#1
0
static GtOptionParser* gt_extractfeat_option_parser_new(void *tool_arguments)
{
  GtExtractFeatArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *option;
  gt_assert(arguments);

  op = gt_option_parser_new("[option ...] [GFF3_file]",
                            "Extract features given in GFF3 file from "
                            "sequence file.");

  /* -type */
  option = gt_option_new_string("type", "set type of features to extract",
                                arguments->type, NULL);
  gt_option_is_mandatory(option);
  gt_option_parser_add_option(op, option);

  /* -join */
  option = gt_option_new_bool("join", "join feature sequences in the same "
                              "subgraph into a single one", &arguments->join,
                              false);
  gt_option_parser_add_option(op, option);

  /* -translate */
  option = gt_option_new_bool("translate", "translate the features (of a DNA "
                              "sequence) into protein", &arguments->translate,
                              false);
  gt_option_parser_add_option(op, option);

  /* -seqid */
  option = gt_option_new_bool("seqid", "add sequence ID of extracted features "
                              "to FASTA descriptions", &arguments->seqid,
                              false);
  gt_option_parser_add_option(op, option);

  /* -target */
  option = gt_option_new_bool("target", "add target ID(s) of extracted "
                              "features to FASTA descriptions",
                              &arguments->target, false);
  gt_option_parser_add_option(op, option);

  /* -seqfile, -matchdesc, -usedesc and -regionmapping */
  gt_seqid2file_register_options(op, arguments->s2fi);

  /* -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);

  gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL);
  gt_option_parser_set_max_args(op, 1);

  return op;
}
示例#2
0
static GtOptionParser* gt_seqtransform_option_parser_new(void *tool_arguments)
{
  SeqtransformArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *o;
  gt_assert(arguments);
  op = gt_option_parser_new("[option ...] [sequence_file ...]",
                            "Perform simple transformations on the given "
                            "sequence file(s).");

  /* -addstopaminos */
  o = gt_option_new_bool("addstopaminos", "append stop amino acids ('"
                         GT_STOP_AMINO_CSTR"') to given protein sequences, if "
                         "not already present", &arguments->addstopaminos,
                         false);
  gt_option_parser_add_option(op, o);

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

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

  return op;
}
示例#3
0
static GtOptionParser* gt_seqfilter_option_parser_new(void *tool_arguments)
{
  SeqFilterArguments *arguments = tool_arguments;
  GtOption *option;
  GtOptionParser *op;
  gt_assert(arguments);

  op = gt_option_parser_new("[option ...] [sequence_file ...]",
                            "Filter the given sequence file(s) and show the "
                            "results on stdout.");

  /* -minlength */
  option = gt_option_new_uword("minlength",
                               "set minimum length a sequence must "
                               "have to pass the filter", &arguments->minlength,
                               GT_UNDEF_UWORD);
  gt_option_parser_add_option(op, option);

  /* -maxlength */
  option = gt_option_new_uword("maxlength", "set maximum length a sequence can "
                               "have to pass the filter", &arguments->maxlength,
                               GT_UNDEF_UWORD);
  gt_option_parser_add_option(op, option);

  /* -maxseqnum */
  option = gt_option_new_uword("maxseqnum", "set the maximum number of "
                               "sequences which can pass the filter",
                               &arguments->maxseqnum, GT_UNDEF_UWORD);
  gt_option_parser_add_option(op, option);

  /* -sample */
  option = gt_option_new_double_min_max("sample", "set a probability for each "
                                        "sequence to pass the filter",
                                        &arguments->sample_prob,
                                        SEQFILTER_DEF_PROB,
                                        SEQFILTER_MIN_PROB,
                                        SEQFILTER_MAX_PROB);
  gt_option_parser_add_option(op, option);

  /* -step */
  option = gt_option_new_uword_min("step", "only every 'step'-th sequence "
                                   "passes the filter",
                                   &arguments->step,
                                   SEQFILTER_DEF_STEP,
                                   SEQFILTER_MIN_STEP);
  gt_option_parser_add_option(op, option);

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

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

  return op;
}
示例#4
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;
}
示例#5
0
static GtOptionParser* gt_splitfasta_option_parser_new(void *tool_arguments)
{
  SplitfastaArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *targetsize_option, *splitdesc_option, *o, *numfiles_option;
  gt_assert(arguments);
  op = gt_option_parser_new("[option ...] fastafile","Split the supplied fasta "
                         "file.");

  numfiles_option = gt_option_new_uint_min("numfiles",
                                           "set the number of target files "
                                           "",
                                           &arguments->num_files, 0,
                                           1);
  gt_option_parser_add_option(op, numfiles_option);

  targetsize_option = gt_option_new_ulong_min("targetsize",
                                              "set the target file "
                                              "size in MB",
                                              &arguments->max_filesize_in_MB,
                                              50, 1);
  gt_option_parser_add_option(op, targetsize_option);
  splitdesc_option = gt_option_new_string("splitdesc",
                                          "put every fasta entry in "
                                          "a separate file named by its "
                                          "description in the given directory",
                                          arguments->splitdesc, NULL);
  gt_option_parser_add_option(op, splitdesc_option);
  gt_option_exclude(targetsize_option, splitdesc_option);
  gt_option_exclude(numfiles_option, splitdesc_option);
  gt_option_exclude(numfiles_option, targetsize_option);
  o = gt_option_new_width(&arguments->width);
  gt_option_parser_add_option(op, o);
  o = gt_option_new_bool(GT_FORCE_OPT_CSTR, "force writing to output file",
                         &arguments->force, false);
  gt_option_parser_add_option(op, o);
  gt_option_parser_set_min_max_args(op, 1, 1);
  return op;
}
示例#6
0
static GtOptionParser* gt_seqfilter_option_parser_new(void *tool_arguments)
{
  SeqFilterArguments *arguments = tool_arguments;
  GtOption *option;
  GtOptionParser *op;
  gt_assert(arguments);

  op = gt_option_parser_new("[option ...] [sequence_file ...]",
                            "Filter the given sequence_file(s) and show the "
                            "results on stdout.");

  /* -minlength */
  option = gt_option_new_ulong("minlength",
                               "set minimum length a sequence must "
                               "have to pass the filter", &arguments->minlength,
                               GT_UNDEF_ULONG);
  gt_option_parser_add_option(op, option);

  /* -maxlength */
  option = gt_option_new_ulong("maxlength", "set maximum length a sequence can "
                               "have to pass the filter", &arguments->maxlength,
                               GT_UNDEF_ULONG);
  gt_option_parser_add_option(op, option);

  /* -maxseqnum */
  option = gt_option_new_ulong("maxseqnum", "set the maximum number of "
                               "sequences which can pass the filter",
                               &arguments->maxseqnum, GT_UNDEF_ULONG);
  gt_option_parser_add_option(op, option);

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

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

  return op;
}
示例#7
0
static GtOptionParser* gt_seqmutate_option_parser_new(void *tool_arguments)
{
  MutateArguments *arguments = tool_arguments;
  GtOptionParser *op;
  GtOption *o;
  gt_assert(arguments);
  op = gt_option_parser_new("[option ...] [sequence_file ...]",
                            "Mutate the sequences of the given sequence "
                            "file(s).");
  /* -rate */
  o = gt_option_new_uint_max("rate", "set the mutation rate", &arguments->rate,
                             1, 100);
  gt_option_parser_add_option(op, o);

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

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

  gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL);

  return op;
}
示例#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_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;
}
示例#10
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;
}