当我运行命令
时subprocess.call(['intersectBed','-u','-a',out_snv_filter,'-b',cds,'>',out_cds],shell=True)
我得到了解释器中报告的intersectBed
的帮助菜单。
但是当我跑步时
>>> ' '.join(['intersectBed','-u','-a',out_snv_filter,'-b',cds,'>',out_cds])
'intersectBed -u -a test/test.out.snv.filter -b gencode7.cds.bed > test/test.out.cds'
$ intersectBed -u -a test/test.out.snv.filter -b gencode7.cds.bed > test/test.out.cds
程序正常运行。这有什么区别?
答案 0 :(得分:2)
from subprocess import check_call
args = ['intersectBed','-u','-a',out_snv_filter,'-b',cds]
with open(out_cds, 'wb') as outfile:
check_call(args, stdout=outfile)