INNER CODE UNIT · Python

is_region_empty

nloyfer/wgbs_tools · src/python/bam2pat.py:132

def is_region_empty(view_cmd, region, verbose):
    # check if there are reads in the bam file for the requested region
    view_cmd += ' | head -1'
    if not subprocess.check_output(view_cmd, shell=True,
            stderr=subprocess.PIPE).decode().strip():
        if verbose:
            eprint(f'[wt bam2pat] Skipping region {region}, no reads found')
            eprint('[wt bam2pat] ' + view_cmd)
        return True
    return False


def proc_chr(bam, out_path, region, genome, paired_end, ex_flags, in_flags, top_only, bottom_only,
             rg, mapq, debug, blueprint, clip, temp_dir, blacklist, whitelist, min_cpg, mbias, nanopore,
             np_thresh, verbose, long, cpc_call='C', combine_mods=False):
    """ Convert a temp single chromosome file, extracted from a bam file, into pat """

    # Run patter tool on a single chromosome (or region). out_path will have the following fields:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…