Exemplo n.º 1
0
def _run_config_parser(argv):
    '''Helper class for optparse.OptionParser
    allows reading from and writing to a config file '''
    per_host_cfg = PerHostConfig("epiPALEOMIX")
    usage_str = "%prog <command> [options] [makefiles]"
    version_str  = "%%prog %s" % (__version__,)
    parser = optparse.OptionParser(usage = __foreword__ + "\n" + usage_str,
                                   version = version_str,
                                   description = __description__,
                                   epilog = __epilog__,
                                   formatter=EpiPaleomixIndentHelper(),
                                   prog="epiPALEOMIX")

    pypeline.ui.add_optiongroup(parser,
                                ui_default=PerHostValue("quiet"),
                                color_default=PerHostValue("on"))
    pypeline.logger.add_optiongroup(parser, default = PerHostValue("warning"))

    parser.add_option("--max-threads", type = int, default = per_host_cfg.max_threads,
                     help = "Maximum number of threads to use in total [%default]")
    parser.add_option("--dry-run", action = "store_true", default = False,
                     help = "If passed, only a dry-run in performed, the dependency "
                     "tree is printed, and no tasks are executed.")
    parser.add_option("--temp-root", default = per_host_cfg.temp_root,
                     help = "Location for temporary files and folders [%default/]")
    parser.add_option("--destination", default = './',
                     help = "The destination folder for result files. By default, "
                     "files will be placed in ./OUT_{makefile name}/")
    parser.add_option("--list-output-files", action = "store_true", default = False,
                     help = "List all files generated by pipeline for the makefile(s).")
    parser.add_option("--list-executables", action="store_true", default=False,
                     help="List all executables required by the pipeline, "
                     "with version requirements (if any).")

    return per_host_cfg.parse_args(parser, argv)
Exemplo n.º 2
0
def _run_config_parser(argv):
    per_host_cfg = PerHostConfig("phylo_pipeline")
    usage_str = "%prog <command> [options] [makefiles]"
    version_str = "%%prog %s" % (pypeline.__version__, )
    parser = optparse.OptionParser(usage=usage_str, version=version_str)
    parser.formatter = CustomHelpFormatter()
    parser.formatter.set_parser(parser)
    parser.description = _DESCRIPTION

    pypeline.ui.add_optiongroup(parser,
                                ui_default=PerHostValue("quiet"),
                                color_default=PerHostValue("on"))
    pypeline.logger.add_optiongroup(parser, default=PerHostValue("warning"))

    group = optparse.OptionGroup(parser, "Scheduling")
    group.add_option(
        "--samtools-max-threads",
        default=PerHostValue(1),
        type=int,
        help=
        "Maximum number of threads to use when genotyping or building pileups [%default]"
    )
    group.add_option(
        "--examl-max-threads",
        default=PerHostValue(1),
        type=int,
        help=
        "Maximum number of threads to use for each instance of ExaML [%default]"
    )
    group.add_option(
        "--max-threads",
        default=per_host_cfg.max_threads,
        type=int,
        help="Maximum number of threads to use in total [%default]")
    group.add_option(
        "--dry-run",
        default=False,
        action="store_true",
        help=
        "If passed, only a dry-run in performed, the dependency tree is printed, "
        "and no tasks are executed.")
    parser.add_option_group(group)

    group = optparse.OptionGroup(parser, "Required paths")
    group.add_option(
        "--temp-root",
        default=per_host_cfg.temp_root,
        help="Location for temporary files and folders [%default]")
    group.add_option("--samples-root",
                     default=PerHostValue("./data/samples", is_path=True),
                     help="Location of BAM files for each sample [%default]")
    group.add_option(
        "--regions-root",
        default=PerHostValue("./data/regions", is_path=True),
        help="Location of BED files containing regions of interest [%default]")
    group.add_option("--prefix-root",
                     default=PerHostValue("./data/prefixes", is_path=True),
                     help="Location of prefixes (FASTAs) [%default]")
    group.add_option(
        "--refseq-root",
        default=PerHostValue("./data/refseqs", is_path=True),
        help="Location of reference sequences (FASTAs) [%default]")
    group.add_option("--destination",
                     default="./results",
                     help="The destination folder for result files [%default]")
    parser.add_option_group(group)

    group = optparse.OptionGroup(parser, "Files and executables")
    group.add_option(
        "--list-output-files",
        action="store_true",
        default=False,
        help="List all files generated by pipeline for the makefile(s).")
    group.add_option("--list-orphan-files", action = "store_true", default = False,
                     help = "List all files at destination not generated by the pipeline. " \
                            "Useful for cleaning up after making changes to a makefile.")
    group.add_option("--list-executables",
                     action="store_true",
                     default=False,
                     help="List all executables required by the pipeline, "
                     "with version requirements (if any).")
    parser.add_option_group(group)

    return per_host_cfg.parse_args(parser, argv)
