Biopython NcbiblastpCommandline not working: "No such file or directory: 'test.xml"
0
0
Entering edit mode
2.1 years ago
saubhiksom • 0
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

Biopython • 367 views
ADD COMMENT
0
Entering edit mode

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 parsing test.XML. Why not parse from the same file where you saved the results?

ADD REPLY

Login before adding your answer.

Traffic: 3012 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6