这是经典的 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()