Biostar Beta. Not for public use.
Trouble with BLAST using Biopython
0
Entering edit mode
14 months ago
tpaisie • 70
University of Florida

I have been using Biopython to make scripts to run sequences through BLAST. I'm using the command:

 NCBIWWW.qblast()

Here is the beginning of most of my scripts:

import sys, os
from Bio import SeqIO, Entrez, SearchIO
from Bio.Blast import NCBIWWW, NCBIXML
from ftplib import FTP
from urllib.error import HTTPError

fasta_string = open(sys.argv[1]).read()
result_handle = NCBIWWW.qblast("blastn", "nt", fasta_string, hitlist_size=10)

save_file = open("my_blast.xml", "w")
save_file.write(result_handle.read())
save_file.close()
result_handle.close()

I couple months ago I had no problem running these scripts, now none of them will run but I will receive no error from the script. It will just look like its running but get suck at the above BLAST command. Is anyone else having a similar issue? If so were you able to fix it?? Thanks so much for the help!!

ADD COMMENTlink
0
Entering edit mode

Can you post more snippets of your script?

ADD REPLYlink
0
Entering edit mode

Edited the original question!

ADD REPLYlink
0
Entering edit mode

You get something in your terminal if you add

print(result_handle.read())

?

ADD REPLYlink
0
Entering edit mode

I added this to my code and only got this in terminal:

ValueError: I/O operation on closed file
ADD REPLYlink
0
Entering edit mode

Where did you add the line, it has to be before the result_handle.close() call is made.

ADD REPLYlink
0
Entering edit mode

Consider reinstalling or updating BioPython? I can't tell you why its suddently stopped working for you, because that code works for me. (Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34), BioPython v1.70)

Has anything about your network (or your local infrastructure) changed? Seems like it could be a network issue.

ADD REPLYlink
0
Entering edit mode

I recall moving from http to https somewhere in the past although I think more than a few months ago. Maybe an update will help

ADD REPLYlink
0
Entering edit mode
14 months ago
tpaisie • 70
University of Florida

I got the script to work finally! Some set up must have been off on my computer or with my biopython!

ADD COMMENTlink
0
Entering edit mode

Great, if you ever figure out exactly what it was, please do post up :)

BTW, once a post has answers, there's no need to close it, so I've reopened this accordingly. To provide closure to the post, you can accept you own post as the thread answer by clicking the check mark.

ADD REPLYlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.3