Beispiel #1
0
def setup(args):
    template, template_txt = name_to_config(args.template)
    base_item = template["details"][0]
    project_name, metadata, global_vars = _pname_and_metadata(args.metadata)
    remotes = _retrieve_remote([args.template, args.metadata])
    inputs = args.input_files + remotes.get("inputs", [])
    items = [
        _add_metadata(item, metadata, remotes)
        for item in _prep_items_from_base(base_item, inputs)
    ]

    out_dir = os.path.join(os.getcwd(), project_name)
    work_dir = utils.safe_makedir(os.path.join(out_dir, "work"))
    if len(items) == 0:
        out_config_file = _write_template_config(template_txt, project_name,
                                                 out_dir)
        print "Template configuration file created at: %s" % out_config_file
        print "Edit to finalize custom options, then prepare full sample config with:"
        print "  bcbio_nextgen.py -w template %s %s sample1.bam sample2.fq" % \
            (out_config_file, project_name)
    else:
        out_config_file = _write_config_file(items, global_vars, template,
                                             project_name, out_dir)
        print "Configuration file created at: %s" % out_config_file
        print "Edit to finalize and run with:"
        print "  cd %s" % work_dir
        print "  bcbio_nextgen.py ../config/%s" % os.path.basename(
            out_config_file)
        if remotes.get("base"):
            remote_path = os.path.join(remotes["base"],
                                       os.path.basename(out_config_file))
            bucket, key = utils.s3_bucket_key(remote_path)
            s3.upload_file_boto(out_config_file, bucket, key)
            print "Also uploaded to AWS S3 in %s" % remotes["base"]
            print "Run directly with bcbio_vm.py run %s" % remote_path
Beispiel #2
0
def setup(args):
    template, template_txt = name_to_config(args.template)
    base_item = template["details"][0]
    project_name, metadata, global_vars = _pname_and_metadata(args.metadata)
    remotes = _retrieve_remote([args.template, args.metadata])
    inputs = args.input_files + remotes.get("inputs", [])
    items = [_add_metadata(item, metadata, remotes)
             for item in _prep_items_from_base(base_item, inputs)]

    out_dir = os.path.join(os.getcwd(), project_name)
    work_dir = utils.safe_makedir(os.path.join(out_dir, "work"))
    if len(items) == 0:
        out_config_file = _write_template_config(template_txt, project_name, out_dir)
        print "Template configuration file created at: %s" % out_config_file
        print "Edit to finalize custom options, then prepare full sample config with:"
        print "  bcbio_nextgen.py -w template %s %s sample1.bam sample2.fq" % \
            (out_config_file, project_name)
    else:
        out_config_file = _write_config_file(items, global_vars, template, project_name, out_dir)
        print "Configuration file created at: %s" % out_config_file
        print "Edit to finalize and run with:"
        print "  cd %s" % work_dir
        print "  bcbio_nextgen.py ../config/%s" % os.path.basename(out_config_file)
        if remotes.get("base"):
            remote_path = os.path.join(remotes["base"], os.path.basename(out_config_file))
            bucket, key = utils.s3_bucket_key(remote_path)
            s3.upload_file_boto(out_config_file, bucket, key)
            print "Also uploaded to AWS S3 in %s" % remotes["base"]
            print "Run directly with bcbio_vm.py run %s" % remote_path
