pipeline/script/run_pipeline.py

34 lines
1.5 KiB
Python
Executable File

import argparse
import os
run_wdl_path = os.path.join(os.path.dirname(__file__), 'run_wdl.py')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="JM to run pipeline")
parser.add_argument('-n', '--barcode', help="sample's barcode", required=True)
parser.add_argument('-s', '--normal', help="sample's normal", default='', required=False, nargs='?')
parser.add_argument('-u', '--umi', action='store_true', help="is umi sample", default=False)
parser.add_argument('-i', '--input_dir', help="sample's input_dir/workdir", required=True)
parser.add_argument('-o', '--output_dir', help="Output directory, default ./", default='./')
parser.add_argument('-p', '--project', help="project", required=True)
parser.add_argument('-b', '--bed', help="bed", required=True)
parser.add_argument('-w', '--wdl', help="wdl")
args = parser.parse_args()
res_path = os.path.realpath(os.path.join(args.output_dir, args.barcode))
if not os.path.exists(res_path):
os.mkdir(res_path)
cmd = f'nohup python ' \
f'{run_wdl_path} -n {args.barcode} -s {args.normal} ' \
f'{"-u " if args.umi else ""} -i {args.input_dir} ' \
f'-o {res_path} -b {args.bed} -p {args.project} -w {args.wdl} ' \
f'> {res_path}/{args.barcode}_run.log ' \
f'2>> {res_path}/{args.barcode}_run.log &'
with open(os.path.join(res_path, 'exec'), 'w') as execfile:
execfile.write(cmd + '\n')
os.system(cmd)