python参数传递给shell_python subprocess.call()在将参数传递给shell脚本之前修改参数?...

在Python脚本中使用subprocess.call调用AMOS工具时遇到参数传递问题。`toAmos`和`minimus2`的命令参数未被正确解析,导致AMOS工具无法识别。尝试将参数作为字符串传递时,引发`OSError`,可能是因为子进程将整个字符串视为单一文件路径。解决方案可能涉及调整参数传递方式,避免使用`shell=True`,以确保参数正确传递给shell脚本。
摘要由CSDN通过智能技术生成

我正在写一个用于调用AMOS包的程序的python包装器(专门用于使用AMOS中的良好ol'minimus2合并来自不同来源的基因组程序)。

直接使用shell时应该像这样调用脚本:

toAmos -s myinput.fasta -o testoutput.afg

minimus2 testoutput -D REFCOUNT=400 -D OVERLAP=500[just for clarification:

-toAmos: converts my input.fasta file to .afg format and requires an input sequence argument ("-s") and an output argument ("-o")

-minimus2: merges a sequence dataset against reference contigs and requires an argument "-D REFCOUNT=x" for stating the number of rerference seqeunces in your input and an argument "-D OVERLAP=Y" for stating the minimum overlap between sequences]

因此,在我的脚本中,我使用subprocess.call()来调用必要的AMOS工具。

基本上我这样做:

from subprocess import call:

output_basename = "testoutput"

inputfile = "myinput.fasta"

call(["toAmos", "-s 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值