Beispiel #3
0
def setup(args):
    template, template_txt = name_to_config(args.template)
    base_item = template["details"][0]
    project_name, metadata, global_vars, md_file = _pname_and_metadata(args.metadata)
    remotes = _retrieve_remote([args.metadata, args.template])
    inputs = args.input_files + remotes.get("inputs", [])
    raw_items = [
        _add_metadata(item, metadata, remotes, args.only_metadata) for item in _prep_items_from_base(base_item, inputs)
    ]
    items = [x for x in raw_items if x]
    _check_all_metadata_found(metadata, items)
    out_dir = os.path.join(os.getcwd(), project_name)
    work_dir = utils.safe_makedir(os.path.join(out_dir, "work"))
    if hasattr(args, "relpaths") and args.relpaths:
        items = [_convert_to_relpaths(x, work_dir) for x in items]
    out_config_file = _write_template_config(template_txt, project_name, out_dir)
    if md_file:
        shutil.copyfile(md_file, os.path.join(out_dir, "config", os.path.basename(md_file)))
    if len(items) == 0:
        print
        print "Template configuration file created at: %s" % out_config_file
        print "Edit to finalize custom options, then prepare full sample config with:"
        print "  bcbio_nextgen.py -w template %s %s sample1.bam sample2.fq" % (out_config_file, project_name)
    else:
        out_config_file = _write_config_file(items, global_vars, template, project_name, out_dir, remotes)
        print
        print "Configuration file created at: %s" % out_config_file
        print "Edit to finalize and run with:"
        print "  cd %s" % work_dir
        print "  bcbio_nextgen.py ../config/%s" % os.path.basename(out_config_file)
        if remotes.get("base"):
            remote_path = os.path.join(remotes["base"], os.path.basename(out_config_file))
            s3.upload_file_boto(out_config_file, remote_path)
            print "Also uploaded to AWS S3 in %s" % remotes["base"]
            print "Run directly with bcbio_vm.py run %s" % remote_path
Beispiel #4
0
def setup(args):
    template, template_txt = name_to_config(args.template)
    run_info.validate_yaml(template_txt, args.template)
    base_item = template["details"][0]
    project_name, metadata, global_vars, md_file = _pname_and_metadata(
        args.metadata)
    remotes = _retrieve_remote([args.metadata, args.template])
    inputs = args.input_files + remotes.get(
        "inputs", []) + [fr for fr in metadata if objectstore.is_remote(fr)]
    if hasattr(args, "systemconfig") and args.systemconfig and hasattr(
            args, "integrations"):
        config, _ = config_utils.load_system_config(args.systemconfig)
        for iname, retriever in args.integrations.items():
            if iname in config:
                inputs += retriever.get_files(metadata, config[iname])
    raw_items = [
        _add_metadata(item, metadata, remotes, args.only_metadata)
        for item in _prep_items_from_base(base_item, inputs, args.force_single)
    ]
    items = [x for x in raw_items if x]
    _check_all_metadata_found(metadata, items)
    out_dir = os.path.join(os.getcwd(), project_name)
    work_dir = utils.safe_makedir(os.path.join(out_dir, "work"))
    if hasattr(args, "relpaths") and args.relpaths:
        items = [_convert_to_relpaths(x, work_dir) for x in items]
    out_config_file = _write_template_config(template_txt, project_name,
                                             out_dir)
    if md_file:
        shutil.copyfile(
            md_file, os.path.join(out_dir, "config",
                                  os.path.basename(md_file)))
    items = _copy_to_configdir(items, out_dir)
    if len(items) == 0:
        print()
        print("Template configuration file created at: %s" % out_config_file)
        print(
            "Edit to finalize custom options, then prepare full sample config with:"
        )
        print("  bcbio_nextgen.py -w template %s %s sample1.bam sample2.fq" % \
            (out_config_file, project_name))
    else:
        out_config_file = _write_config_file(items, global_vars, template,
                                             project_name, out_dir, remotes)
        print()
        print("Configuration file created at: %s" % out_config_file)
        print("Edit to finalize and run with:")
        print("  cd %s" % work_dir)
        print("  bcbio_nextgen.py ../config/%s" %
              os.path.basename(out_config_file))
        if remotes.get("base"):
            remote_path = os.path.join(remotes["base"],
                                       os.path.basename(out_config_file))
            s3.upload_file_boto(out_config_file, remote_path)
            print("Also uploaded to AWS S3 in %s" % remotes["base"])
            print("Run directly with bcbio_vm.py run %s" % remote_path)
