Hello, I am trying to align a protein sequences to a nucleotide database so am using TBLASTN. Each protein sequence is contained in different files (like over 2000 files). So I opened the directory using glob and want to loop through each file and run the TBLASTN on them but it is giving me this error:
Command line argument error: Argument "query". File is not accessible: `conSeqfile'
Below is my code:
import os
from os import path
import glob
datadir = '/home/chisom/somtee/chisom/multifasta_files/multi_fasta/Muscle_files/Consensus'
os.chdir(datadir)
readfilenames = glob.glob(os.path.join(datadir, '*.fasta'))
db = '/home/chisom/somtee/chisom/multifasta_files/multi_fasta/Mesculenta_305_v6.1.cds.fa'
#A directory for the output data
outdir = '/home/chisom/somtee/chisom/multifasta_files/multi_fasta/Blast_output'
for conSeqfile in readfilenames:
print conSeqfile #printed here to make it is printing the file
out_blast = path.join(outdir, "blastres_" + conSeqfile[4:] + ".txt")
cmd = "tblastn -query conSeqfile -db db -out out_blast -outfmt 6 -evalue 0.00001"
os.system(cmd)
I have been on it for hours and also sourced for similar problems online but still cant figure it out. Any help is appreciated. Thanks
Change the line:
into this:
Thanks @a.zielezinski, your answer helped me. I changed it and it worked