Exemplo n.º 1
0
    kwargs["config_file"] = global_config
    kwargs["fc_dir"] = fc_dir
    kwargs["run_info_yaml"] = run_info_yaml
    return kwargs


if __name__ == "__main__":
    kwargs = parse_cl_args(sys.argv[1:])
    if "upgrade" in kwargs and kwargs["upgrade"]:
        install.upgrade_bcbio(kwargs["args"])
    elif "server" in kwargs and kwargs["server"]:
        server_main.start(kwargs["args"])
    elif "runfn" in kwargs and kwargs["runfn"]:
        runfn.process(kwargs["args"])
    elif "graph" in kwargs and kwargs["graph"]:
        graph.bootstrap(kwargs["args"])
    elif "version" in kwargs and kwargs["version"]:
        programs.write_versions({"work": kwargs["args"].workdir})
    elif "sequencer" in kwargs and kwargs["sequencer"]:
        machine.check_and_postprocess(kwargs["args"])
    else:
        if kwargs.get("workflow"):
            setup_info = workflow.setup(kwargs["workflow"],
                                        kwargs.pop("inputs"))
            if setup_info is None:  # no automated run after setup
                sys.exit(0)
            workdir, new_kwargs = setup_info
            os.chdir(workdir)
            kwargs.update(new_kwargs)
        main(**kwargs)
Exemplo n.º 2
0
    if kwargs.get("workflow"):
        kwargs["inputs"] = inputs
    kwargs["config_file"] = global_config
    kwargs["fc_dir"] = fc_dir
    kwargs["run_info_yaml"] = run_info_yaml
    return kwargs

if __name__ == "__main__":
    kwargs = parse_cl_args(sys.argv[1:])
    if "upgrade" in kwargs and kwargs["upgrade"]:
        install.upgrade_bcbio(kwargs["args"])
    elif "server" in kwargs and kwargs["server"]:
        server_main.start(kwargs["args"])
    elif "runfn" in kwargs and kwargs["runfn"]:
        runfn.process(kwargs["args"])
    elif "graph" in kwargs and kwargs["graph"]:
        graph.bootstrap(kwargs["args"])
    elif "version" in kwargs and kwargs["version"]:
        programs.write_versions({"work": kwargs["args"].workdir})
    elif "sequencer" in kwargs and kwargs["sequencer"]:
        machine.check_and_postprocess(kwargs["args"])
    else:
        if kwargs.get("workflow"):
            setup_info = workflow.setup(kwargs["workflow"], kwargs.pop("inputs"))
            if setup_info is None:  # no automated run after setup
                sys.exit(0)
            workdir, new_kwargs = setup_info
            os.chdir(workdir)
            kwargs.update(new_kwargs)
        main(**kwargs)
Exemplo n.º 3
0
            if paralleltype is None:
                paralleltype = config_cores
    if paralleltype is None:
        paralleltype = "local"
    if numcores is None:
        numcores = 1
    return paralleltype, int(numcores)

def _needed_workers(run_info):
    """Determine workers needed to run multiplex flowcells in parallel.
    """
    names = []
    for xs in run_info["details"]:
        for x in xs:
            names.append(x.get("name", (x["lane"], x["barcode_id"])))
    return len(set(names))

if __name__ == "__main__":
    kwargs = parse_cl_args(sys.argv[1:])
    if kwargs["upgrade"]:
        install.upgrade_bcbio(kwargs["args"])
    else:
        if kwargs["workflow"]:
            setup_info = workflow.setup(kwargs["workflow"], kwargs["inputs"])
            if setup_info is None: # no automated run after setup
                sys.exit(0)
            workdir, new_kwargs = setup_info
            os.chdir(workdir)
            kwargs.update(new_kwargs)
        main(**kwargs)
Exemplo n.º 4
0
                numcores = 1
            else:
                numcores = _needed_workers(
                    get_run_info(fc_dir, config, run_info_yaml)[-1])
    return paralleltype, int(numcores)


def _needed_workers(run_info):
    """Determine workers needed to run multiplex flowcells in parallel.
    """
    names = []
    for xs in run_info["details"]:
        for x in xs:
            names.append(x.get("name", (x["lane"], x["barcode_id"])))
    return len(set(names))


if __name__ == "__main__":
    kwargs = parse_cl_args(sys.argv[1:])
    if kwargs["upgrade"]:
        install.upgrade_bcbio(kwargs["args"])
    else:
        if kwargs["workflow"]:
            setup_info = workflow.setup(kwargs["workflow"], kwargs["inputs"])
            if setup_info is None:  # no automated run after setup
                sys.exit(0)
            workdir, new_kwargs = setup_info
            os.chdir(workdir)
            kwargs.update(new_kwargs)
        main(**kwargs)