Beispiel #5
0
def setup(args):
    template, template_txt = name_to_config(args.template)
    run_info.validate_yaml(template_txt, args.template)
    base_item = template["details"][0]
    project_name, metadata, global_vars, md_file = _pname_and_metadata(args.metadata)
    remotes = _retrieve_remote([args.metadata, args.template])
    inputs = args.input_files + remotes.get("inputs", []) + _find_remote_inputs(metadata)
    remote_retriever = None
    remote_config = None
    if hasattr(args, "systemconfig") and args.systemconfig and hasattr(args, "integrations"):
        config, _ = config_utils.load_system_config(args.systemconfig)
        for iname, retriever in args.integrations.items():
            if iname in config:
                remote_retriever = retriever
                remote_config = remote_retriever.set_cache(config[iname])
                inputs += remote_retriever.get_files(metadata, remote_config)
    raw_items = [_add_metadata(item, metadata, remotes, args.only_metadata)
                 for item in _prep_items_from_base(base_item, inputs, metadata,
                                                   args.separators.split(","), args.force_single)]
    items = [x for x in raw_items if x]
    _check_all_metadata_found(metadata, items)
    if remote_retriever and remote_config:
        items = remote_retriever.add_remotes(items, remote_config)
    out_dir = os.path.join(os.getcwd(), project_name)
    work_dir = utils.safe_makedir(os.path.join(out_dir, "work"))
    if hasattr(args, "relpaths") and args.relpaths:
        items = [_convert_to_relpaths(x, work_dir) for x in items]
    out_config_file = _write_template_config(template_txt, project_name, out_dir)
    if md_file:
        shutil.copyfile(md_file, os.path.join(out_dir, "config", os.path.basename(md_file)))
    items = _copy_to_configdir(items, out_dir)
    if len(items) == 0:
        print()
        print("Template configuration file created at: %s" % out_config_file)
        print("Edit to finalize custom options, then prepare full sample config with:")
        print("  bcbio_nextgen.py -w template %s %s sample1.bam sample2.fq" % \
            (out_config_file, project_name))
    else:
        out_config_file = _write_config_file(items, global_vars, template, project_name, out_dir,
                                             remotes)
        print()
        print("Configuration file created at: %s" % out_config_file)
        print("Edit to finalize and run with:")
        print("  cd %s" % work_dir)
        print("  bcbio_nextgen.py ../config/%s" % os.path.basename(out_config_file))
        if remotes.get("base"):
            remote_path = os.path.join(remotes["base"], os.path.basename(out_config_file))
            s3.upload_file_boto(out_config_file, remote_path)
            print("Also uploaded to AWS S3 in %s" % remotes["base"])
            print("Run directly with bcbio_vm.py run %s" % remote_path)
Beispiel #6
0
def setup(args):
    template, template_txt = name_to_config(args.template)
    base_item = template["details"][0]
    project_name, metadata, global_vars, md_file = _pname_and_metadata(
        args.metadata)
    remotes = _retrieve_remote([args.metadata, args.template])
    inputs = args.input_files + remotes.get("inputs", [])
    raw_items = [
        _add_metadata(item, metadata, remotes, args.only_metadata)
        for item in _prep_items_from_base(base_item, inputs)
    ]
    items = [x for x in raw_items if x]
    _check_all_metadata_found(metadata, items)
    out_dir = os.path.join(os.getcwd(), project_name)
    work_dir = utils.safe_makedir(os.path.join(out_dir, "work"))
    if hasattr(args, "relpaths") and args.relpaths:
        items = [_convert_to_relpaths(x, work_dir) for x in items]
    out_config_file = _write_template_config(template_txt, project_name,
                                             out_dir)
    if md_file:
        shutil.copyfile(
            md_file, os.path.join(out_dir, "config",
                                  os.path.basename(md_file)))
    if len(items) == 0:
        print
        print "Template configuration file created at: %s" % out_config_file
        print "Edit to finalize custom options, then prepare full sample config with:"
        print "  bcbio_nextgen.py -w template %s %s sample1.bam sample2.fq" % \
            (out_config_file, project_name)
    else:
        out_config_file = _write_config_file(items, global_vars, template,
                                             project_name, out_dir, remotes)
        print
        print "Configuration file created at: %s" % out_config_file
        print "Edit to finalize and run with:"
        print "  cd %s" % work_dir
        print "  bcbio_nextgen.py ../config/%s" % os.path.basename(
            out_config_file)
        if remotes.get("base"):
            remote_path = os.path.join(remotes["base"],
                                       os.path.basename(out_config_file))
            s3.upload_file_boto(out_config_file, remote_path)
            print "Also uploaded to AWS S3 in %s" % remotes["base"]
            print "Run directly with bcbio_vm.py run %s" % remote_path