Beispiel #1
0
def _run_wham(inputs, background_bams):
    """Run WHAM on a defined set of inputs and targets.
    """
    out_file = os.path.join(_sv_workdir(inputs[0]), "%s-wham.vcf.gz" % dd.get_sample_name(inputs[0]))
    if not utils.file_exists(out_file):
        with file_transaction(inputs[0], out_file) as tx_out_file:
            coords = chromhacks.autosomal_or_x_coords(dd.get_ref_file(inputs[0]))
            parallel = {"type": "local", "cores": dd.get_cores(inputs[0]), "progs": []}
            rs = run_multicore(_run_wham_coords,
                                [(inputs, background_bams, coord, out_file)
                                 for coord in coords],
                                inputs[0]["config"], parallel)
            rs = {coord: fname for (coord, fname) in rs}
            vcfutils.concat_variant_files([rs[c] for c in coords], tx_out_file, coords,
                                          dd.get_ref_file(inputs[0]), inputs[0]["config"])
    return out_file
Beispiel #2
0
def _run_wham(inputs, background_bams):
    """Run WHAM on a defined set of inputs and targets.
    """
    out_file = os.path.join(_sv_workdir(inputs[0]), "%s-wham.vcf.gz" % dd.get_sample_name(inputs[0]))
    if not utils.file_exists(out_file):
        with file_transaction(inputs[0], out_file) as tx_out_file:
            coords = chromhacks.autosomal_or_x_coords(dd.get_ref_file(inputs[0]))
            parallel = {"type": "local", "cores": dd.get_cores(inputs[0]), "progs": []}
            rs = run_multicore(_run_wham_coords,
                                [(inputs, background_bams, coord, out_file)
                                 for coord in coords],
                                inputs[0]["config"], parallel)
            rs = {coord: fname for (coord, fname) in rs}
            vcfutils.concat_variant_files([rs[c] for c in coords], tx_out_file, coords,
                                          dd.get_ref_file(inputs[0]), inputs[0]["config"])
    return out_file
Beispiel #3
0
def _run_wham(inputs, background_bams):
    """Run WHAM on a defined set of inputs and targets.
    """
    out_file = os.path.join(_sv_workdir(inputs[0]), "%s-wham.bedpe" % dd.get_sample_name(inputs[0]))
    if not utils.file_exists(out_file):
        with file_transaction(inputs[0], out_file) as tx_out_file:
            with open(tx_out_file, "w") as out_handle:
                coords = chromhacks.autosomal_or_x_coords(dd.get_ref_file(inputs[0]))
                parallel = {"type": "local", "cores": dd.get_cores(inputs[0]), "progs": ["wham"]}
                rs = run_multicore(_run_wham_coords,
                                   [(inputs, background_bams, coord, out_file)
                                    for coord in coords],
                                   inputs[0]["config"], parallel)
                rs = {coord: fname for (coord, fname) in rs}
                for coord in coords:
                    with open(rs[coord]) as in_handle:
                        shutil.copyfileobj(in_handle, out_handle)
    return out_file
Beispiel #4
0
def _run_wham(inputs, background_bams):
    """Run WHAM on a defined set of inputs and targets.
    """
    out_file = os.path.join(_sv_workdir(inputs[0]),
                            "%s-wham.bedpe" % dd.get_sample_name(inputs[0]))
    if not utils.file_exists(out_file):
        with file_transaction(inputs[0], out_file) as tx_out_file:
            with open(tx_out_file, "w") as out_handle:
                coords = chromhacks.autosomal_or_x_coords(
                    dd.get_ref_file(inputs[0]))
                parallel = {
                    "type": "local",
                    "cores": dd.get_cores(inputs[0]),
                    "progs": ["wham"]
                }
                rs = run_multicore(_run_wham_coords,
                                   [(inputs, background_bams, coord, out_file)
                                    for coord in coords], inputs[0]["config"],
                                   parallel)
                rs = {coord: fname for (coord, fname) in rs}
                for coord in coords:
                    with open(rs[coord]) as in_handle:
                        shutil.copyfileobj(in_handle, out_handle)
    return out_file