Package Bio :: Package ExPASy
[hide private]
[frames] | no frames]

Source Code for Package Bio.ExPASy

  1  # Copyright 2000 by Jeffrey Chang.  All rights reserved. 
  2  # This code is part of the Biopython distribution and governed by its 
  3  # license.  Please see the LICENSE file that should have been included 
  4  # as part of this package. 
  5   
  6  """Code to access resources at ExPASy over the WWW. 
  7   
  8  See http://www.expasy.ch/ 
  9   
 10   
 11  Functions: 
 12   - get_prodoc_entry  Interface to the get-prodoc-entry CGI script. 
 13   - get_prosite_entry Interface to the get-prosite-entry CGI script. 
 14   - get_prosite_raw   Interface to the get-prosite-raw CGI script. 
 15   - get_sprot_raw     Interface to the get-sprot-raw CGI script. 
 16   - sprot_search_ful  Interface to the sprot-search-ful CGI script. 
 17   - sprot_search_de   Interface to the sprot-search-de CGI script. 
 18  """ 
 19   
 20  # Importing these functions with leading underscore as not intended for reuse 
 21  from Bio._py3k import urlopen as _urlopen 
 22  from Bio._py3k import urlencode as _urlencode 
 23   
 24  __docformat__ = "restructuredtext en" 
 25   
 26   
27 -def get_prodoc_entry(id, cgi='http://www.expasy.ch/cgi-bin/get-prodoc-entry'):
28 """get_prodoc_entry(id, 29 cgi='http://www.expasy.ch/cgi-bin/get-prodoc-entry') -> handle 30 31 Get a handle to a PRODOC entry at ExPASy in HTML format. 32 33 For a non-existing key XXX, ExPASy returns an HTML-formatted page 34 containing this line: 35 'There is no PROSITE documentation entry XXX. Please try again.' 36 """ 37 # Open a handle to ExPASy. 38 return _urlopen("%s?%s" % (cgi, id))
39 40
41 -def get_prosite_entry(id, 42 cgi='http://www.expasy.ch/cgi-bin/get-prosite-entry'):
43 """get_prosite_entry(id, 44 cgi='http://www.expasy.ch/cgi-bin/get-prosite-entry') -> handle 45 46 Get a handle to a PROSITE entry at ExPASy in HTML format. 47 48 For a non-existing key XXX, ExPASy returns an HTML-formatted page 49 containing this line: 50 'There is currently no PROSITE entry for XXX. Please try again.' 51 """ 52 return _urlopen("%s?%s" % (cgi, id))
53 54
55 -def get_prosite_raw(id, cgi='http://www.expasy.ch/cgi-bin/get-prosite-raw.pl'):
56 """get_prosite_raw(id, 57 cgi='http://www.expasy.ch/cgi-bin/get-prosite-raw.pl') 58 -> handle 59 60 Get a handle to a raw PROSITE or PRODOC entry at ExPASy. 61 62 For a non-existing key, ExPASy returns nothing. 63 """ 64 return _urlopen("%s?%s" % (cgi, id))
65 66
67 -def get_sprot_raw(id):
68 """Get a handle to a raw SwissProt entry at ExPASy. 69 70 For an ID of XXX, fetches http://www.uniprot.org/uniprot/XXX.txt 71 (as per the http://www.expasy.ch/expasy_urls.html documentation). 72 """ 73 return _urlopen("http://www.uniprot.org/uniprot/%s.txt" % id)
74 75
76 -def sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None, 77 cgi='http://www.expasy.ch/cgi-bin/sprot-search-ful'):
78 """sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None, 79 cgi='http://www.expasy.ch/cgi-bin/sprot-search-ful') -> handle 80 81 Search SwissProt by full text. 82 83 """ 84 variables = {'SEARCH': text} 85 if make_wild: 86 variables['makeWild'] = 'on' 87 if swissprot: 88 variables['S'] = 'on' 89 if trembl: 90 variables['T'] = 'on' 91 options = _urlencode(variables) 92 fullcgi = "%s?%s" % (cgi, options) 93 handle = _urlopen(fullcgi) 94 return handle
95 96
97 -def sprot_search_de(text, swissprot=1, trembl=None, 98 cgi='http://www.expasy.ch/cgi-bin/sprot-search-de'):
99 """sprot_search_de(text, swissprot=1, trembl=None, 100 cgi='http://www.expasy.ch/cgi-bin/sprot-search-de') -> handle 101 102 Search SwissProt by name, description, gene name, species, or 103 organelle. 104 105 """ 106 variables = {'SEARCH': text} 107 if swissprot: 108 variables['S'] = 'on' 109 if trembl: 110 variables['T'] = 'on' 111 options = _urlencode(variables) 112 fullcgi = "%s?%s" % (cgi, options) 113 handle = _urlopen(fullcgi) 114 return handle
115