INNER CODE UNIT · Python

proc_chr

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

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:
    # chr   CpG   Pattern   begin_loc   length(bp)


    # use samtools to extract only the reads from 'chrom'
    if in_flags is None:
        in_flags = '-f 3' if paired_end else ''
    else:
        in_flags = f'-f {in_flags}'

    if top_only:
        if paired_end:
            in_flags += " | awk '($2 == 147 || $2 == 99)' "

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…