Exemplo n.º 3
0
def _run_config_parser(argv):
    per_host_cfg = PerHostConfig("bam_pipeline")

    usage_str = "%prog <command> [options] [makefiles]"
    version_str = "%%prog %s" % (pypeline.__version__, )
    parser = optparse.OptionParser(usage=usage_str, version=version_str)
    parser.add_option("--allow-missing-input-files", action = "store_true", default = False,
                      help = "Allow processing of lanes, even if the original input files are no-longer " \
                             "accesible, if for example a network drive is down. This option should be " \
                             "used with care!")

    pypeline.ui.add_optiongroup(parser,
                                ui_default=PerHostValue("quiet"),
                                color_default=PerHostValue("on"))
    pypeline.logger.add_optiongroup(parser, default=PerHostValue("warning"))

    group = optparse.OptionGroup(parser, "Scheduling")
    group.add_option(
        "--bowtie2-max-threads",
        type=int,
        default=PerHostValue(1),
        help="Maximum number of threads to use per BWA instance [%default]")
    group.add_option(
        "--bwa-max-threads",
        type=int,
        default=PerHostValue(1),
        help="Maximum number of threads to use per BWA instance [%default]")
    group.add_option(
        "--max-threads",
        type=int,
        default=per_host_cfg.max_threads,
        help="Maximum number of threads to use in total [%default]")
    group.add_option(
        "--dry-run",
        action="store_true",
        default=False,
        help="If passed, only a dry-run in performed, the dependency "
        "tree is printed, and no tasks are executed.")
    parser.add_option_group(group)

    group = optparse.OptionGroup(parser, "Required paths")
    group.add_option("--jar-root", default = PerHostValue("~/install/jar_root", is_path = True),
                     help = "Folder containing Picard JARs (http://picard.sf.net), " \
                            "and GATK (www.broadinstitute.org/gatk). " \
                            "The latter is only required if realigning is enabled. " \
                            "[%default]")
    group.add_option(
        "--temp-root",
        default=per_host_cfg.temp_root,
        help="Location for temporary files and folders [%default/]")
    group.add_option(
        "--destination",
        default=None,
        help=
        "The destination folder for result files. By default, files will be "
        "placed in the same folder as the makefile which generated it.")
    parser.add_option_group(group)

    group = optparse.OptionGroup(parser, "Files and executables")
    group.add_option(
        "--list-output-files",
        action="store_true",
        default=False,
        help="List all files generated by pipeline for the makefile(s).")
    group.add_option("--list-orphan-files", action = "store_true", default = False,
                     help = "List all files at destination not generated by the pipeline. " \
                            "Useful for cleaning up after making changes to a makefile.")
    group.add_option("--list-executables",
                     action="store_true",
                     default=False,
                     help="List all executables required by the pipeline, "
                     "with version requirements (if any).")
    parser.add_option_group(group)

    group = optparse.OptionGroup(parser, "Targets")
    group.add_option(
        "--target",
        dest="targets",
        action="append",
        default=[],
        help="Only execute nodes required to build specified target.")
    group.add_option("--list-targets", default = None, choices = _TARGETS_BY_NAME,
                     help = "List all targets at a given resolution (%s)" \
                        % (", ".join(_TARGETS_BY_NAME),))
    parser.add_option_group(group)

    group = optparse.OptionGroup(parser, "Misc")
    group.add_option(
        "--jre-option",
        dest="jre_options",
        action="append",
        default=PerHostValue([]),
        help="May be specified one or more times with options to be passed "
        "tot the JRE (Jave Runtime Environment); e.g. to change the "
        "maximum amount of memory (default is -Xmx4g)")
    parser.add_option_group(group)

    return per_host_cfg.parse_args(parser, argv)