我无法通过 Python 调用名为 Sixpack 的 EMBOSS 程序(通过命令行运行)。
我通过 Windows 7、Python 3.23 版、Biopython 1.59 版、EMBOSS 6.4.0.4 版运行 Python。Sixpack 用于翻译所有六个阅读框中的 DNA 序列,并创建两个文件作为输出;识别ORF的序列文件,以及包含蛋白质序列的文件。
我可以从命令行成功调用三个必需的参数:( -sequence [input file]
, -outseq [output sequence file]
, -outfile [protein sequence file]
)。我一直在使用 subprocess 模块代替 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)