-
Notifications
You must be signed in to change notification settings - Fork 0
/
SOC_MakeBlastDB.py
28 lines (24 loc) · 1012 Bytes
/
SOC_MakeBlastDB.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 15 16:02:16 2023
@author: laurie
"""
import subprocess
fasta_folder = "blast_files"
database_folder = "blast_databases"
bash_script = """#!/bin/bash
mkdir blast_databases
makeblastdb -in {ff}/psort_extracellular_gramP.fasta -parse_seqids -dbtype prot -out {db}/blastdbP
makeblastdb -in {ff}/psort_extracellular_gramN.fasta -parse_seqids -dbtype prot -out {db}/blastdbN
makeblastdb -in {ff}/EXTRA.fasta -parse_seqids -dbtype prot -out {db}/blastdbCExtra
makeblastdb -in {ff}/NON_EXTRA.fasta -parse_seqids -dbtype prot -out {db}/blastdbCNonExtra
"""
# Format the bash script with the input and output filenames
formatted_script1 = bash_script.format(db=database_folder, ff=fasta_folder)
# Create a temporary file to store the bash script
script_filename1 = 'makedb.sh'
with open(script_filename1, 'w') as script_file:
script_file.write(formatted_script1)
# Execute the bash script
subprocess.run(['bash', script_filename1], check=True)