[Biopython-dev] Bio.WWW.ExPASy

Michiel De Hoon mdehoon at c2b2.columbia.edu
Thu Nov 29 05:33:51 UTC 2007

Hi everybody,

The Bio.WWW reorganization has been completed for Bio.WWW.InterPro and
Bio.WWW.SCOP. Now I am looking at Bio.WWW.ExPASy.
Bio.WWW.ExPASy is used to access SwissProt, Prosite, and Prodoc records
through ExPASy. Because of the overlapping functionality in Bio.WWW.ExPASy I
now think it is better to keep this module together as Bio.ExPASy instead of
dividing it into Bio.SwissProt and Bio.Prosite.

Bio.WWW.ExPASy contains six functions:

get_prodoc_entry  Interface to the get-prodoc-entry CGI script.
get_prosite_entry Interface to the get-prosite-entry CGI script.
get_prosite_raw   Interface to the get-prosite-raw CGI script.
get_sprot_raw     Interface to the get-sprot-raw CGI script.
sprot_search_ful  Interface to the sprot-search-ful CGI script.
sprot_search_de   Interface to the sprot-search-de CGI script.

plus an internally used function _open. (I added the get_prosite_raw function
as it was missing from the existing Bio.WWW.ExPASy).
These functions call the _open function with the appropriate URL.

Inside the _open function, we have the following code:

    # Wrap the handle inside an UndoHandle.
    uhandle = File.UndoHandle(handle)

    # If the key doesn't exist, ExPASy returns nothing.
    if not uhandle.peekline():
        raise IOError, "no results"

Unfortunately, it is no longer true that ExPASy returns nothing for a
non-existing key. Nowadays, it returns an HTML web page with an error
message. The only exception is the get_prosite_raw function I just added;
here, ExPASy indeed returns nothing for a non-existing key.

So, the uhandle.peekline() will not fail even if the key is non-existing, and
the IOError will not be raised.

In this situation, I think it is better if the functions in Bio.WWW.ExPASy do
not attempt to raise an IOError, and to let the subsequent parsers handle
non-existing queries. The function get_prosite_raw could be an exception,
though I wouldn't be surprised if ExPASy one day decides to make its behavior
consistent with the other functions.

Any comments?


Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1150 St Nicholas Avenue
New York, NY 10032

More information about the Biopython-dev mailing list