I have a list of plastid sequences in fasta files, which I need to turn into blast databases as part of a longer pipeline within my python script. I think using a shell subprocess within the script will be the easiest way to do this but I am not getting it to work.
Here is my code:
for i in range(len(fileNameList)):
blastdb_cmd = 'makeblastdb -in ' + fileNameList[i] + (' -out ../Databases/') + genbankIDs[i] + ' -parse_seqids -dbtype nucl -title temp_blastdb'
DB_process = subprocess.Popen(blastdb_cmd,
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
DB_process.wait()
fileNameList
is what I have called the list of plastid sequence file names, and genbankIDs
is the list of genbank IDs that I will be using in the databases.
When I isolate a blastdb_cmd
line and copy and paste it into the shell, it works just fine to produce a database. See example of a blastdb_cmd
below:
makeblastdb -in NC_026291.fasta -out ../Databases/NC_026291 -parse_seqids -dbtype nucl
However, the python script is not making any databases. I don't get any error messages
This is great thank you for your help! Is the
os.system()
the key here?Not sure that I understand the question, but
os.system()
simply passes a pre-formed command string to the shell. This post may help to explain the differences, and it is easy to google for more info if you need it.