INNER CODE UNIT · Python
extend_region
nloyfer/wgbs_tools · src/python/bam2pat.py:32
def extend_region(region, by=MAX_READ_SIZE):
if ':' not in region:
return region
chrom, r = region.split(':')
start, end = map(int, r.split('-'))
start = max(1, start - by)
end += by
return f'{chrom}:{start}-{end}'
def subprocess_wrap(cmd, debug):
if debug:
eprint(cmd)
return
subprocess.check_call(cmd, shell=True, executable='/bin/bash')
def set_regions(bam_path, gr, tmp_dir=None):