[Biopython-dev] New BLAST web page

Jeffrey Chang jchang at SMI.Stanford.EDU
Thu Mar 15 00:34:34 EST 2001


Hi Brad,

Thanks for looking at this!  Looks like our friends at NCBI have changed
the BLAST pages again and added a bunch of new options.  Looking at the
page source for the CGI page, they seem to have added a bunch of hidden
fields that the CGI script isn't happy to be without:
Get the URL with preset values ? <input type=image BORDER="0"
name="SET_DEFAULTS" value="Yes" SRC="html/geturl_but.gif"><input
name="CLIENT" type="hidden" value="web"><input name="SERVICE"
type="hidden" value="plain"><input name="PAGE" type="hidden"
value="Proteins"><input name="CMD" type="hidden" value="Put"></form>


Just to check, I added a few lines to your new_blast function to see if it
would make the script happier:
    variables = {}
    for k in params.keys():
        if params[k] is not None:
            variables[k] = str(params[k])
    # This returns a handle to the HTML file that points to the results.
    variables['CLIENT'] = 'web'
    variables['SERVICE'] = 'plain'
    variables['PAGE'] = 'Proteins'
    variables['CMD'] = 'Put'
    handle = NCBI._open(cgi, variables, get = 0)


This gets it past the first page, and now gets to the page that tells you
to wait for the results.  However, it's been on that page for a while, so
I don't know if this is completely going to work, or if NCBI is just slow
now!

Jeff






On Wed, 14 Mar 2001, Brad Chapman wrote:

> Hi Jeff;
> Thanks for the SwissProt fixes --
> I kind of suspected there might be more changes then what I fixed, but
> I know nothing about SwissProt since I've never used it, so I'm glad
> an expert got the chance to look at it!
>
> I was just curious -- have you given any thought to messing around
> with the new BLAST page and CGI script? I started with
> what you had for the old BLAST and modified it (what I have so far is
> below) for the new format and variables, but am pretty stuck.
> What I have right now will just keep giving me the query page.
>
> I didn't know if you had any suggestions or thoughts on this. I'm not
> sure if I am missing something fundamental, or if the new pages are
> just harder to work with. Thanks!
>
> Brad
>
> def new_blast(program, database, query,
>               entrez_query = '(none)',
>               filter = 'L',
>               expect = '10',
>               other_advanced = None,
>               show_overview = 'on',
>               ncbi_gi = 'on',
>               format_object = 'alignment',
>               format_type = 'html',
>               descriptions = '100',
>               alignments = '50',
>               alignment_view = 'Pairwise',
>               auto_format = 'on',
>               cgi='http://www.ncbi.nlm.nih.gov/blast/Blast.cgi',
>               timeout = 20):
>     """Blast against the NCBI Blast web page.
>
>     This uses the NCBI web page cgi script to BLAST, and returns a handle
>     to the results. See:
>
>     http://www.ncbi.nlm.nih.gov/blast/html/blastcgihelp.html
>
>     for more descriptions about the options.
>
>     Options:
>     o program - The name of the blast program to run (ie. blastn, blastx...)
>     o database - The database to search against (ie. nr, dbest...)
>     o query - The input for the search, which NCBI tries to autodetermine
>     the type of.
>     o entrez_query - A query to limit the sequences searched against.
>     o filter - Filtering for the input sequence.
>     o expect - The expect value cutoff to include.
>     """
>     params = {'PROGRAM' : program,
>               'DATABASE' : database,
>               'QUERY' : query,
>               'ENTREZ_QUERY' : entrez_query,
>               'FILTER' : filter,
>               'EXPECT' : expect,
>               'OTHER_ADVANCED': other_advanced,
>               'SHOW_OVERVIEW' : show_overview,
>               'NCBI_GI' : ncbi_gi,
>               'FORMAT_OBJECT' : format_object,
>               'FORMAT_TYPE' : format_type,
>               'DESCRIPTIONS' : descriptions,
>               'ALIGNMENTS' : alignments,
>               'ALIGNMENT_VIEW' : alignment_view,
>               'AUTO_FORMAT' : auto_format}
>     variables = {}
>     for k in params.keys():
>         if params[k] is not None:
>             variables[k] = str(params[k])
>     # This returns a handle to the HTML file that points to the results.
>     handle = NCBI._open(cgi, variables, get = 0)
>     # Now parse the HTML from the handle and figure out how to retrieve
>     # the results.
>     refcgi, params = _parse_blast_ref_page(handle, cgi)
>
>     start = time.time()
>     while 1:
>         # Sometimes the BLAST results aren't done yet.  Look at the page
>         # to see if the results are there.  If not, then try again later.
>         handle = NCBI._open(cgi, params, get=0)
>         ready, results, refresh_delay = _parse_blast_results_page(handle)
>         if ready:
>             break
>         # Time out if it's not done after timeout minutes.
>         if time.time() - start > timeout*60:
>             raise IOError, "timed out after %d minutes" % timeout
>         # pause and try again.
>         time.sleep(refresh_delay)
>     return File.UndoHandle(File.StringHandle(results))
>
>
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at biopython.org
> http://biopython.org/mailman/listinfo/biopython-dev
>




More information about the Biopython-dev mailing list