Repository: biopython/biopython

Issue:
ExPASy.sprot_search_ful and ExPASy.sprot_search_de do not work
Both will return just pages stating "Please update your links/bookmarks" and eventually correct link at the end of page.
The functions use http://www.expasy.ch/cgi-bin/sprot-search-ful or http://www.expasy.ch/cgi-bin/sprot-search-de eventually, which pages do not exist anymore.



Discussion:
I don't think those functions ever had a unit test written, which is why no one had noticed till now :(

Have you been able to find the replacements URLs  for these searches (likely via UniProt.org now)?

If I try for example:

```
from Bio import ExPASy
name="GP112_HUMAN"
handle = ExPASy.sprot_search_ful(name)
print handle.read()
```

I get the error page which ends with :

```
<!-- automatically added by Apache -->
Status: 302 Found
Location: http://www.uniprot.org/uniprot?query=GP112_HUMAN&S=on
```

So I guess that

```
http://www.uniprot.org/uniprot?query=
```

could be the correct URL, but that is all I know.

Where possible I would like to change the CGI URLs to point at any replacement service (as done already for `Bio.ExPASy. get_sprot_raw`). For the get functions this shouldn't be too hard - it is clear what the old function would return, and there is some relevant information on this cache of http://www.expasy.org/expasy_urls.html from 2011, https://web.archive.org/web/20110514082912/http://au.expasy.org/expasy_urls.html

A further option is we should formally deprecate `Bio.ExPASy.sprot_search_ful`, `sprot_search_de`, `get_prodoc_entry` etc, and replace the with something under `Bio.UniProt` instead.

For the two search functions, I am unsure what the original web service used to return (what format, plain text perhaps?). Perhaps here is would be best to just wrap the current UniProt search API?

I tried a jab at this in a new branch, putting all request-related code under `Bio.UniProt.API` (or should it be `Bio.UniProt.api`?): https://github.com/bow/biopython/tree/dev_uniprot-api/Bio/UniProt

It's a very bare bone implementation right now (only has the query function and no test), but the general approach shouldn't change much for the other functions.

@bow - Have you looked at this since then?

Should we deprecate these `Bio.ExPASy.get_*` and `Bio.ExPASy.sprot_search_*` functions?

I was reminded of this via #1826 and the tutorial having the (defunct) URLs http://www.expasy.org/cgi-bin/sprot-search-de and http://www.expasy.org/cgi-bin/sprot-search-ful

@bow Should we deprecate these two functions now? What state is the UniProt API wrapper?
@peterjc Deprecating the functions seems sensible given that the upstream services are not there anymore. To be honest, I also have not touched the API for a very long time.

Resolving patch:
diff --git a/Bio/ExPASy/__init__.py b/Bio/ExPASy/__init__.py
--- a/Bio/ExPASy/__init__.py
+++ b/Bio/ExPASy/__init__.py
@@ -13,8 +13,6 @@
  - 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.
 
 """
 
@@ -113,35 +111,3 @@ def get_sprot_raw(id):
     """
     url = "http://www.uniprot.org/uniprot/%s.txt" % id
     return _binary_to_string_handle(_urlopen(url))
-
-
-def sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None,
-                     cgi='https://www.expasy.org/cgi-bin/sprot-search-ful'):
-    """Search SwissProt by full text (BROKEN)."""
-    variables = {'SEARCH': text}
-    if make_wild:
-        variables['makeWild'] = 'on'
-    if swissprot:
-        variables['S'] = 'on'
-    if trembl:
-        variables['T'] = 'on'
-    options = _urlencode(variables)
-    fullcgi = "%s?%s" % (cgi, options)
-    handle = _binary_to_string_handle(_urlopen(fullcgi))
-    return handle
-
-
-def sprot_search_de(text, swissprot=1, trembl=None,
-                    cgi='https://www.expasy.org/cgi-bin/sprot-search-de'):
-    """Search SwissProt (BROKEN).
-
-    Search by name, description, gene name, species, or organelle.
-    """
-    variables = {'SEARCH': text}
-    if swissprot:
-        variables['S'] = 'on'
-    if trembl:
-        variables['T'] = 'on'
-    options = _urlencode(variables)
-    fullcgi = "%s?%s" % (cgi, options)
-    return _binary_to_string_handle(_urlopen(fullcgi))


Test patch: