我在通过Python调用一个名为sixpack的EMBOSS程序(通过命令行运行)时遇到问题。
我通过Windows7运行Python,Python版本3.23,Biopython版本1.59,EMBOSS版本6.4.0.4。Sixpack用于翻译所有六个阅读框架中的DNA序列,并创建两个文件作为输出:一个识别ORF的序列文件和一个包含蛋白质序列的文件。
我可以从命令行成功调用三个必需的参数:(-sequence [input file],-outseq [output sequence file],-outfile [protein sequence file])。我一直在使用子进程模块来代替os.system,因为我读到它更强大、更通用。
以下是我的python代码,它运行时没有错误,但没有生成所需的输出文件。
from Bio import SeqIO
import re
import os
import subprocess
infile = input('Full path to EXISTING .fasta file would you like to open: ')
outdir = input('NEW Directory to write outfiles to: ')
os.mkdir(outdir)
for record in SeqIO.parse(infile, "fasta"):
print("Translating (6-Frame): " + record.id)
ident=re.sub("\|", "-", record.id)
print (infile)
print ("Old record ID: " + record.id)
print ("New record ID: " + ident)
subprocess.call (['C:\memboss\sixpack.exe', '-sequence ' + infile, '-outseq ' + outdir + ident + '.sixpack', '-outfile ' + outdir + ident + '.format'])
print ("Translation of: " + infile + "\nWritten to: " + outdir + ident)发布于 2012-07-12 02:59:20
找到答案了..我使用了错误的语法来调用子进程。这是正确的语法:
subprocess.call (['C:\memboss\sixpack.exe', '-sequence', infile, '-outseq', outdir + ident + '.sixpack', '-outfile', outdir + ident + '.format'])https://stackoverflow.com/questions/11398603
复制相似问题