# get default align_pipeline.py args pipeline_args = ' '.join(['%s="%s"'%(k,v) for k,v in pipeline_args]) print 'align_pipeline.py %s --run-name=%s %s %s --print-args'%(aln,run_name,annoj_args,pipeline_args) def_args = Popen("align_pipeline.py %s --run-name=%s %s %s --print-args"%(aln,run_name,annoj_args,pipeline_args),shell=True,stdout=PIPE,stderr=PIPE).communicate()[0] print def_args wb('Creating script...\n') script_fn = '%s_aln_pipeline.sh'%run_name if (all_tool_settings['tools']['use_modules']): load_modules = """\ %(run_init)s module load %(modules_list)s """%({'run_init':all_tool_settings['modules']['run_init'],'modules_list':' '.join(modules_list)}) else: load_modules = "" with open(script_fn,'w') as script_f : script_f.write(script_template%{'species':species,'aligner':aln, 'load_modules':load_modules,'def_args':def_args}) os.chmod(script_f.name,stat.S_IRWXU|stat.S_IRWXG|stat.S_IROTH) print end_text%{'script_fn':script_fn} wb('Creating parameter file...\n') json_fn = '%s_aln_params.json'%run_name with open(json_fn,'w') as json_f : json.dump(json_dict,json_f,indent=4) except KeyboardInterrupt : sys.stderr.write('\n') error('Script creation interrupted, aborting')
cntrl_fn = 'cntrl_'+cntrl_fn os.symlink(cntrl_path,cntrl_fn) else : cntrl_fn = '' # get default chipseq_pipeline.py args pipeline_args = ' '.join(['%s="%s"'%(k,v) for k,v in pipeline_args.items()]) print 'chipseq_pipeline.py --exp-name=%s %s %s --print-args'%(exp_name,ucsc_args,pipeline_args) def_args = Popen('chipseq_pipeline.py --exp-name=%s %s %s %s --print-args'%(exp_name,ucsc_args,parallel,pipeline_args),shell=True,stdout=PIPE,stderr=PIPE).communicate()[0] print 'def_args=',def_args wb('Creating script...\n') script_fn = '%s_pipeline.sh'%exp_name with open(script_fn,'w') as script_f : script_f.write(script_template%{'exp_path':exp_fn,'cnt_path':cntrl_fn,'organism':org,'exp_name':exp_name,'def_args':def_args}) os.chmod(script_f.name,stat.S_IRWXU|stat.S_IRWXG|stat.S_IROTH) print end_text%{'script_fn':script_fn} wb('Creating parameter file...\n') json_fn = '%s_params.json'%exp_name with open(json_fn,'w') as json_f : json.dump(json_dict,json_f,indent=4) except ValueError as e: sys.stderr.write(e.msg) error('Error encountered in creating script, aborting') except KeyboardInterrupt : sys.stderr.write('\n') error('Script creation interrupted, aborting')