Biopython NcbiblastpCommandline not working: "No such file or directory: 'test.xml"
from Bio.Blast.Applications import NcbiblastpCommandline
blastp=r"C:\NCBI\blast-BLAST_VERSION+\bin\blastp.exe"
blastp_cline = NcbiblastpCommandline(blastp, query=r"C:/NCBI/blast-BLAST_VERSION+/bin/test.fasta", db=r'C:/NCBI/blast-BLAST_VERSION+/bin/bos_protein.fasta', outfmt=5, evalue=0.00001, out=r"C:/NCBI/blast-BLAST_VERSION+/bin/test.XML")
blastp_cline
from Bio.Blast import NCBIXML
with open("test.XML") as result_handle:
E_VALUE_THRESH=0.01
blast_records = NCBIXML.parse(result_handle)
blast_record = NCBIXML.read(result_handle)
for alignment in blast_record.alignments:
for hsp in alignment.hsps:
if hsp.expect < E_VALUE_THRESH:
print("****Alignment****")
print("sequence:", alignment.title)
print("length:", alignment.length)
print("e value:", hsp.expect)
print(hsp.query[0:75] + "...")
print(hsp.match[0:75] + "...")
print(hsp.sbjct[0:75] + "...")
Trying to do a local blast using NCBIBLAST+, already downloaded in the mentioned path. I am using Win10 and Spyder. I have my database created as well as the fasta files contain only protein sequences. Still .XML file is not getting created and also the blastp_cline variable is not getting created. Thanks in advance
• 753 views
•
link
0 answers
No answers yet.
Log in to answer this question.
How about you tell us the exact error with line numbers?
With the information we have, it seems like you are saving the file in
C:/NCBI/blast-BLAST_VERSION+/bin/test.XML, but then you are parsingtest.XML. Why not parse from the same file where you saved the results?