【问题标题】:Making Blast database from FASTA in Python在 Python 中从 FASTA 制作 Blast 数据库
【发布时间】:2012-02-18 15:38:22
【问题描述】:

我该怎么做?我使用 Biopython 并且已经看过手册。当然,我可以在独立的 NCBI BLAST+ 中使用“makeblastdb”从 FASTA 制作 blastdb,但我想在一个程序中完成整个过程。

似乎有两种可能的解决方案。

  1. 查找执行此工作的函数。

    我找不到这个。我已经花了一整天了。

  2. 在 python 中运行“makeblastdb”。

    我在 python shell 中输入了 os.system("C:\blast-2.2.25+\bin\makeblastdb.exe") ,但是我不能给出任何参数。

我该如何解决这个问题? 谢谢你的帮助。

【问题讨论】:

  • 作为一个单独的进程调用makeblastdb时你是如何尝试给参数的?

标签: python biopython fasta blast


【解决方案1】:

这是经典的 Blast,但我认为这个想法保持不变。代码是从我的应用程序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()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-22
    • 2013-06-27
    • 2015-02-24
    • 2012-05-18
    • 2020-09-01
    • 2012-09-02
    • 1970-01-01
    相关资源
    最近更新 更多