Exemplo n.º 5
0
    for xs in run_info["details"]:
        for x in xs:
            names.append(x.get("name", (x["lane"], x["barcode_id"])))
    return len(set(names))

def _upgrade_bcbio(method):
    """Perform upgrade of bcbio to latest release, or from GitHub development version.
    """
    url = "https://raw.github.com/chapmanb/bcbio-nextgen/master/requirements.txt"
    git_repo = "git://github.com/chapmanb/bcbio-nextgen.git"
    pip_bin = os.path.join(os.path.dirname(sys.executable), "pip")
    if method in ["stable", "system"]:
        sudo_cmd = [] if method == "stable" else ["sudo"]
        subprocess.check_call(sudo_cmd + [pip_bin, "install", "--upgrade", "distribute"])
        subprocess.check_call(sudo_cmd + [pip_bin, "install", "-r", url])
    else:
        subprocess.check_call([pip_bin, "install", "--upgrade",
                               "git+%s#egg=bcbio-nextgen" % git_repo])

if __name__ == "__main__":
    config_file, kwargs = parse_cl_args(sys.argv[1:])
    kwargs["config_file"] = config_file
    if kwargs["upgrade"] and config_file is None:
        _upgrade_bcbio(kwargs["upgrade"])
    else:
        if kwargs["workflow"]:
            workdir, new_kwargs = workflow.setup(kwargs["workflow"], kwargs["inputs"])
            os.chdir(workdir)
            kwargs.update(new_kwargs)
        main(**kwargs)
Exemplo n.º 6
0
    """
    if "scheduler" in args and "queue" in args:
        if args.scheduler and not args.queue:
            if args.scheduler != "sge":
                return "IPython parallel scheduler (-s) specified. This also requires a queue (-q)."
        elif args.queue and not args.scheduler:
            return "IPython parallel queue (-q) supplied. This also requires a scheduler (-s)."
        elif args.paralleltype == "ipython" and (not args.queue
                                                 or not args.scheduler):
            return "IPython parallel requires queue (-q) and scheduler (-s) arguments."


if __name__ == '__main__':
    # sys.argv.extend(['upgrade' ,  '--tooldir', '/usr/local', '--genomes', 'GRCh37', '--aligners', 'bwa', '--aligners', 'bowtie2', '--data'])

    sys.argv.extend([
        '-w', 'template',
        r'D:\python-projects\my_bcbio\config\gatk-variant.yaml', 'project1',
        'sample1.bam', 'sample2_1.fq', 'sample2_2.fq'
    ])
    # sys.argv.extend([ '-h'])

    kwargs = parse_cl_args(sys.argv[1:])
    if "upgrade" in kwargs and kwargs['upgrade']:
        install.upgrade_bcbio(kwargs['args'])
    else:
        if kwargs.get("workflow"):
            setup_info = workflow.setup(kwargs['workflow'],
                                        kwargs.pop("inputs"))
    print(kwargs)
Exemplo n.º 7
0
def _upgrade_bcbio(method):
    """Perform upgrade of bcbio to latest release, or from GitHub development version.
    """
    url = "https://raw.github.com/chapmanb/bcbio-nextgen/master/requirements.txt"
    git_repo = "git://github.com/chapmanb/bcbio-nextgen.git"
    pip_bin = os.path.join(os.path.dirname(sys.executable), "pip")
    if method in ["stable", "system"]:
        sudo_cmd = [] if method == "stable" else ["sudo"]
        subprocess.check_call(sudo_cmd +
                              [pip_bin, "install", "--upgrade", "distribute"])
        subprocess.check_call(sudo_cmd + [pip_bin, "install", "-r", url])
    else:
        subprocess.check_call([
            pip_bin, "install", "--upgrade",
            "git+%s#egg=bcbio-nextgen" % git_repo
        ])


if __name__ == "__main__":
    config_file, kwargs = parse_cl_args(sys.argv[1:])
    kwargs["config_file"] = config_file
    if kwargs["upgrade"] and config_file is None:
        _upgrade_bcbio(kwargs["upgrade"])
    else:
        if kwargs["workflow"]:
            workdir, new_kwargs = workflow.setup(kwargs["workflow"],
                                                 kwargs["inputs"])
            os.chdir(workdir)
            kwargs.update(new_kwargs)
        main(**kwargs)