INNER CODE UNIT · Python
tmpdir_cleanup
nloyfer/wgbs_tools · src/python/bam2pat.py:83
def tmpdir_cleanup(tmp_dir):
if tmp_dir is not None:
shutil.rmtree(tmp_dir)
def gen_pat_part(out_path, debug, temp_dir, long):
try:
# if out_path is empty or missing, return None
if not op.isfile(out_path):
eprint(f'[wt bam2pat] Failed in patter: file {out_path} is missing')
return
if op.getsize(out_path) == 0:
eprint(f'[wt bam2pat] Failed in patter: file {out_path} is empty')
return
# sort
pat_path = out_path + PAT_SUFF
cmd = f'sort {out_path} -k2,2n -k3,3 '
if temp_dir: