用Python从FASTA生成Blast数据库

2024-10-01 13:33:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我该怎么做?我已经用过生物球和锯子了。当然,我可以在独立的ncbiblast+中使用“makeblastdb”从FASTA生成blastdb,但我想在一个程序中完成整个过程。在

似乎有两种可能的解决办法。在

  1. 找到一个执行此任务的功能。

    I cannot find this. I've spent whole day.

  2. 在python中运行“makeblastdb”。

    I input os.system("C:\blast-2.2.25+\bin\makeblastdb.exe") in my python shell, but I couldn't give any parameters.

我怎么解决这个问题? 谢谢你的帮助。

Tags: 程序功能过程生物vefindthisfasta
1条回答
网友
1楼 · 发布于 2024-10-01 13:33:13

这是经典的爆炸,但我认为想法保持不变。代码是从我的应用程序KimBlast中提取的。我认为这是自我解释:

def on_execute_setup(self, evt):
    """on pressing execute button"""
    FORMAT_EXE = os.path.join(self.blastpath, 'bin', 'formatdb')
    fasta = os.path.join(self.dbpath, self.fasta)
    format_filename = self.format_file.rsplit('.', 1)[0] 
    format_filepath = os.path.join(self.dbpath, format_filename)
    format_type = 'T' if self.format_type == 'protein' else 'F' 

    format_cmd = '%s -i %s -p %s -n %s' % (FORMAT_EXE, fasta, 
                                           format_type, format_filepath)
    process = subprocess.Popen(format_cmd,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE,
                                shell=False)

    (out, err) = process.communicate()

相关问题 更多 >