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  """ 
  7  This module provides code to access resources at ExPASy over the WWW. 
  8  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   
25 -def get_prodoc_entry(id, cgi='http://www.expasy.ch/cgi-bin/get-prodoc-entry'):
26 """get_prodoc_entry(id, 27 cgi='http://www.expasy.ch/cgi-bin/get-prodoc-entry') -> handle 28 29 Get a handle to a PRODOC entry at ExPASy in HTML format. 30 31 For a non-existing key XXX, ExPASy returns an HTML-formatted page 32 containing this line: 33 'There is no PROSITE documentation entry XXX. Please try again.' 34 """ 35 # Open a handle to ExPASy. 36 return _urlopen("%s?%s" % (cgi, id))
37 38
39 -def get_prosite_entry(id, 40 cgi='http://www.expasy.ch/cgi-bin/get-prosite-entry'):
41 """get_prosite_entry(id, 42 cgi='http://www.expasy.ch/cgi-bin/get-prosite-entry') -> handle 43 44 Get a handle to a PROSITE entry at ExPASy in HTML format. 45 46 For a non-existing key XXX, ExPASy returns an HTML-formatted page 47 containing this line: 48 'There is currently no PROSITE entry for XXX. Please try again.' 49 """ 50 return _urlopen("%s?%s" % (cgi, id))
51 52
53 -def get_prosite_raw(id, cgi='http://www.expasy.ch/cgi-bin/get-prosite-raw.pl'):
54 """get_prosite_raw(id, 55 cgi='http://www.expasy.ch/cgi-bin/get-prosite-raw.pl') 56 -> handle 57 58 Get a handle to a raw PROSITE or PRODOC entry at ExPASy. 59 60 For a non-existing key, ExPASy returns nothing. 61 """ 62 return _urlopen("%s?%s" % (cgi, id))
63 64
65 -def get_sprot_raw(id):
66 """Get a handle to a raw SwissProt entry at ExPASy. 67 68 For an ID of XXX, fetches http://www.uniprot.org/uniprot/XXX.txt 69 (as per the http://www.expasy.ch/expasy_urls.html documentation). 70 """ 71 return _urlopen("http://www.uniprot.org/uniprot/%s.txt" % id)
72 73
74 -def sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None, 75 cgi='http://www.expasy.ch/cgi-bin/sprot-search-ful'):
76 """sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None, 77 cgi='http://www.expasy.ch/cgi-bin/sprot-search-ful') -> handle 78 79 Search SwissProt by full text. 80 81 """ 82 variables = {'SEARCH': text} 83 if make_wild: 84 variables['makeWild'] = 'on' 85 if swissprot: 86 variables['S'] = 'on' 87 if trembl: 88 variables['T'] = 'on' 89 options = _urlencode(variables) 90 fullcgi = "%s?%s" % (cgi, options) 91 handle = _urlopen(fullcgi) 92 return handle
93 94
95 -def sprot_search_de(text, swissprot=1, trembl=None, 96 cgi='http://www.expasy.ch/cgi-bin/sprot-search-de'):
97 """sprot_search_de(text, swissprot=1, trembl=None, 98 cgi='http://www.expasy.ch/cgi-bin/sprot-search-de') -> handle 99 100 Search SwissProt by name, description, gene name, species, or 101 organelle. 102 103 """ 104 variables = {'SEARCH': text} 105 if swissprot: 106 variables['S'] = 'on' 107 if trembl: 108 variables['T'] = 'on' 109 options = _urlencode(variables) 110 fullcgi = "%s?%s" % (cgi, options) 111 handle = _urlopen(fullcgi) 112 return handle
113