Question: Trouble with BLAST using Biopython
0
gravatar for tpaisie
5 weeks ago by
tpaisie70
University of Florida
tpaisie70 wrote:

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

blast python ncbi • 163 views
ADD COMMENTlink modified 5 weeks ago • written 5 weeks ago by tpaisie70

Can you post more snippets of your script?

ADD REPLYlink written 5 weeks ago by st.ph.n2.4k

Edited the original question!

ADD REPLYlink written 5 weeks ago by tpaisie70

You get something in your terminal if you add

print(result_handle.read())

?

ADD REPLYlink modified 5 weeks ago • written 5 weeks ago by Bastien Herv√©4.2k

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

ValueError: I/O operation on closed file
ADD REPLYlink modified 5 weeks ago • written 5 weeks ago by tpaisie70

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

ADD REPLYlink modified 5 weeks ago • written 5 weeks ago by jrj.healey12k

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 modified 5 weeks ago • written 5 weeks ago by jrj.healey12k

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 written 5 weeks ago by Asaf5.6k
0
gravatar for tpaisie
5 weeks ago by
tpaisie70
University of Florida
tpaisie70 wrote:

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

ADD COMMENTlink written 5 weeks ago by tpaisie70

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 written 5 weeks ago by jrj.healey12k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1144 users visited in the last hour