[BioPython] python newbies blast problem

Frank Kauff fkauff at duke.edu
Mon Jul 12 10:54:18 EDT 2004


Yep, same happened to me recently with a script that was actually
running fine for quite a while. Did NCBI maybe change some format  so
that the parser gets confused?

Frank

On Mon, 2004-07-12 at 10:34, h.j.tipney at stud.man.ac.uk wrote:
> Hi
> I'm hoping someone 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=','entrez_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)
> 
> ------------------------------------------
> 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 mailing list  -  BioPython at biopython.org
> http://biopython.org/mailman/listinfo/biopython
-- 
Frank Kauff
Dept. of Biology
Duke University
Box 90338
Durham, NC 27708
USA

Phone 919-660-7382
Fax 919-660-7293
Web http://www.lutzonilab.net/member/frankkauff.shtml



More information about the BioPython mailing list