Trouble with BLAST using Biopython
1
0
Entering edit mode
5.7 years ago
tpaisie ▴ 80

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!!

python NCBI BLAST • 1.9k views
ADD COMMENT
0
Entering edit mode

Can you post more snippets of your script?

ADD REPLY
0
Entering edit mode

Edited the original question!

ADD REPLY
0
Entering edit mode

You get something in your terminal if you add

print(result_handle.read())

?

ADD REPLY
0
Entering edit mode

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

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

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

ADD REPLY
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 REPLY
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 REPLY
0
Entering edit mode
5.7 years ago
tpaisie ▴ 80

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

ADD COMMENT
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 REPLY

Login before adding your answer.

Traffic: 1603 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