[Biopython-dev] python newbies blast problem

Jeffrey Chang jeffrey_chang at stanfordalumni.org
Tue Jul 13 23:47:32 EDT 2004


Hello,

This is because the NCBI website is not really meant to be queried by 
computer scripts.  It looks like a recent change has broken the 
NCBIWWW.blast function.  Fortunately, NCBI does have a computer 
friendly BLAST API called QBLAST.  I added an interface to QBLAST into 
biopython called NCBIWWW.qblast.  Please get the updated version of the 
NCBIWWW.py from CVS, and replace NCBIWWW.blast with NCBIWWW.qblast in 
your script, and see if that fixes things.

The anonymous CVS is at:
http://cvs.biopython.org/

Jeff




On Jul 13, 2004, at 9:56 AM, h.j.tipney at stud.man.ac.uk wrote:

> Hi
> I posted this to the other mailing list and got no response so I'm
> hoping you guys can help me. I'm very new to programming and
> even newer to python, so I apologise in advance if this is a simple
> problem with an obvious solution but there are no python
> programmers
> near to help me. Anyway, I inherited the script below and have been
> using it on and off as part of a larger workflow. It has been running
> fine, but I ran it again last week and it didn't give the output I
> expected - it returned the 'your results will be updated in X seconds'
> page rather than the actual results. It has been a while since I had
> used this program and both blast and biopython had been updated
> so
> I've now got the new biopython release (1.30) but I still get the
> 'wrong' output. I'm using python 2.3.3 on solaris, if that helps. Any
> help would be greatly appreciated! Thank you in advance Hannah
> Tipney
>
>     #!/opt/cs/bin/python
>     from Bio import Fasta
>     from Bio.Blast import NCBIWWW
>     import sys
>     import getopt
>
>     opts, args =
>     getopt.getopt(sys.argv[1:],"",['program=','database=','format=','e
>     ntrez_query='])
>
>     print sys.argv
>     print opts
>
>     if len(args)==0:
>         print "no file given"
>         sys.exit(2)
>
>     program = "blastn"
>     database = "nr"
>     format = "Text"
>     #"Homo sapiens [ORGN]"
>
>     short_query=""
>
>     for o,a in opts:
>         print o,a
>         if o == "--program":
>             program = a
>         if o == "--database":
>             database = a
>         if o == "--format":
>             format = a
>         if o == "--entrez_query":
>      short_query = a
>
>     if short_query=="human":
>         query="Homo sapiens [ORGN]"
>     else:
>         query=""
>
>     print "program = %s , database = %s, query = %s" %
>     (program,database,query)
>
>     file_for_blast = open(args[0], 'r')
>     f_iterator = Fasta.Iterator(file_for_blast)
>
>     f_record = f_iterator.next()
>     file_for_blast.close()
>     b_results = NCBIWWW.blast(program, database,
>     f_record,format_type=format, entrez_query=query,timeout=60)
>
>     blast_results = b_results.read()
>     sys.stdout.write(blast_results)
>
> ------- End of forwarded message -------
> ------------------------------------------
> Hannah Tipney
> Manchester University,
> Academic Unit of Medical Genetics,
> St Mary's Hospital,
> Hathersage Road,
> Manchester. M13 0JH.
> UK
>
> tel: +44 (0)161 276 6602
> fax: +44 (0)161 276 6606
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at biopython.org
> http://biopython.org/mailman/listinfo/biopython-dev




More information about the Biopython-dev mailing list